Repository Pattern with ISession in Constructor - unit test
I have a repository
EmployeeRepository:IEmployeeReposi开发者_StackOverflow社区tory
EmployeeRepository(Isession session) {}
If I want to write test class to test Save and delete methods in repository,
[Test]
public void Test_Save()
{
//??? - how should i create an instance of my repository? I am not sure how should I pass session in my test class?
_repository.Save(entity);
}
please help.
I would mock out a Session to hand to the repository. make sure your testing the repository and not your network/database :D
精彩评论