public void BeginApplicationRequest_WithOldAdminDirectory_ThrowsDeprecatedFileExistsException()
        {
            // arrange
            var app = new SubtextApplication();
            var server = new Mock<HttpServerUtilityBase>();
            server.Setup(s => s.MapPath("~/Admin")).Returns(Directory.CreateDirectory("Admin").FullName);
            app.StartApplication(new SubtextRouteMapper(new RouteCollection(), new Mock<IDependencyResolver>().Object),
                                 server.Object);

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

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

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

            // assert
            Assert.IsFalse(app.LogInitialized);
        }
        public void StartApplication_AddsLoginFileToInvalidPaths_IfLoginFileExistsInWrongPlace()
        {
            // arrange
            var app = new SubtextApplication();
            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<IDependencyResolver>().Object),
                                 server.Object);

            // assert
            Assert.AreEqual("~/login.aspx", app.DeprecatedPhysicalPaths[0]);
        }
        public void StartApplication_AddsHostAdminDirectoryToInvalidPaths_IfHostAdminDirectoryExistsInWrongPlace()
        {
            // arrange
            var app = new SubtextApplication();
            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<IDependencyResolver>().Object),
                                 server.Object);

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