0

Right now I am using NBuilder to generate Customers in my mock repository. Unfortunately the only option I have for random strings seems to be .Phrase()

var customers = Builder<Customer>.CreateListOfSize(10)
                               .All()
                               .WithConstructor(() => new Customer(
                r.Int().ToString(),
                r.Phrase(5),
                r.Phrase(15),
                r.Phrase(15), // EmailAddress
                r.Phrase(15),
                r.Phrase(15),
                r.DateTime()
                ))
                .Build();

I would love to be able to generate semi-sensible data, like an email address. Is there a way to customise NBuilder to do this, or should I be piecing together two .Phrase() calls with an @ symbol?

VictorySaber
  • 3,084
  • 1
  • 27
  • 45

1 Answers1

1

You can maybe try use Faker.NET is great library for exactly that thing that you need.

In the link you can read about using the library.

http://www.jerriepelser.com/blog/creating-test-data-with-nbuilder-and-faker