Esempio n. 1
0
        public void BeginApplicationRequest_LogsThatTheApplicationHasStartedAndSetsLogInitializedTrue()
        {
            // arrange
            var app = new SubtextApplication(null);

            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);
        }
Esempio n. 2
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]);
        }