From the developer's guide
// C#
[TestFixture]
[ClearMocks] // Clear all mocks between tests
public class TestClass
{
[Test]
[VerifyMocks] // Verify all mocks after tests
public void Authenticated ()
{
Authentication authenticator = new Authentication();
// set up our expectations for 2 Log calls in IsAuthenticated
// "Entering Authentication" Log at first line
// "User login failed user" Log
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
// CAUTION: ALL calls here are mocked!!!
Logger.Log(Logger.NORMAL,null);
Logger.Log(Logger.NORMAL,null);
}
// Thats it folks
// authentication should fail
Assert.IsFalse(authenticator.IsAuthenticated("user","password"));
// Verify is done automatically by the framework.
}
}