I want to generate a random string of - say length 80.
I'm thinking something like Fixture.Create<string>(length: 80);
or Fixture.Create<string>(minimumLength: 60, maximumLenth: 100);
. Both would work perfectly fine.
Creating a Customization seems overkill, but maybe that's the correct approach. There are plenty of questions regarding getting a shorter string than the default, which can be achieved with substring, but I need a longer one.
Try this:
string.Join(string.Empty,Fixture.CreateMany<char>(stringLength))
stringLength
is how long you wanted your generated string to be.
or
By default Fixture.Create<string>()
creates a string of length 36.
So if you want a string length more than 36, this code will generate a string of length 72:
string.Join(string.Empty,Fixture.CreateMany<string>(2))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With