Welcome to .NET Testing
Testing is a critical part of building reliable .NET applications. This tutorial will guide you through the fundamentals of unit testing, integration testing, mocking, and continuous integration.
Use the navigation on the left to explore each topic.
Quick Start
Create a new test project with the .NET CLI:
dotnet new xunit -n MyApp.Tests
cd MyApp.Tests
dotnet add reference ../MyApp/MyApp.csproj
dotnet test
Show a sample test ▶
using Xunit;
using MyApp;
public class CalculatorTests
{
[Fact]
public void Add_ReturnsCorrectSum()
{
var calc = new Calculator();
Assert.Equal(5, calc.Add(2, 3));
}
}