开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜