A sample application where I've written some flawed code that will be refactored into testable and more maintainable code
The idea of the application is that someone can order hardware for employees and receive the invoice via email.
We are going to make this code testable by applying the SOLID Princples.
Type in the terminal:
dotnet builddotnet test- Run specific test class:
dotnet test --filter <classname>eg.dotnet test --filter OrderModule1Tests
- Run specific test class:
dotnet run --project WriteTestableCode
We have one solution with two projects:
WriteTestableCode
This contains the example code with the SOLID violations. I've divided this in separate folders:
1. Start: We have one class containing all SOLID violations.
Solutions: Contains every principle applied seperately in their own folders.
WriteTestableCode.Test
We have one test class in the 1. Start folder. Here you can write your own tests while trying to make the OrderModule testable. You can look at tests in the Solutions folder when you get stuck or need some inspiration.