The goal of this document is to highlight some features of this solution. If you are intrested only in how to run this project then in short we just need to find the docker-compose.yml file and run docker compose up command in the same directory as the file. For a more step by step explanation look at the next section.
The only way to run it at the moment it through docker compose. There are couple of docker compose files included in the src folder.
- docker-compose.yml - This file is for running the app and its supporting services in Release mode.
- docker-compose.debug.yml - This file is for running the app and its supporting services in Debug mode. You can also attached debugger to the app if you run it using this file.
Steps to run the application
- Open terminal and change directory into the root folder
- Run one of the following commands depending on what mode you want to run the app in.
docker compose -f src/docker-compose.yml up
or
docker compose -f src/docker-compose.debug.yml up
- Open your browser and navigate to the following link to open the swagger doc.
http://localhost:3000/swagger
Note that we need to have docker running before running these commands. Other than that no addtional steps necessery. The docker compose contains all the necessery services to run the app , the database and to populate the data.
All tests can be found in the tests folder and are grouped under one test project called AppointmentSystems.Tests.csproj. You don't need to have the docker compose up and running to run the tests. Tests (integration tests) manage their own container creation using a package called TestContainers.
There are two types of tests.
-
Unit tests - These only check individual classes of the application. You can run them via the following command in the project root directory.For these tests you don't need docker up and running.
dotnet test AppointmentSystem.sln --filter "Type=Unit"
-
Integration Tests - These tests check the logic of fetching data from the database. To run them you need docker up and running and can use the following command in the project root directory
dotnet test AppointmentSystem.sln --filter "Type=Integration"
Note : Tests use the same migration scripts as the application database to create and pouplate the data and all other necessery resources in the database. More on that below.
To initalize and load the data in the database and the test database we use the migration projects.
- AppointmentSystsem.Migration - This project contains all the sql scripts including the init.sql script that creates and pouplates all the necessery resoruces in the database. It also contains new scripts for creating indexes and a view.
- AppointmentSystem.MigrationRunner - The project runs the migration on the application database (not on the test database).
This folder contains a .http file called AppointmentSystemApi. This file esentially contains all the tests cases found in the index.js file in an http request format. This was mainly used to manually tests the api during developement.
- .NET 8
- Docker
- IDE such as VsCode, Visual Studio, Rider
- TestContainers