Rhino Mock Entity Framework using UnitofWork Pattern not working

孤人 提交于 2019-12-04 07:29:32

MikeEast is correct. Rhino.Mocks doesn't do recursive mocking. You need to mock up the Servers property to return something (just create an empty IObjectSet<tblServer> and set that up as the return value).

Also, you don't want to set expectations on lambdas. Once everything gets compiled, the lambda in your code and the lambda in your unit test are two totally different methods (and your expectation will always fail). See http://groups.google.com/group/rhinomocks/msg/318a35ae7536d90a for more details.

There is probably some reflection going on internally and hence you are not getting a straight forward call to your unit of work.

I strongly suggest switching to nhibernate. Also, ditch WCF.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!