protected override void Arrange() { base.Arrange(); source = new DesignDictionaryConfigurationSource(); ConfigurationSourceBuilder sourceBuilder = new ConfigurationSourceBuilder(); sourceBuilder.ConfigureData().ForDatabaseNamed("connection-string1").ThatIs.ASqlDatabase().WithConnectionString("connectionStringValueXYZ").AsDefault() .ForDatabaseNamed("connection-string2").ThatIs.AnOracleDatabase().WithConnectionString("OracleConnectionString").WithPackageNamed("x").AndPrefix("XYZ") .ForDatabaseNamed("connection-string3").ThatIs.AnOracleDatabase().WithConnectionString("OracleConnectionString").WithPackageNamed("x").AndPrefix("XYZ"); sourceBuilder.UpdateConfigurationWithReplace(source); DatabaseSettings dbSettings = (DatabaseSettings)source.GetSection(DatabaseSettings.SectionName); dbSettings.ProviderMappings.Add(new DbProviderMapping("dbpro1", "dbtype")); dbSettings.ProviderMappings.Add(new DbProviderMapping("dbpro2", "dbtype")); source.Remove(DatabaseSettings.SectionName); source.Add(DatabaseSettings.SectionName, dbSettings); var configurationSection = source.GetSection(DataAccessDesignTime.ConnectionStringSettingsSectionName); var configurationSourceModel = Container.Resolve<ConfigurationSourceModel>(); configurationSourceModel.Load(source); databaseSectionViewModel = configurationSourceModel.Sections .Where(x => x.SectionName == DataAccessDesignTime.ConnectionStringSettingsSectionName) .Single(); }
protected override void Act() { DesignDictionaryConfigurationSource saveSource = new DesignDictionaryConfigurationSource(); base.CachingViewModel.Save(saveSource); savedSettings = (CacheManagerSettings) saveSource.GetSection(CacheManagerSettings.SectionName); }
public void then_section_is_saved_with_require_permission() { DesignDictionaryConfigurationSource saveSource = new DesignDictionaryConfigurationSource(); CachingViewModel.Save(saveSource); CacheManagerSettings savedSettings = (CacheManagerSettings)saveSource.GetSection(CacheManagerSettings.SectionName); Assert.IsFalse(savedSettings.SectionInformation.RequirePermission); }
protected override void Act() { var collection = (ElementCollectionViewModel)base.AppSettingsView.GetDescendentsOfType<KeyValueConfigurationCollection>().FirstOrDefault(); var newElement = collection.AddNewCollectionElement(typeof(KeyValueConfigurationElement)); newElement.Property("Key").Value = "new-setting"; newElement.Property("Value").Value = "value"; var newElement2 = collection.AddNewCollectionElement(typeof(KeyValueConfigurationElement)); newElement2.Property("Key").Value = "new-setting-2"; newElement2.Property("Value").Value = "value"; DesignDictionaryConfigurationSource saveSource = new DesignDictionaryConfigurationSource(); AppSettingsView.Save(saveSource); savedSection = (AppSettingsSection)saveSource.GetSection("appSettings"); }
protected override void Act() { var section = new ConnectionStringsSection(); source = new DesignDictionaryConfigurationSource(); source.Add("connectionStrings", section); var configurationSection = source.GetSection(DataAccessDesignTime.ConnectionStringSettingsSectionName); var configurationSourceModel = Container.Resolve<ConfigurationSourceModel>(); configurationSourceModel.Load(source); var databaseSectionViewModel = configurationSourceModel.Sections .Where(x => x.SectionName == DataAccessDesignTime.ConnectionStringSettingsSectionName) .Single(); databaseSectionViewModel.Save(source); }