DEV Community

Matheus Rodrigues
Matheus Rodrigues

Posted on • Originally published at matheus.ro on

Unit Tests In ASP.NET Core Controllers

In this new series of posts, I want to show different aspects of testing an ASP.NET core application.

I will start in this post showing how to create unit tests for controllers. Then I am going to talk integration test in the controller and explore ASP.NET core new feature, Test Host. After that, let’s see how we can test our application business logic.

Moving to the database realm. I’m going to show how we can create unit tests for code that deals with DbContext, using Entity Framework Core In-memory database feature. And them, how to do integration tests with a real database, with strategies to maintain a database for integration tests.

Let’s jump right into it!

Continue Reading...

Discussion (0)