Documentation

Support

Create a unit test project

Set up a unit test project in JetBrains Rider or Microsoft Visual Studio.
Read time 1 minuteLast updated a day ago

Before you create a unit test, first set up a unit test project. This page describes how to set up a project in the following IDEs:

JetBrains Rider

  1. Select File > New....
  2. Select a Unit Test Project, making sure that you select the right template for either .Net Core or .Net Framework (this must be match your module project).
  3. Name the test project.
  4. Select Create.

Microsoft Visual Studio

  1. Right-click the solution, then Add > New Project....
  2. Select .NET > NUnit Library Project.
  3. Select Next.
  4. Name the test project.
  5. Select Create.

Exclude unit tests from publishing

Exclude your test projects from publishing to prevent size issues and inefficiencies with your modules. You can exclude test projects in the following ways:

Remove from solution release configuration

In your IDE, open the solution configuration and remove the test project from the release configuration. They should not be enabled for build. Examples for Visual Studio and Rider below:
Rider Solution Config Management

Rider Solution Config Management

VS Solution Config Management

VS Solution Config Management

Set IsPublishable to false

In your unit test project properties, set
IsPublishable
to false:
<PropertyGroup>... <IsPublishable>false</IsPublishable>....</PropertyGroup>