Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
justindbaur committed Sep 24, 2023
1 parent 070d17f commit a818f19
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 48 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build
on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install .NET
uses: actions/setup-dotnet@v3

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-restore --no-build
86 changes: 46 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,66 @@

## Benchmarks vs Competitors

> Doing a simple `Is.IsAny<string>()` or equivalent call.
| Method | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
|---------------- |-------------:|-----------:|-------------:|-------------:|-------:|-------:|----------:|
| MoqTest | 46,155.49 ns | 919.804 ns | 1,999.579 ns | 45,122.63 ns | 1.3428 | 1.2207 | 8850 B |
| NSubstituteTest | 4,011.88 ns | 76.549 ns | 85.084 ns | 4,004.60 ns | 1.2360 | 0.0381 | 7760 B |
| PretenderTest | 31.41 ns | 0.683 ns | 1.231 ns | 30.86 ns | 0.0268 | - | 168 B |

## To-do list

In no particular order

- [x] Intercept .Create calls
- [x] Base Implementation name off of ITypeSymbol derived info
- [ ] Should allow naming customization
- [ ] Respect [Pretend] attribute that is placed on a partial class
## 0.1.0
- [x] Intercept `.Create` calls
- [x] Base implementation name off of `ITypeSymbol` derived info
- [x] Async/Task Support
- [ ] Custom awaitable (honestly don't think I care)
- [ ] Classes (maybe already do)
- [x] Benchmark vs NSub & Moq
- [ ] A lot more benchmarks
- [x] Property Support
- [ ] Property setter
- [ ] Static Abstract (not support but we should fake an implementation)
- [ ] More matchers
- [ ] Probably need a static matcher register :(
- [x] Compiled Setup calls
- [x] Intercept Setup calls
- [x] Support Base MatcherAttribute
- [ ] Support Matcher arguments and fallback if impossible
- [x] Special case AnyMatcher
- [x] Intercept Setup calls
- [x] Support Base MatcherAttribute
- [x] Special case AnyMatcher
- [x] Multiple uses of single type
- [ ] Protected classes
- [ ] Analyze all the things
- [x] Classes
- [x] Constructor support
- [ ] All Create() to take constructor arguments & analyze them for likely match
- [ ] Debugger story
- [ ] We do people want to step into
- [ ] What objects will they inspect and how can it be helpful
- [ ] Documentation
- [ ] Make Pretend Implementation castable to something you can get the Pretend out of
- [ ] Check how many times a call has been made
- [x] out parameters
- [x] Make our own delegate for matcher calls
- [ ] Multiple method overloads
- [ ] Special case known good "Fake" implementations
- [ ] EphemeralDataProtectionProvider
- [ ] TimeProvider
- [ ] TestLogger
- [x] Maybe not even use expressions in Setup
- [x] Use `Span<object?>` for `CallInfo` arguments
- [x] Multiple method overloads

## 0.2.0

- [ ] Check how many times a call has been made
- [ ] Take constructor args in `.Create()` call
- [ ] Respect `[Pretend]` attribute that is placed on a partial class
- [ ] A lot more benchmarks
- [ ] Property setter
- [ ] Static Abstract (not support but we should fake an implementation)
- [ ] More matchers
- [ ] Probably need a static matcher register :(
- [ ] Support Matcher arguments and fallback if impossible
- [ ] Obsolete public types that exist only for SourceGen
- [ ] And move to Pretender.Internals namespace
- [ ] pragma disable obsolete warnings
- [ ] Compiled Behaviors?
- [ ] And move to Pretender.Internals namespace
- [ ] pragma disable obsolete warnings
- [ ] More Behaviors
- [x] Methods with no args should use Array.Empty<object?>()
- [x] Or should use collection initializers
- [x] Am I sure we can't use ref struct for CallInfo?
- [ ] Use CancellationToken everywhere
- [ ] Use CancellationToken everywhere


## 0.3.0

- [ ] Special case known good fake implementation over mocking
- [ ] EphemeralDataProtectionProvider
- [ ] TimeProvider
- [ ] Make Pretend Implementation castable to something you can get the Pretend out of


## Future Ideas
- [ ] What can I do with things that are `protected` or `sealed`
- [ ] Analyze all the things
- [ ] Custom awaitable (honestly don't think I care)
- [ ] Analyze constructor args them for likely match
- [ ] Debugger story
- [ ] We do people want to step into
- [ ] What objects will they inspect and how can it be helpful
- [ ] Documentation

5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "8.0.100-rc.1.23455.8"
}
}
9 changes: 1 addition & 8 deletions perf/Comparison/Simple.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using BenchmarkDotNet.Attributes;

using BenchmarkDotNet.Attributes;
using Pretender;

namespace Comparison
Expand Down

0 comments on commit a818f19

Please sign in to comment.