Skip to content

A minimal template for setting up a .Net Console App project with unit tests using NUnit in VSCode.

Notifications You must be signed in to change notification settings

gjtiquia/dotnet-unit-test-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.Net Unit Test Template

A minimal template for setting up a .Net Console App project with unit tests using NUnit in VSCode.

References

Terminal Commands

Pre-requisites: Have the .Net SDK installed on your local machine.

Run /ConsoleApp/Program.cs

dotnet run --project ConsoleApp

Run all unit tests

dotnet test

Configuration

ConsoleApp and TestProject can be renamed to any other new name by renaming all the files and replacing all occurences of the original names to their new names. See this repository for an example.

Troubleshooting

If you have a different .Net SDK version, change the <TargetFramework> field in AdventOfCode.csproj and UnitTests.csproj to the corresponding version that you have.

Setup Steps

The setup steps used to create this template.

1. Console App Setup

In root directory, using VSCode Command Pallete with C# Dev Kit installed: .Net: New Project > Console App.

Name the project ConsoleApp.

In the ConsoleApp directory, Run the following to create a .gitignore file.

dotnet new gitignore

In the ConsoleApp directory, Run the following command to run the Program.cs file.

dotnet run

2. NUnit Setup

In root directory, using VSCode Command Pallete with C# Dev Kit installed: .Net: New Project > NUnit 3 Test Project.

Name the project TestProject

In the TestProject directory, Run the following to create a .gitignore file.

dotnet new gitignore

In the root directory, run the following command to reference the main project ConsoleApp in the test project TestProject.

dotnet add TestProject/TestProject.csproj reference ConsoleApp/ConsoleApp.csproj

About

A minimal template for setting up a .Net Console App project with unit tests using NUnit in VSCode.

Topics

Resources

Stars

Watchers

Forks

Languages