Exemplo n.º 1
0
        public void Should_Create_Application_Without_DirectoryBrowsing_In_Settings()
        {
            //Setup
            var websiteName     = "Banner";
            var websiteSettings = CakeHelper.GetWebsiteSettings("Banner");

            Cleanup(websiteSettings);

            // Arrange
            var appSettings = CakeHelper.GetApplicationSettings(websiteSettings.Name);

            appSettings.EnableDirectoryBrowsing = false;
            // Make sure the web.config exists
            CakeHelper.CreateWebConfig(appSettings);

            // Act
            var manager = CakeHelper.CreateWebsiteManager();

            manager.Create(websiteSettings);
            manager.AddApplication(appSettings);

            // Assert
            var value = CakeHelper.GetWebConfigurationValue(websiteSettings.Name, appSettings.ApplicationPath, "system.webServer/directoryBrowse", "enabled");

            Assert.False((bool)value);

            //Teardown
            Cleanup(websiteSettings);
        }
Exemplo n.º 2
0
        public void Should_Create_Application_Without_DirectoryBrowsing()
        {
            // Arrange
            var websiteSettings = CakeHelper.GetWebsiteSettings("Smash");

            CakeHelper.DeleteWebsite(websiteSettings.Name);

            // Act
            var appSettings = CakeHelper.GetApplicationSettings(websiteSettings.Name);

            CakeHelper.CreateWebConfig(appSettings);

            var manager = CakeHelper.CreateWebsiteManager();

            manager.Create(websiteSettings);
            manager.AddApplication(appSettings);
            manager.SetWebConfiguration(websiteSettings.Name, appSettings.ApplicationPath, config => config.DisableDirectoryBrowsing());

            // Assert
            var value = CakeHelper.GetWebConfigurationValue(websiteSettings.Name, appSettings.ApplicationPath, "system.webServer/directoryBrowse", "enabled");

            ((bool)value).ShouldBeFalse();

            CakeHelper.DeleteWebsite(websiteSettings.Name);
        }
Exemplo n.º 3
0
        public void Should_Create_Application_With_DirectoryBrowsing_In_Settings()
        {
            // Arrange
            var websiteSettings = CakeHelper.GetWebsiteSettings("Bruce");

            CakeHelper.DeleteWebsite(websiteSettings.Name);

            // Act
            var appSettings = CakeHelper.GetApplicationSettings(websiteSettings.Name);

            appSettings.EnableDirectoryBrowsing = true;
            CakeHelper.CreateWebConfig(appSettings);

            var manager = CakeHelper.CreateWebsiteManager();

            manager.Create(websiteSettings);
            manager.AddApplication(appSettings);

            // Assert
            var value = CakeHelper.GetWebConfigurationValue(websiteSettings.Name, appSettings.ApplicationPath, "system.webServer/directoryBrowse", "enabled");

            ((bool)value).ShouldBeTrue();

            CakeHelper.DeleteWebsite(websiteSettings.Name);
        }
Exemplo n.º 4
0
        public void Should_Create_Website_With_DirectoryBrowsing_In_Settings()
        {
            // Arrange
            var websiteSettings = CakeHelper.GetWebsiteSettings("Iron");

            websiteSettings.EnableDirectoryBrowsing = true;
            // Make sure the web.config exists
            CakeHelper.CreateWebConfig(websiteSettings);

            // Act
            var manager = CakeHelper.CreateWebsiteManager();

            manager.Create(websiteSettings);

            // Assert
            var value = CakeHelper.GetWebConfigurationValue(websiteSettings.Name, null, "system.webServer/directoryBrowse", "enabled");

            Assert.True((bool)value);

            CakeHelper.DeleteWebsite(websiteSettings.Name);
        }
Exemplo n.º 5
0
        public void Should_Create_Website_Without_DirectoryBrowsing()
        {
            // Arrange
            var websiteSettings = CakeHelper.GetWebsiteSettings("Stark");

            // Make sure the web.config exists
            CakeHelper.CreateWebConfig(websiteSettings);

            // Act
            var manager = CakeHelper.CreateWebsiteManager();

            manager.Create(websiteSettings);
            manager.SetWebConfiguration(websiteSettings.Name, null, config => config.DisableDirectoryBrowsing());

            // Assert
            var value = CakeHelper.GetWebConfigurationValue(websiteSettings.Name, null, "system.webServer/directoryBrowse", "enabled");

            Assert.False((bool)value);

            CakeHelper.DeleteWebsite(websiteSettings.Name);
        }
Exemplo n.º 6
0
        public void Should_Create_Application_With_DirectoryBrowsing()
        {
            // Arrange
            var websiteSettings = CakeHelper.GetWebsiteSettings("Hulk");
            var appSettings     = CakeHelper.GetApplicationSettings(websiteSettings.Name);

            // Make sure the web.config exists
            CakeHelper.CreateWebConfig(appSettings);

            // Act
            var manager = CakeHelper.CreateWebsiteManager();

            manager.Create(websiteSettings);
            manager.AddApplication(appSettings);
            manager.SetWebConfiguration(websiteSettings.Name, appSettings.ApplicationPath, config => config.EnableDirectoryBrowsing());

            // Assert
            var value = CakeHelper.GetWebConfigurationValue(websiteSettings.Name, appSettings.ApplicationPath, "system.webServer/directoryBrowse", "enabled");

            Assert.True((bool)value);

            CakeHelper.DeleteWebsite(websiteSettings.Name);
        }