C#C
C#3y ago
Pibbles

Unit Testing Classes with Dependency Injection (ASP.NET Core)

How do you guys usually handle this? I saw some people mock every single injection which seems pretty horrible, other people end up in a way where they effectively have to rebuild the Program.cs class in their test project.

I'm using xUnit

To be a little more clear. The class I want to test on takes in some interfaces via dependency injection in it's constructor, and these are used in the methods I want to test. - Ideally, I want them to function how they actually would, using the concerete classes injected
Was this page helpful?