A unit test helper library for C# providing random data generators, temporary file/directory helpers, and handy extension methods.
int GenerateRandomInt()– Returns a random integer between 1 and 9int GenerateRandomInt(int min, int max)– Returns a random integer betweenminandmaxstring GenerateRandomString()– Returns a random string of 10 characters (A-z)string GenerateRandomString(int numberOfCharacters)– Returns a random string with specified lengthList<T> GenerateRandomList<T>(Func<T> generator, int numberOfElements)– Creates a list of random elements using a generator functionbool GenerateRandomBool()– Returns a random booleanDateTime GetGenerateRandomDateTime()– Returns a randomDateTimebetween 1870 and 2300string GenerateRandomStringGuidWithPrefix(string prefix)– Returns a GUID as string with the given prefix
string ToRandomCase(this string text)– Returns the string in random case
TempCreateDirectory(string path)– Creates a directory, deletes it when disposedTempCreateFile(string path, string content)– Creates a file, deletes it when disposedTempCreateFileInFolder(string path, string content)– Creates a file in a folder, deletes both when disposedTempSetEnvVar(string var, string value)– Sets an environment variable temporarily, restores original value when disposedTempSetAppSetting(string key, string value)– Sets an app setting temporarily, restores original value when disposedTempDeleteFile(string filePath)– Removes a file temporarily and restores it when disposed
static bool IsInBetween(this int value, int min, int max)– Checks if value is betweenminandmax, logs message if notstatic bool HasAttribute<T>(this T _, Type attribute) where T : class– Returnstrueif a class has the attributestatic bool HasPropertyWithAttribute<T>(this T _, string propertyName, Type attribute)– Returnstrueif a property exists and has the attribute