unit test with lambda fail using rhino mock

前端 未结 2 565
后悔当初
后悔当初 2021-01-26 09:02

If I have this test

Expect.Call(_session.Single(x => x.Email == userModel.Email)).Repeat.Once().Return(null);

Telling me

2条回答
  •  逝去的感伤
    2021-01-26 09:19

    The lambda in your unit test compiles into a class-level method (a method inside your unit test). Inside your controller, a different lambda compiles into a class-level method (inside the controller). Two different methods are used so Rhino Mocks shows the expectation error. More here: http://groups.google.com/group/rhinomocks/browse_frm/thread/a33b165c16fc48ee?tvc=1

提交回复
热议问题