My Application is going to have 3 type of people entity or maybe more in the future.
For now I have Customers, Agents and Employees. So I created one main Entity which I called Person, and
have these 3 models get inheritance from the Person model.
And to avoid repeating codes on this three entities during implementation, I make use of C#’s Generics,
To illustrate generics in my Unit Testing using Moq. The following codes are for your perusal Kids.! Enjoy!
public class CustomersControllerTest
public CustomersControllerTest(Mock<IPersonRepository<Customer>> repositoryMock)
_repositoryMock = repositoryMock;
public void SetUp()
_repositoryMock = new Mock<IPersonRepository<Customer>>();
controller = new CustomersController(_repositoryMock.Object);