File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -30,5 +30,19 @@ public void GivenBuilderWithMethodCalls_WhenCallingBuild_ThenReturnAnObjectWithT
30
30
Assert . That ( customer . LastName , Is . EqualTo ( "Kocaj" ) ) ;
31
31
Assert . That ( customer . YearJoined , Is . EqualTo ( 2010 ) ) ;
32
32
}
33
+
34
+ [ Test ]
35
+ public void GivenBuilder_WhenCallingSet_ShouldOverrideValues ( )
36
+ {
37
+ var builder = new CustomerBuilder ( )
38
+ . Set ( x => x . FirstName , "Pi" )
39
+ . Set ( x => x . LastName , "Lanningham" )
40
+ . Set ( x => x . YearJoined , 2014 ) ;
41
+
42
+ var customer = builder . Build ( ) ;
43
+ Assert . That ( customer . FirstName , Is . EqualTo ( "Pi" ) ) ;
44
+ Assert . That ( customer . LastName , Is . EqualTo ( "Lanningham" ) ) ;
45
+ Assert . That ( customer . YearJoined , Is . EqualTo ( 2014 ) ) ;
46
+ }
33
47
}
34
48
}
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ protected virtual void AlterProxy(TObject proxy) {}
78
78
public TBuilder Set < TValue > ( Expression < Func < TObject , TValue > > property , TValue value )
79
79
{
80
80
_properties [ GetPropertyName ( property ) ] = value ;
81
- return ( TBuilder ) this ;
81
+ return this as TBuilder ;
82
82
}
83
83
84
84
/// <summary>
You can’t perform that action at this time.
0 commit comments