A console application that retrieves the status of any road that is managed by TfL (backed by their Road endpoint).
All the commands detailed below are ran via Powershell 7.1.5.
Before running the application or tests you need an app key which has access to TfL's Road api. Once you have this you must configure the AppKey via a machine level environment variable or enter it into the appsettings.json file.
You can add the system level environment variable via system properties however the simplest way of setting the environment variable is via setx command as follows via powershell:
setx TfLApiConfig__AppKey "YOUR_API_KEY" /M
To remove this variable run (as admin):
REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /F /V TfLApiConfig__AppKey
dotnet build .\RoadStatus.sln
dotnet run --project .\src\RoadStatus.Console\RoadStatus.Console.csproj a1
or .\src\RoadStatus.Console\bin\Debug\net5.0\RoadStatus.Console.exe a1
dotnet run --project .\src\RoadStatus.Console\RoadStatus.Console.csproj a99
or .\src\RoadStatus.Console\bin\Debug\net5.0\RoadStatus.Console.exe a99
dotnet run --project .\src\RoadStatus.Console\RoadStatus.Console.csproj
or .\src\RoadStatus.Console\bin\Debug\net5.0\RoadStatus.Console.exe
dotnet run --project .\src\RoadStatus.Console\RoadStatus.Console.csproj " "
or .\src\RoadStatus.Console\bin\Debug\net5.0\RoadStatus.Console.exe " "
Before running the tests you need an app key which has access to TfL's Road api. Once you have this you must configure the AppKey via a secrets.json file as follows
Run the following commands while at the root of the repo:
dotnet user-secrets init --project .\tests\RoadStatus.EndToEndTests\RoadStatus.EndToEndTests.csproj
dotnet user-secrets set "TfLApiConfig:AppKey" "YOUR_API_KEY" --project .\tests\RoadStatus.EndToEndTests\RoadStatus.EndToEndTests.csproj
You can confirm these have been set successfully via dotnet user-secrets set "TfLApiConfig:AppKey" "faeb9e1b43214fde95500b1a7563170e" --project .\tests\RoadStatus.EndToEndTests\RoadStatus.EndToEndTests.csproj
Using the .NET cli:
dotnet test .\tests\RoadStatus.EndToEndTests\RoadStatus.EndToEndTests.csproj
dotnet test .\tests\RoadStatus.UnitTests\RoadStatus.UnitTests.csproj
To remove user secrets run the following:
dotnet user-secrets clear --project .\tests\RoadStatus.EndToEndTests\RoadStatus.EndToEndTests.csproj
The dotnet user-secrets have been available since .net core 2.1.