When using Moq Verify() method invocation count, have failing test's error message contain actual method invocation count using Moq
问题 Consider the following, where I am testing that an injected dependency's method is called a specific number of times: [Fact] public void WhenBossTalksEmployeeBlinksTwice() { // arrange var employee = new Mock<IEmployee>(); employee.Setup(e => e.Blink()); var boss = new Boss(employee.Object); // act boss.Talk(); // assert employee.Verify(e => e.Blink(), Times.Exactly(2)); // Passes as expected employee.Verify(e => e.Blink(), Times.Exactly(1)); // Fails as expected } When I force the failing