Created
November 23, 2017 00:21
-
-
Save NullEntity/49974d1560554b61ef7800597e0e3c74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PostActionTransformation<T> : ISpecimenBuilderTransformation | |
{ | |
private readonly List<ISpecimenCommand> _commands = new List<ISpecimenCommand>(); | |
public ISpecimenBuilder Transform(ISpecimenBuilder builder) | |
{ | |
return new Postprocessor( | |
builder, | |
new CompositeSpecimenCommand(_commands), | |
new IsAssignableToTypeSpecification(typeof(T))); | |
} | |
public PostActionTransformation<T> With<TProperty>(Expression<Func<T, TProperty>> propertyPicker, | |
TProperty value) | |
{ | |
_commands.Add(new BindingCommand<T, TProperty>(propertyPicker, value)); | |
return this; | |
} | |
public PostActionTransformation<T> Do(Action<T, ISpecimenContext> func) | |
{ | |
_commands.Add(new ActionSpecimenCommand<T>(func)); | |
return this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment