diff --git a/dot-net-core/.tool-versions b/dot-net-core/.tool-versions new file mode 100644 index 0000000..0e1ae0a --- /dev/null +++ b/dot-net-core/.tool-versions @@ -0,0 +1 @@ +dotnet 10 diff --git a/dot-net-core/README.md b/dot-net-core/README.md index b3e81e0..fc3d41d 100644 --- a/dot-net-core/README.md +++ b/dot-net-core/README.md @@ -1,19 +1,32 @@ # .NET Core -Pairing test skeleton using .NET core and `nunit` for testing. +Skeleton project for .NET Core (C#). + +## Prerequisites + +The toolchain this project needs is declared in [`.tool-versions`](./.tool-versions): + +``` +dotnet 10 +``` + +Install those however you prefer, as long as they end up on your `PATH`. The quickest route is +[mise](https://mise.jdx.dev/), which reads the file for you: + +```sh +mise install +``` ## Usage -- `./script/setup` to install dependencies (uses [homebrew](https://brew.sh/)) -- `./script/test` to run the tests -- `./script/start` to run the code +- `./script/setup` to restore dependencies +- `./script/test` to run the tests, or `./script/test --watch` to re-run them on every change +- `./script/start` to run the app ## Structure - Code located in [`PairingTest.cs`](./Code/PairingTest.cs) - Tests located in [`Tests.cs`](./Test/Tests.cs) -However, you're free to organise your code as you like. +However, you're free to organise your code as you like. ## Notes -IDE-wise you can use VS Code with the standard Microsoft C# extension. - -Skeleton created following these instructions: https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-nunit +IDE-wise you can use VS Code with the standard Microsoft C# extension. diff --git a/dot-net-core/script/setup b/dot-net-core/script/setup index 95a1b8c..48089ae 100755 --- a/dot-net-core/script/setup +++ b/dot-net-core/script/setup @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -brew install dotnet-sdk +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +dotnet restore diff --git a/dot-net-core/script/start b/dot-net-core/script/start index 09d01b5..66b2051 100755 --- a/dot-net-core/script/start +++ b/dot-net-core/script/start @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." dotnet run --project Code diff --git a/dot-net-core/script/test b/dot-net-core/script/test index d2ba6d7..3dc4035 100755 --- a/dot-net-core/script/test +++ b/dot-net-core/script/test @@ -1,5 +1,11 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -dotnet test +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +if [[ "${1:-}" == "--watch" ]]; then + dotnet watch test +else + dotnet test +fi