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
3030 Assert . That ( customer . LastName , Is . EqualTo ( "Kocaj" ) ) ;
3131 Assert . That ( customer . YearJoined , Is . EqualTo ( 2010 ) ) ;
3232 }
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+ }
3347 }
3448}
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ protected virtual void AlterProxy(TObject proxy) {}
7878 public TBuilder Set < TValue > ( Expression < Func < TObject , TValue > > property , TValue value )
7979 {
8080 _properties [ GetPropertyName ( property ) ] = value ;
81- return ( TBuilder ) this ;
81+ return this as TBuilder ;
8282 }
8383
8484 /// <summary>
You can’t perform that action at this time.
0 commit comments