コード例 #1
0
        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]);
        }
コード例 #2
0
        public void BeginApplicationRequest_LogsThatTheApplicationHasStartedAndSetsLogInitializedTrue()
        {
            // arrange
            var app = new SubtextApplication();
            Assert.IsFalse(app.LogInitialized);
            var log = new Mock<ILog>();
            string logMessage = null;
            log.Setup(l => l.Info(It.IsAny<string>())).Callback<object>(s => logMessage = s.ToString());

            // act
            app.BeginApplicationRequest(log.Object);

            // assert
            Assert.AreEqual("Subtext Application Started", logMessage);
            Assert.IsTrue(app.LogInitialized);
        }