且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 Moq 测试方法调用顺序

更新时间:2023-12-04 21:10:58

目前似乎尚未实施.请参阅问题 24:MockSequence.该线程讨论了这个问题.

It appears that it's not currently implemented. See Issue 24: MockSequence. This thread discusses the issue.

不过,您可能会考虑修改测试.我通常觉得测试顺序会导致测试脆弱,因为它经常测试实现细节.

You might consider revising your tests, though. I generally feel that testing order leads to fragile tests, as it's often testing implementation details.

我不确定这是否解决了 OP 的问题.Lucero 的回答可能更有帮助.

I'm not sure that this addresses the OP's question. Lucero's answer may be more helpful.