Sib*_*Guy 2 .net c# rhino-mocks
有没有办法设置RhinoMocks期望而不关心返回值?像这样的东西:
repository.Expect(r => r.Add(1)).Return(Anything)
Run Code Online (Sandbox Code Playgroud)
请注意,如果未指定返回值,则将返回默认值.因此对象为null,bool为false,int为0等.
所以在你的情况下,如果你期望一个方法的调用,你可以写
repository.Expect(r => r.Add(1)).Repeat.Once();
Run Code Online (Sandbox Code Playgroud)