【发布时间】:2016-02-11 16:44:16
【问题描述】:
我使用 Moq 进行了以下单元测试验证:
var mock = new Mock<IDoSomethingUseful>();
var sut = new Thingy(mock.Object);
sut.CallDoSomethingUseful();
mock.Verify(
somethingUseful => somethingUseful.Move(
It.Is<MyVector>(
myVector => myVector.x == 123)), Times.Once, "This fail message needs to be hard-coded with myVector.x was not equal to 123");
- 如何让 Verify() 告诉我谓词匹配失败?测试运行器只报告调用失败,所以我需要依赖硬编码的消息。
【问题讨论】:
标签: moq