Esempio n. 1
0
        public void StartApplication_SetsLogInitializedToFalse()
        {
            // arrange
            var app    = new SubtextApplication(null);
            var server = new Mock <HttpServerUtilityBase>();

            // act
            app.StartApplication(new SubtextRouteMapper(new RouteCollection(), new Mock <IServiceLocator>().Object),
                                 server.Object);

            // assert
            Assert.IsFalse(app.LogInitialized);
        }
Esempio n. 2
0
        public void StartApplication_AddsHostAdminDirectoryToInvalidPaths_IfHostAdminDirectoryExistsInWrongPlace()
        {
            // arrange
            var app    = new SubtextApplication(null);
            var server = new Mock <HttpServerUtilityBase>();

            server.Setup(s => s.MapPath("~/HostAdmin")).Returns(Directory.CreateDirectory("HostAdmin").FullName);

            // act
            app.StartApplication(new SubtextRouteMapper(new RouteCollection(), new Mock <IServiceLocator>().Object),
                                 server.Object);

            // assert
            Assert.AreEqual("~/HostAdmin", app.DeprecatedPhysicalPaths[0]);
        }
Esempio n. 3
0
        public void BeginApplicationRequest_WithOldAdminDirectory_ThrowsDeprecatedFileExistsException()
        {
            // arrange
            var app    = new SubtextApplication(null);
            var server = new Mock <HttpServerUtilityBase>();

            server.Setup(s => s.MapPath("~/Admin")).Returns(Directory.CreateDirectory("Admin").FullName);
            app.StartApplication(new SubtextRouteMapper(new RouteCollection(), new Mock <IServiceLocator>().Object),
                                 server.Object);

            // act, assert
            var exception = UnitTestHelper.AssertThrows <DeprecatedPhysicalPathsException>(() =>
                                                                                           app.BeginApplicationRequest(
                                                                                               new Mock <ILog>().Object));

            Assert.AreEqual("~/Admin", exception.InvalidPhysicalPaths[0]);
        }
Esempio n. 4
0
        public void StartApplication_AddsLoginFileToInvalidPaths_IfLoginFileExistsInWrongPlace()
        {
            // arrange
            var app    = new SubtextApplication(null);
            var server = new Mock <HttpServerUtilityBase>();

            using (StreamWriter writer = File.CreateText("login.aspx"))
            {
                writer.Write("test");
            }
            server.Setup(s => s.MapPath("~/login.aspx")).Returns(Path.GetFullPath("login.aspx"));

            // act
            app.StartApplication(new SubtextRouteMapper(new RouteCollection(), new Mock <IServiceLocator>().Object),
                                 server.Object);

            // assert
            Assert.AreEqual("~/login.aspx", app.DeprecatedPhysicalPaths[0]);
        }