If I have the following block of code:
AuthenticationSection authentication = (AuthenticationSection)ConfigurationManager.GetSection("system.web/authentication");
if (authentication.Mode == AuthenticationMode.None)
{
context.AuthenticateRequest += Application_AuthenticateRequest;
}
And I want to verify that AuthenticateRequest did not have an event handler assigned to it how would I do that under the new API? My best guess doesn't seem to work:
// Arrange
AuthenticationModule target = new AuthenticationModule();
var context = Isolate.Fake.Instance<HttpApplication>();
var authenticationSection = Isolate.Fake.Instance<AuthenticationSection>();
Isolate.WhenCalled(() => authenticationSection.Mode).WillReturn(AuthenticationMode.Forms);
// Act
target.Init(context);
// Assert
Isolate.Verify.WasNotCalled(() => context.AuthenticateRequest);
Thanks,
Colin[/code]