Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 RhinoMock 的新手,到目前为止一直在进行状态单元测试。
你如何测试 void 函数?
设置期望时出现以下编译错误,
表达式不产生值
基本上我想测试某个模拟的方法被调用了一定次数。
干杯
您想使用 LastCall。
http://ayende.com/projects/rhino-mocks/api/files/LastCall-cs.html
更好的是,您可以使用带有 lambda 的 Expect.Call 方法:
Expect.Call(() => someVoidFunction());