I'm currently using C#, but I believe the question applies to more languages.
I have a method, which takes a string value, and throws an exception, if it's too big. I want to unit test it that the exception is correct.
int vlen = Encoding.UTF8.GetByteCount(value);
if (vlen < 0 || 0x0FFFFFFF < vlen)
throw new ArgumentException("Valid UTF8 encodded value length is up to 256MB!", "value");
What is the best way to generate such a string? Should I just have a file of that size? Should I create such a file every time running unit tests?
< 0?