A test project is a .NET console application that contains automated tests and their dependencies. Tests run application code in isolation and check whether it behaves as expected. section 35.1
A typical test project depends on three components:
- The .NET Test SDK, which connects testing with the .NET SDK. section 35.1
- A testing framework such as xUnit, NUnit, Fixie, or MSTest. section 35.1
- A test-runner adapter that lets dotnet test and Visual Studio execute the tests. section 35.1
Create and run an xUnit test project
Create an xUnit project with dotnet new xunit. The project includes Microsoft.NET.Test.Sdk, xunit, and xunit.runner.visualstudio packages. Run its tests with dotnet test or use Test Explorer in Visual Studio; both approaches produce the same results. Use [Fact] for a public, parameterless test and [Theory] when the test accepts parameters and repeats with different data. section 35.7 section 35.1
<ItemGroup> <ProjectReference Include="..\..\src\ExchangeRates.Web\ExchangeRates.Web.csproj" /> </ItemGroup>
Add a ProjectReference from the test project to the application project so tests can exercise its classes. section 35.4

