Unit tests
Unit tests are enabled for debug and watch docker-compose.yml files. For unit tests xUnit is used.
Local development:
Run watcher, runs source code on file change:
dotnet watch test
Run source code:
dotnet test
Docker development:
Run watcher, run source code on file change:
- Build and compose tests container
docker-compose -f docker-compose.yml -f docker-compose.watch.yml up -d --force-recreate --build tests
- Get a bash shell in the container running container:
docker-compose -f docker-compose.yml -f docker-compose.watch.yml exec tests /bin/bash
- Run watcher:
dotnet watch test
Debug configuration:
- Build and compose tests container
docker-compose -f docker-compose.yml -f docker-compose.debug.yml up -d --force-recreate --build tests
- Get a bash shell in the container running container:
docker-compose -f docker-compose.yml -f docker-compose.debug.yml exec tests /bin/bash
- Run assembly:
dotnet test
Filter tests:
Part:
dotnet test --filter "FullyQualifiedName~Tests.Tasks.Year2020.Day20.Part1"
Day:
dotnet test --filter "FullyQualifiedName~Tests.Tasks.Year2020.Day20"
Year:
dotnet test --filter "FullyQualifiedName~Tests.Tasks.Year2020"