Solutions for 2023 Advent Of Code challenges in C#
Challenge solutions are in tests as assertions:
[Fact]
public void SolveWithFile()
{
var input = File.ReadAllLines("day4/input.txt");
var actual = solver.SomethingToSolve(input);
Assert.Equal(20667, actual);
}
Use temporary container with current directory volume:
$ docker run --rm -it -v $PWD:/app -w /app mcr.microsoft.com/dotnet/sdk:8.0 bash
# dotnet build aoc2023.csproj
# dotnet test --logger "console;verbosity=normal" aoc2023.csproj
# dotnet test --logger "console;verbosity=normal" aoc2023.csproj --filter aoc2023.day2
VSCode can use devcontainers to be configured with the proper extensions and without dotnet executable locally installed.
In order to proceed, install the related extension (ms-vscode-remote.remote-containers
) and reopen vscode in Dev Container mode.
the first run can take some minutes to install and setup properly container and vscode extensions
If you want to open an additional bash session in the vscode container:
$ docker exec -it -w /workspaces/$(basename $PWD) <container-name> bash
# dotnet test --logger .........