File tree Expand file tree Collapse file tree
CSharpExt.UnitTests/AutoFixture
Noggog.Testing/AutoFixture Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using AutoFixture . Kernel ;
2+ using Noggog ;
3+ using Noggog . Testing . AutoFixture ;
4+
5+ namespace CSharpExt . UnitTests . AutoFixture ;
6+
7+ public class PercentBuilderTests
8+ {
9+ [ Theory , DefaultAutoData ]
10+ public void Typical (
11+ Percent sut )
12+ {
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ public void Customize(IFixture fixture)
3232 fixture . Customizations . Add ( new LazyBuilder ( ) ) ;
3333 fixture . Customizations . Add ( new ExtendedListBuilder ( ) ) ;
3434 fixture . Customizations . Add ( new Array2dBuilder ( ) ) ;
35+ fixture . Customizations . Add ( new PercentBuilder ( ) ) ;
3536 fixture . Behaviors . Add ( new ObservableEmptyBehavior ( ) ) ;
3637 fixture . Register < IWorkDropoff > ( ( ) => InlineWorkDropoff . Instance ) ;
3738 fixture . Register < ICreateStream > ( ( ) => NormalFileStreamCreator . Instance ) ;
Original file line number Diff line number Diff line change 1+ using AutoFixture ;
2+ using AutoFixture . Kernel ;
3+
4+ namespace Noggog . Testing . AutoFixture ;
5+
6+ public class PercentBuilder : ISpecimenBuilder
7+ {
8+ private readonly Random _random = new ( ) ;
9+
10+ public object Create ( object request , ISpecimenContext context )
11+ {
12+ if ( request is Type t
13+ && t == typeof ( Percent ) )
14+ {
15+ return new Percent ( _random . NextDouble ( ) ) ;
16+ }
17+ return new NoSpecimen ( ) ;
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments