Exemple #1
0
        public void SetUpSessionStateThrowsIfSessionStateValueIsInvalid()
        {
            // Arrange
            var page               = new Mock <WebPage>(MockBehavior.Strict);
            var startPage          = new InvalidSessionState();
            var webPageHttpHandler = new WebPageHttpHandler(page.Object, startPage: new Lazy <WebPageRenderingBase>(() => startPage));
            var context            = new Mock <HttpContextBase>(MockBehavior.Strict);

            // Act
            Assert.Throws <ArgumentException>(() => SessionStateUtil.SetUpSessionState(context.Object, webPageHttpHandler, new ConcurrentDictionary <Type, SessionStateBehavior?>()),
                                              "Value \"jabberwocky\" specified in \"~/_Invalid.cshtml\" is an invalid value for the SessionState directive. Possible values are: \"Default, Required, ReadOnly, Disabled\".");
        }
        public void SetUpSessionStateThrowsIfSessionStateValueIsInvalid()
        {
            // Arrange
            var page = new Mock<WebPage>(MockBehavior.Strict);
            var startPage = new InvalidSessionState();
            var webPageHttpHandler = new WebPageHttpHandler(page.Object, startPage: new Lazy<WebPageRenderingBase>(() => startPage));
            var context = new Mock<HttpContextBase>(MockBehavior.Strict);

            // Act
            Assert.Throws<ArgumentException>(() => SessionStateUtil.SetUpSessionState(context.Object, webPageHttpHandler, new ConcurrentDictionary<Type, SessionStateBehavior?>()),
                "Value \"jabberwocky\" specified in \"~/_Invalid.cshtml\" is an invalid value for the SessionState directive. Possible values are: \"Default, Required, ReadOnly, Disabled\".");
        }