Пример #1
0
        HandleSqlException_WithSqlServerCouldNotFindStoredProcedureAndProcNameIsBlog_GetConfig_TransfersToBadConnectionStringPageAndReturnsTrue
            ()
        {
            // arrange

            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.HandleSqlExceptionNumber(
                (int)SqlErrorMessage.CouldNotFindStoredProcedure, "'blog_GetConfig'", server.Object);

            // assert
            Assert.AreEqual("~/aspx/SystemMessages/CheckYourConnectionString.aspx", transferLocation);
            Assert.IsTrue(handled);
        }
Пример #2
0
        HandleSqlException_WithSqlServerDoesNotExistOrAccessDeniedError_TransfersToBadConnectionStringPageAndReturnsTrue
            ()
        {
            // arrange
            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.HandleSqlExceptionNumber((int)SqlErrorMessage.SqlServerDoesNotExistOrAccessDenied, "",
                                                            server.Object);

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