Fluent interfaces Create a more simplified language style approach to coding.
Here is a template for an object builder class that gives a fluent interface for the construction of objects:
For each service replace $IYYY$ with the service name
Here is a template for an object builder class that gives a fluent interface for the construction of objects:
[ ExcludeFromCodeCoverage ]
public class $XXX$Builder
{
private $IYYY$ _mock$IYYY$ = Substitute.For<$IYYY$>();
public $XXX$Builder With$IYYY$(
$IYYY$ param )
{
_mock$IYYY$ = param;
return this;
}
public static implicit operator $XXX$( $XXX$Builder builder )
{
return builder.Build();
}
public $XXX$ Build()
{
return new $XXX$( _mock$IYYY$ );
}
}
Replace $XXX$ with your concrete builder target typeFor each service replace $IYYY$ with the service name
No comments:
Post a Comment