Exemple #1
0
        public void ConfigureSessionState_ReadOnly_ChangesHandler()
        {
            // Arrange
            Mock <HttpContextBase> mockHttpContext = new Mock <HttpContextBase>();

            mockHttpContext.SetupProperty(o => o.Handler);
            HttpContextBase httpContext = mockHttpContext.Object;

            DynamicSessionStateConfigurator35 configurator = new DynamicSessionStateConfigurator35(httpContext);

            // Act
            configurator.ConfigureSessionState(ControllerSessionState.ReadOnly);
            IHttpHandler newHandler = httpContext.Handler;

            // Assert
            Assert.AreEqual(typeof(MvcReadOnlySessionHandler), newHandler.GetType());
        }
Exemple #2
0
        public void ConfigureSessionState_Default_DoesNothing()
        {
            // Arrange
            Mock <HttpContextBase> mockHttpContext = new Mock <HttpContextBase>();

            mockHttpContext.ExpectSet(o => o.Handler).Never();
            HttpContextBase httpContext = mockHttpContext.Object;

            DynamicSessionStateConfigurator35 configurator = new DynamicSessionStateConfigurator35(httpContext);

            // Act
            configurator.ConfigureSessionState(ControllerSessionState.Default);
            IHttpHandler newHandler = httpContext.Handler;

            // Assert
            mockHttpContext.Verify();
        }