A library which enables the running of dotnet tests in a docker container
- Reference the nuget package. The easiest way to do this for a number of projects is to include a Directory.Build.targets file at the root of the repo containing:
<Project>
<ItemGroup>
<PackageReference Include="DotNetDockerTest" Version="0.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
- Specify the a base docker image to use for testing:
<DockerTestImage>microsoft/dotnet:2.1.402-sdk-alpine3.7</DockerTestImage>
Then When running tests specify:
dotnet test /p:TestOnDocker=true
Or specify TestOnDocker
msbuild property in your project file.