I am new to TDD and I'm going with NUnit and Moq. I have a method where I expect an exception, so I wanted to play a little with the functions of the framework.
My test code is as follows:
[Test] [ExpectedException(ExpectedException = typeof(MockException), ExpectedMessage = "Actual differs from expected")] public void Write_MessageLogWithCategoryInfoFail() { string message = "Info Test Message"; Write_MessageLogWithCategory(message, "Info"); _LogTest.Verify(writeMessage => writeMessage.Info("This should fail"), "Actual differs from expected" ); }
But I always get an error message indicating that the error message is different from the expected message. What am I doing wrong?
source share