Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. namespace AutoFixture
  2. {
  3. using Dsl;
  4. using System;
  5. using System.Linq.Expressions;
  6. using Bogus;
  7.  
  8. public static class Extensions
  9. {
  10. public static Faker faker = new Faker();
  11.  
  12. public static IPostprocessComposer<T> With<T, TProperty>(
  13. this ICustomizationComposer<T> @this,
  14. Expression<Func<T, TProperty>> propertyPicker,
  15. Func<Faker, TProperty> valueFactory) =>
  16. @this.With(propertyPicker, () => valueFactory(faker));
  17.  
  18. public static IPostprocessComposer<T> With<T, TProperty>(
  19. this IPostprocessComposer<T> @this,
  20. Expression<Func<T, TProperty>> propertyPicker,
  21. Func<Faker, TProperty> valueFactory) =>
  22. @this.With(propertyPicker, () => valueFactory(faker));
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement