This demo was created for the purposes of meetup series on TDD & Clean Architecture. See the YouTube Meetups. Please note that this project is purely for demo purposes only.
This Banking Kata illustates the application of TDD and Clean Architecture with a Use Case Driven Approach in .NET.
The Use Cases are:
- Open Account
- Withdraw Funds
- Deposit Funds (pending)
- View Account (pending)
.NET 6
Tool dotnet-ef needs to be installed:
dotnet tool install --global dotnet-ef
Installing Stryker:
dotnet tool install -g dotnet-stryker
Set Environment variables in Visual Studio for Optivem.Kata.Banking.Web:
- Right-hand click the project Optivem.Kata.Banking.Web
- Click on "Properties"
- Select "Debug" from the left-hand side menu
- Inside "General" click on "Open debug launch profiles UI"
- In the section "Environment variables" input the following (feel free to adapt the SQL_SERVER_CONNECTION_STRING based on your local machine):
ASPNETCORE_ENVIRONMENT=Development,SQL_SERVER_CONNECTION_STRING=Data Source/=localhost;Initial Catalog/=BankingKata;Integrated Security/=True;MultipleActiveResultSets/=True;
For running the tests, the environment variable SQL_SERVER_CONNECTION_STRING
needs to be configered in Solution Items > test.runsettings
.
Inside Visual Studio, click on Test > Configure Run Settings > Select Solution Wide runsettings File, then select test.runsettings
(note: this is temporary since I saw that Autodetect wasn't working, but I will try again to find a solution for Autodetect).
Environment Variables
$env:SQL_SERVER_CONNECTION_STRING='Data Source=localhost;Initial Catalog=BankingKata;Integrated Security=True;MultipleActiveResultSets=True;'
Update Database:
dotnet ef database update --project .\src\Optivem.Kata.Banking.Infrastructure
Run Build
dotnet build
Run Tests:
dotnet test
Run Mutation Testing:
cd .\test\Optivem.Kata.Banking.Core.Test
PM> dotnet stryker
The following instructions are only relevant to contributors who are changing the DB schema.
To add a migration:
dotnet ef migrations add NameOfSomeMigration --project .\src\Optivem.Kata.Banking.Infrastructure
To remove a migration:
dotnet ef migrations remove --project .\src\Optivem.Kata.Banking.Infrastructure
If you'd like to contribute, see instructions here https://github.com/valentinacupac/banking-kata-dotnet/blob/main/CONTRIBUTING.md