This project is read-only.

Using StringLength on .NET 3.5

Dec 22, 2011 at 4:09 AM
Edited Dec 22, 2011 at 4:15 AM

There is a very nice question on Stack Overflow here.

In the case where a string with 0 length is returned, the created instance is valid.

However, until AutoFixture is updated to a newer version of .NET Framework (ex .NET 4.5), I believe that it could be adjusted to pick a random number inside the range (0 - maximumLength) so the user never gets an empty string.

What are your thoughts/suggestions?

Dec 22, 2011 at 7:08 AM

I definitely think that the behavior should be something else than an empty string.

AutoFixture's default behavior is based on the concept of Constrained Non-determinism, and this is, if ever, a perfect example of a constraint. Within that constraint, the created values should be non-deterministic, yet still valid.

Dec 22, 2011 at 7:38 AM

I created a Work Item here:

Jan 4, 2012 at 10:26 PM

Thank you both for addressing this!