public void OnEndRequest_IfDisableRedirectAndStatusIsRedirect_ModifyResponse()
        {
            // Arrange
            HttpResponse           response     = new HttpResponse(null);
            IDictionary            contextItems = new Hashtable();
            Mock <HttpContextBase> contextMock  = new Mock <HttpContextBase>()
            {
                DefaultValue = DefaultValue.Mock
            };
            DisableRedirectStub disableRedirectStub = new DisableRedirectStub(contextItems, response);

            contextMock.SetupGet(hcb => hcb.Items).Returns(contextItems);
            response.StatusCode = 302;

            // Act
            SuppressFormsAuthRedirectModule.DisableAuthenticationRedirect(contextMock.Object);
            SuppressFormsAuthRedirectModule.EnsureRestoreUnauthorized(disableRedirectStub);

            // Assert
            Assert.Equal(401, response.StatusCode);
        }
        public void OnEndRequest_IfWebApiControllerReturnsARedirect_DoNothing()
        {
            // Arrange
            HttpResponse           response     = new HttpResponse(null);
            IDictionary            contextItems = new Hashtable();
            Mock <HttpContextBase> contextMock  = new Mock <HttpContextBase>()
            {
                DefaultValue = DefaultValue.Mock
            };
            DisableRedirectStub disableRedirectStub = new DisableRedirectStub(contextItems, response);

            contextMock.SetupGet(hcb => hcb.Items).Returns(contextItems);
            response.StatusCode = 302;

            // Act
            HttpControllerHandler.EnsureSuppressFormsAuthenticationRedirect(contextMock.Object);

            SuppressFormsAuthRedirectModule.AllowAuthenticationRedirect(contextMock.Object);
            SuppressFormsAuthRedirectModule.EnsureRestoreUnauthorized(disableRedirectStub);

            // Assert
            Assert.Equal(302, response.StatusCode);
        }