Tarrif Comparison
.NET Core 5.0
Find below desgin pattern, frameworks and tools used in executing the task given;
- Domain Driven Design & Repository Pattern
- Documentation - Swagger
- Logging - Serilog
- Database - Postgress
- Unit Testing - xUnit, Moq
- Global exception handling
For the task, I tried to Keep It Simple by using folders to separate the layers.
- Presentation -> Controllers, Views (but none for this project)
- Application -> Business Use cases
- Domain -> Global Error Handling, Extensions, Entities etx
- Infrastructure -> Connection to database, third party integrations (none in this case)
- Supplied Consumption must be greater than 0 (Exception is thrown if not)
- More products can be created in future To do that, implement ITarrifModel, provide the name and calculation for the new tarrif model. The follwing are the default Model
- BasicConsumptionTarrif
- PackagedConsumptionTarrif
- The product is to return Annual cost and tarrif name ( I will suggest, the consumption is also returned)
- Provide valid postgress database connection string and run the appliaction for the database to be automatically created.
Host={Server_Here};user id={Database_User};password={Database_Password};database={Database_Name};Port=5432
Provide a valid database connection string, when you run the application the database is created automatically.
- You can also decide to run migrations using the following; dotnet ef migrations add Initial dotnet ef database update
dotnet run
A total of 9 test cases were written and all executed successfully. dotnet test