Esempio n. 1
0
        public void HandleBadConnectionStringException_IgnoresOtherExceptions()
        {
            // arrange
            var exception = new Exception();
            var server    = new Mock <HttpServerUtilityBase>();

            server.Setup(s => s.Transfer(It.IsAny <string>())).Throws(new Exception("Should not have transfered"));

            // act
            bool handled = SubtextApplication.HandleBadConnectionStringException(exception, server.Object);

            // assert
            Assert.IsFalse(handled);
        }
Esempio n. 2
0
        HandleBadConnectionStringException_WithInvalidOperationExceptionContainingOtherMessages_IgnoresException()
        {
            // arrange
            var exception = new InvalidOperationException("Something or other");
            var server    = new Mock <HttpServerUtilityBase>();

            server.Setup(s => s.Transfer(It.IsAny <string>())).Throws(new Exception("Should not have transfered"));

            // act
            bool handled = SubtextApplication.HandleBadConnectionStringException(exception, server.Object);

            // assert
            Assert.IsFalse(handled);
        }
Esempio n. 3
0
        HandleBadConnectionStringException_WithArgumentExceptionContainingInvalidValueForKey_TransfersToBadConnectionStringPage
            ()
        {
            // arrange
            var    exception        = new ArgumentException("Invalid value for key");
            var    server           = new Mock <HttpServerUtilityBase>();
            string transferLocation = null;

            server.Setup(s => s.Transfer(It.IsAny <string>())).Callback <string>(s => transferLocation = s);

            // act
            bool handled = SubtextApplication.HandleBadConnectionStringException(exception, server.Object);

            // assert
            Assert.IsTrue(handled);
            Assert.AreEqual("~/aspx/SystemMessages/CheckYourConnectionString.aspx", transferLocation);
        }
Esempio n. 4
0
        HandleBadConnectionStringException_WithInvalidOperationExceptionMentioningConnectionString_TransfersToBadConnectionStringPage
            ()
        {
            // arrange
            var    exception        = new InvalidOperationException("No ConnectionString Found");
            var    server           = new Mock <HttpServerUtilityBase>();
            string transferLocation = null;

            server.Setup(s => s.Transfer(It.IsAny <string>())).Callback <string>(s => transferLocation = s);

            // act
            bool handled = SubtextApplication.HandleBadConnectionStringException(exception, server.Object);

            // assert
            Assert.IsTrue(handled);
            Assert.AreEqual("~/aspx/SystemMessages/CheckYourConnectionString.aspx", transferLocation);
        }