Share via


Unit Tests

Enterprise Library includes Visual Studio® solution files that include Visual Studio Team System unit tests with the application block projects. You can use the main Enterprise Library solution file (EnterpriseLibrary.VSTS.sln) to build the entire Enterprise Library with the unit tests. This solution contains the entire set of application block projects and the Enterprise Library core projects, and includes all unit tests for execution with the Visual Studio Team System.

The Enterprise Library solution files include two build configurations: Release and Debug. All projects within a solution file are compiled in both configurations, including the unit test projects. For more information, see Building Enterprise Library from the Source Code.

Note

This release of Enterprise Library does not include solutions that use the NUnit test framework.

Software Requirements

To run the unit tests, you must have the following installed:

  • Microsoft Visual Studio 2008 Professional, Visual Studio 2008 Team Edition, Visual Studio 2010 Premium, Visual Studio 2010 Professional, or Visual Studio 2010 Ultimate edition
  • Moq v3.1 assemblies

Organization

The application block unit tests are in projects that are separate from the application block projects. These projects are located in the UnitTests directory. To give the unit test code access to the application block internal types and members, the application blocks use the InternalsVisibleTo attribute (this is also known as declaring a friend assembly.)

Using the Unit Tests

You will not be able to run some of the unit tests if you do not have the Northwind database installed. Some of the unit tests included with Enterprise Library require that the Northwind database be present in the SQL Server instance named .\sqlexpress. The Northwind database does not ship with SQL Server 2005. If you want to run the unit tests that use this database, you can download the scripts to create Northwind from Northwind and pubs Sample Databases for SQL Server 2000.

The scripts that create the databases used by the unit tests (such as CreateCachingDb.cmd and CreateLoggingDb.cmd) all assume that you have a local SQL Server installation with an instance name of SQLEXPRESS.

Other unit tests may have additional dependencies on services such as Windows® Message Queuing or Authorization Manager.