Unit Test Project Structure

Learn how NUnit alters your existing project and learn to layout your application and test code.

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

The creation of an NUnit project generates an empty source file for you to include your tests as well as a ProjectTest.csproj file. The ProjectTest.csproj file includes the following:

Get hands-on with 1400+ tech skills courses.