Resolved Unit test project creation dependency injection mocking

Samuel David

Member
Joined
Nov 29, 2022
Messages
9
Programming Experience
Beginner
Hello Everyone,

Can someone suggest me to create unit test project with mocked dependency injection & other dependencies used in business logic with sample reference.
Thanks
Sam
 
Wouldn't it be better if you write it yourself so that you can better appreciate how the concepts get applied into practice?

Anyway, I think that Martin Fowler's book Refactoring has some examples that you seek, albeit written in Java rather than C#.
 
Or you could simply look at the source code for Xunit. Brad and James believe in dogfooding their own products so you'll see that unit tests for Xunit use Xunit. :)

Alterntively, I think that the tutorials of Moq and Autofac will give a nice walkthrough of how to create and use mocks as well as an inversion of control framework to support dependency injection.
 
Back
Top Bottom