Exemple #1
0
        public void SetUpSessionStateThrowsIfMultipleSessionStateValueIsInvalid()
        {
            // Arrange
            var page = new PageWithMultipleSesionStateAttributes();
            var webPageHttpHandler = new WebPageHttpHandler(page, startPage: null);
            var context            = new Mock <HttpContextBase>(MockBehavior.Strict);

            // Act
            Assert.Throws <InvalidOperationException>(() => SessionStateUtil.SetUpSessionState(context.Object, webPageHttpHandler, new ConcurrentDictionary <Type, SessionStateBehavior?>()),
                                                      "At most one SessionState value can be declared per page.");
        }
        public void SetUpSessionStateThrowsIfMultipleSessionStateValueIsInvalid()
        {
            // Arrange
            var page = new PageWithMultipleSesionStateAttributes();
            var webPageHttpHandler = new WebPageHttpHandler(page, startPage: null);
            var context = new Mock<HttpContextBase>(MockBehavior.Strict);

            // Act
            Assert.Throws<InvalidOperationException>(() => SessionStateUtil.SetUpSessionState(context.Object, webPageHttpHandler, new ConcurrentDictionary<Type, SessionStateBehavior?>()),
                "At most one SessionState value can be declared per page.");
        }