Recently, while working on one of my books, I needed to randomly create data for use in tests and benchmarking of the code. I took what I wrote and created a new NuGet package titled dotNetTips.Utility.Standard.Tester. Below are the major features.
There are a few data models that I have created for use in my testing.
The Coordinate type is a simple structure. Coordinate inherits from ICoordinate along with CoordinateFixed that adds operators and overrides a few methods. Details below.
The Person type is a real-world object that I use to test a business object, simular to one that might be used for a Entity Framework or ASP.NET MVC model. Person inherits from IPerson. Person represents a typical model class. PersonFixed inherits from Person and overrides the operators and a few other methods. PersonProper inherits from IPerson and is simular to PersonFixed but adds validation to the properties. Something required for Object Oriented Programming (encapsulaton). Details below.
To help with generating the custom data models, there is a class called RandomData that will do that along with other features listed below.
- GenerateCharacter: Creates a random character with overloads.
- GenerateCoordinate: Creates a Coordinate object with random x and y values.
- GenerateCoordinateCollection: Creates Coordinate objects in a List collection.
- GenerateDecimal: Creates a random decimal value.
- GenerateEmailAddress: Creates a random email address.
- GenerateInteger: Creates a random integer.
- GenerateKey: Creates a unique key value (based off of a Guid).
- GenerateNumber: Creates a random string of numbers.
- GeneratePerson: Creates a Person object with random values for all of the properties.
- GeneratePersonCollection: Creates a PersonCollection.
- GenerateUrl: Creates a random Url address.
- GenerateWord: Generates a random word for the given length.
This library is available via NuGet for your .NET projects by going to: https://www.nuget.org/profiles/davidmccarter
This project is open-source. You can contribute or view the code by going to: https://dotnettips.visualstudio.com/dotNetTips.Utility.Standard.Tester
- 2019.8.14: Initial release on August, 14th 2019