Installation and Usage
The TestHelperExtensions are a set of extension methods helpful when building unit tests. Methods include functionality for creating random data of various types, converting data types, comparing date data, searching within string arrays, etc.
Installing these extensions using the NuGet package manager is the simplest and easiest way to get started using these extensions. There are 2 options, either of which accomplishes the same thing:
Using the NuGet Package Manager GUI
From the solution containing the test library, select Manage NuGet Packages for Solution.
On the resulting NuGet UI, select the package source nuget.org and the filter All.
Using the search box, search for TestHelperExtensions.
Click on TestHelperExtensions on the left side of the screen to select that package.
On the right side of the screen, be sure the test project in your solution that you want to use these helper methods with is checked and that production projects are not checked.
Click Install to install the package.
Using the NuGet Package Manager Console
From the tools menu in Visual Studio, select NuGet Package Manager -> Package Manager Console.
In the drop-downs at the top of the resulting console window, select the package source nuget.org and be sure that the default project is set to the test project in your solution that you want to use these helper methods with. You do not want to install the extensions into production projects, just unit test projects.
Type Install-Package TestHelperExtensions to install the package.
The NuGet package methods shown above are the simplest and easiest way to get started using these extensions. If, however, you want to load and build the library yourself, you'll can follow the instructions below.
Download the source code from the GitHub repository and open the TestHelperExtensions.sln solution file in Visual Studio. This solution was built using Visual Studio 2015 but was created in much earlier versions and should work fine in older versions of Visual Studio.
Set the configuration to "Release" and build the CBI.TestHelperExtensions project
Copy the CBI.TestHelperExtensions.dll and CBI.TestHelperExtensions.pdb files from the ..\bin\Release folder underneath the project, to the solution in which you want to use the functionality
Set a reference in the unit test project(s) of your solution to the CBI.TestHelperExtensions.dll.
However you install the extensions, they are very simple to use once installed.
Add a Using TestHelperExtensions; declaration to the top of each module from which you want to reference these functions. This is necessary to bring the extension methods into the current scope.
Reference the functions as if they were part of the objects they are supporting. For example, you can generate a random number between 10 and 100 using the statement var randomValue = 100.GetRandom(10);
For detailed information on the classes and methods available in this library, see TestHelperExtensions Namespace