Unit Test Project Structure
Explore how to structure unit test projects in NUnit, understanding the files created and the packages included. Learn best practices for project layout and maintaining clear correspondence between test classes and application code for easier navigation and management.
Introduction
This lesson focuses on how a project directory’s structure and its contents are changed when a unit test project is added, along with descriptions of what the changes mean. This lesson does not provide an overview on how to set up a unit test project as this is covered in other lessons. We’ll look at what happens under the hood when a test project is created either through using an IDE or using the console.
The lesson will also provide an overview of the best practices for the test code project structure.
Files generated upon the unit test project creation
Suppose you add a unit test project to your existing project containing the application code. The directory’s structure looks as follows:
/Solution/
Solution.sln
/ProjectApplication/
Source Files
ProjectApplication.csproj
/ProjectTest/
Source File
ProjectTest.csproj
...