Skip to content

AdemCatamak/ToDoWebApi

Repository files navigation

ToDoWebApi | .github/workflows/github.yml

This project has been prepared to set an example for writing an integration test using Test Containers.

You can access the article referencing this project on Medium.

Medium aracılığıyla bu projeyi referans alan yazıma ulaşabilirsiniz.

Implementation Details

The project uses Sql Server Db.

Communication with the database and creation of database tables are provided by Entity Framework Core.

XUnit library is used when tests are coded.

External components, such as the database required for the tests to run, are created on Docker platform via Test Containers.

Run

The project is developed with .Net Core 3.1. To compile and run, you must have the appropriate .NetCore SDK.

Sql Server database is needed for ToDoWebApi application to work. It will be sufficient to place the connection string belonging to the Sql Server database you have in the SqlServerConnectionStr field in appsettings.json.

Test

The project is developed with .Net Core 3.1. To compile and run, you must have the appropriate .NetCore SDK. In addition, the database will be created as a container with the Docker tool. For this reason, the Docker tool must be installed on your computer in order for the tests to run.

ToDoWebApi.Test project provides access to the database through the port 9999. Therefore, you must make sure that this port is not used in order to start the test process. Another method is to write a port value that you know is empty to the field SqlServerConnectionStr in the appsettings.test.json file.