public void updatelanguage_should_save_language_code_to_globalization_section() { // Arrange string configFilePath = GetConfigPath("test.config"); // Act FullTrustConfigReaderWriter configManager = new FullTrustConfigReaderWriter(configFilePath); configManager.UpdateLanguage("fr-FR"); // Assert System.Configuration.Configuration config = configManager.GetConfiguration(); GlobalizationSection globalizationSection = config.GetSection("system.web/globalization") as GlobalizationSection; Assert.That(globalizationSection, Is.Not.Null); Assert.That(globalizationSection.UICulture, Is.EqualTo("fr-FR")); }
public void getconfiguration_should_return_configuration_for_exe_file() { // Arrange string configFilePath = GetConfigPath("test.config"); // Act FullTrustConfigReaderWriter configManager = new FullTrustConfigReaderWriter(configFilePath); System.Configuration.Configuration config = configManager.GetConfiguration(); // Assert Assert.That(config, Is.Not.Null); Assert.That(config.FilePath, Is.EqualTo(configFilePath)); }
public void writeconfigforformsauth_should_add_formsauth_section_and_anonymousidentification() { // Arrange string configFilePath = GetConfigPath("test.config"); // Act FullTrustConfigReaderWriter configManager = new FullTrustConfigReaderWriter(configFilePath); configManager.WriteConfigForFormsAuth(); // Assert System.Configuration.Configuration config = configManager.GetConfiguration(); AuthenticationSection authSection = config.GetSection("system.web/authentication") as AuthenticationSection; Assert.That(authSection, Is.Not.Null); Assert.That(authSection.Mode, Is.EqualTo(AuthenticationMode.Forms)); Assert.That(authSection.Forms.LoginUrl, Is.EqualTo("~/User/Login")); AnonymousIdentificationSection anonSection = config.GetSection("system.web/anonymousIdentification") as AnonymousIdentificationSection; Assert.That(anonSection.Enabled, Is.True); }
public void writeconfigforwindowsauth_should_set_windowsauthmode_and_disable_anonymousidentification() { // Arrange string configFilePath = GetConfigPath("test.config"); // Act FullTrustConfigReaderWriter configManager = new FullTrustConfigReaderWriter(configFilePath); configManager.WriteConfigForWindowsAuth(); // Assert System.Configuration.Configuration config = configManager.GetConfiguration(); AuthenticationSection authSection = config.GetSection("system.web/authentication") as AuthenticationSection; Assert.That(authSection, Is.Not.Null); Assert.That(authSection.Mode, Is.EqualTo(AuthenticationMode.Windows)); Assert.That(authSection.Forms.LoginUrl, Is.EqualTo("login.aspx")); // login.aspx is the default for windows auth AnonymousIdentificationSection anonSection = config.GetSection("system.web/anonymousIdentification") as AnonymousIdentificationSection; Assert.That(anonSection.Enabled, Is.False); }
public void GetConfiguration_Should_Return_Configuration_For_Exe_File() { // Arrange string configFilePath = GetConfigPath("test.config"); // Act FullTrustConfigReaderWriter configManager = new FullTrustConfigReaderWriter(configFilePath); Configuration config = configManager.GetConfiguration(); // Assert Assert.That(config, Is.Not.Null); Assert.That(config.FilePath, Is.EqualTo(configFilePath)); }