protected override void Arrange()
        {
            base.Arrange();

            var locator = new Mock <ConfigurationSectionLocator>();

            locator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "testSection" });
            Container.RegisterInstance(locator.Object);

            var overridableSection = new OverridableSection();

            var source = new DesignDictionaryConfigurationSource();

            source.Add("testSection", overridableSection);

            var applicationModel = Container.Resolve <ApplicationViewModel>();
            var sourceModel      = applicationModel.CurrentConfigurationSource;

            sourceModel.Load(source);

            BaseSection = sourceModel.Sections.Where(s => s.SectionName == "testSection").Single();
            applicationModel.NewEnvironment();

            OverridesProperty       = BaseSection.Properties.Where(x => x.PropertyName.StartsWith("Overrides")).First();
            OverridesProperty.Value = true;
        }
コード例 #2
0
        protected override void Arrange()
        {
            base.Arrange();

            File.Delete(MainConfigurationFile);
            File.Delete(SatelliteConfigurationSourcePath);

            var builder = new ConfigurationSourceBuilder();

            var configurationSettings = new ConfigurationSourceSection();

            configurationSettings.SelectedSource = "System Configuration";
            configurationSettings.Sources.Add(new FileConfigurationSourceElement(SatelliteSourceName, SatelliteConfigurationSourcePath));
            configurationSettings.Sources.Add(new SystemConfigurationSourceElement("System Configuration"));
            builder.AddSection(ConfigurationSourceSection.SectionName, configurationSettings);

            builder.ConfigureCaching()
            .ForCacheManagerNamed("TestCacheManager")
            .StoreInMemory();

            var source = new DesignDictionaryConfigurationSource();

            builder.UpdateConfigurationWithReplace(source);

            ConfigurationSource = Container.Resolve <ConfigurationSourceModel>();
            ConfigurationSource.Load(source);
        }
        protected override void Arrange()
        {
            base.Arrange();

            File.Delete(MainConfigurationFile);
            File.Delete(SatelliteConfigurationSourcePath);

            var builder = new ConfigurationSourceBuilder();

            var configurationSettings = new ConfigurationSourceSection();

            configurationSettings.SelectedSource = "System Configuration";
            configurationSettings.Sources.Add(new FileConfigurationSourceElement(SatelliteSourceName, SatelliteConfigurationSourcePath));
            configurationSettings.Sources.Add(new SystemConfigurationSourceElement("System Configuration"));
            builder.AddSection(ConfigurationSourceSection.SectionName, configurationSettings);

            builder.ConfigureExceptionHandling()
            .GivenPolicyWithName("policy")
            .ForExceptionType <Exception>();

            var source = new DesignDictionaryConfigurationSource();

            builder.UpdateConfigurationWithReplace(source);

            ConfigurationSource = Container.Resolve <ConfigurationSourceModel>();
            ConfigurationSource.Load(source);
        }
コード例 #4
0
        protected override void Arrange()
        {
            base.Arrange();

            ConfigurationSourceBuilder sourceBuilder = new ConfigurationSourceBuilder();

            sourceBuilder
            .ConfigureLogging()
            .WithOptions
            .FilterCustom <MockLogFilter>("filter")
            .LogToCategoryNamed("General")
            .SendTo
            .SystemDiagnosticsListener("listener")
            .SendTo
            .Msmq("msmqlistener")
            .LogToCategoryNamed("Other")
            .SendTo
            .EventLog("eventlog");;

            DesignDictionaryConfigurationSource source = new DesignDictionaryConfigurationSource();

            sourceBuilder.UpdateConfigurationWithReplace(source);

            var sourceModel = Container.Resolve <ConfigurationSourceModel>();

            sourceModel.Load(source);

            LoggingSectionViewModel = sourceModel.Sections.Where(x => x.SectionName == LoggingSettings.SectionName).First();
        }
コード例 #5
0
        protected override void Act()
        {
            DesignDictionaryConfigurationSource saveSource = new DesignDictionaryConfigurationSource();

            base.CachingViewModel.Save(saveSource);
            savedSettings = (CacheManagerSettings)saveSource.GetSection(CacheManagerSettings.SectionName);
        }
コード例 #6
0
        protected override void Arrange()
        {
            base.Arrange();
            var locator = new Mock <ConfigurationSectionLocator>();

            locator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "testSection" });
            Container.RegisterInstance(locator.Object);

            var section = new ElementForValidation();

            var source = new DesignDictionaryConfigurationSource();

            source.Add("testSection", section);

            var sourceModel = Container.Resolve <ConfigurationSourceModel>();

            sourceModel.Load(source);


            Assert.IsTrue(sourceModel.Sections
                          .SelectMany(s => s.DescendentElements()
                                      .SelectMany(e => e.Properties)
                                      .SelectMany(p => p.ValidationResults)
                                      .Union(s.Properties.SelectMany(p => p.ValidationResults))
                                      ).Where(e => e.IsError).Any());
        }
コード例 #7
0
        protected override void Arrange()
        {
            base.Arrange();

            ConfigurationSourceBuilder sourceBuilder = new ConfigurationSourceBuilder();

            sourceBuilder.ConfigureLogging().LogToCategoryNamed("General").SendTo.EventLog("Listener").SendTo.Msmq("msmqListener");

            DesignDictionaryConfigurationSource source = new DesignDictionaryConfigurationSource();

            sourceBuilder.UpdateConfigurationWithReplace(source);

            var applicationModel = Container.Resolve <ApplicationViewModel>();
            var sourceModel      = applicationModel.CurrentConfigurationSource;

            sourceModel.Load(source);
            foreach (var element in sourceModel.Sections.SelectMany(x => x.DescendentElements()))
            {
                element.InheritedFromParentConfiguration = false;
            }

            applicationModel.NewEnvironment();
            Environment = applicationModel.Environments.First();

            LoggingSectionViewModel = sourceModel.Sections.Where(x => x.SectionName == LoggingSettings.SectionName).First();
        }
        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();
        }
コード例 #9
0
        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 Arrange()
        {
            base.Arrange();

            configurationSource = new DesignDictionaryConfigurationSource();
            configurationSource.Add(UnityConfigurationSection.SectionName, new UnityConfigurationSection());
            Container.RegisterInstance(new Mock <IAssemblyDiscoveryService>().Object);

            configurationSourceModel = Container.Resolve <ConfigurationSourceModel>();
        }
コード例 #11
0
        protected override void Act()
        {
            var source = new DesignDictionaryConfigurationSource();

            source.Add("MockSection", sectionWithInitializableModels);

            var sourceModel = Container.Resolve <ConfigurationSourceModel>();

            sourceModel.Load(source);
            section = sourceModel.Sections.OfType <MockInitializeSectionViewModel>().Single();
        }
        protected override void Arrange()
        {
            base.Arrange();

            var source = new DesignDictionaryConfigurationSource();

            new TestConfigurationBuilder().AddLoggingSettings().Build(source);

            ConfigurationSourceModel.Load(source);

            LoggingSection =
                ConfigurationSourceModel.Sections.Where(x => x.ConfigurationType == typeof(LoggingSettings)).Single();
        }
コード例 #13
0
        protected override void Arrange()
        {
            base.Arrange();

            var configurationSource = new DesignDictionaryConfigurationSource();

            configurationSource.Add(UnityConfigurationSection.SectionName, new UnityConfigurationSection());

            var configurationSourceModel = Container.Resolve <ConfigurationSourceModel>();

            configurationSourceModel.Load(configurationSource);

            UnitySectionViewModel = configurationSourceModel.Sections.OfType <UnitySectionViewModel>().First();
        }
コード例 #14
0
        protected override void Arrange()
        {
            base.Arrange();

            var sectionLocator = new Mock <ConfigurationSectionLocator>();

            sectionLocator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "section" });
            Container.RegisterInstance <ConfigurationSectionLocator>(sectionLocator.Object);

            SectionWithExtendedViewModel section = new SectionWithExtendedViewModel();

            source = new DesignDictionaryConfigurationSource();
            source.Add("section", section);
        }
コード例 #15
0
        protected override void Arrange()
        {
            base.Arrange();

            var source = new DesignDictionaryConfigurationSource();

            new TestConfigurationBuilder().AddCachingSettings().Build(source);

            var sourceModel = this.Container.Resolve <ConfigurationSourceModel>();

            sourceModel.Load(source);

            CacheSectionViewModel =
                sourceModel.Sections.Where(x => x.ConfigurationType == typeof(CacheManagerSettings)).Single();

            CacheManager = CacheSectionViewModel.GetDescendentsOfType <CacheManagerData>().FirstOrDefault();
        }
コード例 #16
0
        protected override void Arrange()
        {
            base.Arrange();

            var builder = new TestConfigurationBuilder();

            configSource = new DesignDictionaryConfigurationSource();
            builder.AddExceptionSettings()
            .Build(configSource);

            var mockLocator = new Mock <ConfigurationSectionLocator>();

            mockLocator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { ExceptionHandlingSettings.SectionName });

            Container.RegisterInstance <ConfigurationSectionLocator>(mockLocator.Object);

            configurationSourceViewModel = Container.Resolve <ConfigurationSourceModel>();
        }
        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);
        }
コード例 #19
0
        protected override void Arrange()
        {
            base.Arrange();

            var locator = new Mock <ConfigurationSectionLocator>();

            locator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "testSection" });
            Container.RegisterInstance(locator.Object);

            var section = new ElementForValidation();

            var source = new DesignDictionaryConfigurationSource();

            source.Add("testSection", section);

            SourceModel = Container.Resolve <ConfigurationSourceModel>();
            SourceModel.Load(source);

            Section = SourceModel.Sections.Where(s => s.SectionName == "testSection").Single();
        }
コード例 #20
0
        protected override void Arrange()
        {
            base.Arrange();

            var source = new DesignDictionaryConfigurationSource();

            new TestConfigurationBuilder().AddExceptionSettings().Build(source);

            var sourceModel = Container.Resolve <ConfigurationSourceModel>();

            sourceModel.Load(source);
            exceptionSection =
                sourceModel.Sections.Where(x => x.ConfigurationType == typeof(ExceptionHandlingSettings)).Single();

            policy = exceptionSection.DescendentElements()
                     .Where(x => x.ConfigurationType == typeof(ExceptionPolicyData))
                     .First();

            this.Container.RegisterInstance(new Mock <IAssemblyDiscoveryService>().Object);
        }
コード例 #21
0
        protected override void Arrange()
        {
            base.Arrange();
            testreferencingSection = new TestReferencingSection();

            var locator = new Mock <ConfigurationSectionLocator>();

            locator.Setup(x => x.ConfigurationSectionNames).Returns(new string[] { "testReferencingSection" });
            Container.RegisterInstance(locator.Object);

            DesignDictionaryConfigurationSource source = new DesignDictionaryConfigurationSource();

            source.Add("testReferencingSection", testreferencingSection);

            configSource = Container.Resolve <ConfigurationSourceModel>();
            configSource.Load(source);

            section = configSource.Sections.Where(x => x.SectionName == "testReferencingSection").Single();
            section.Property("ReferencingProperty").Value = "ReferringTo";
        }
コード例 #22
0
        protected override void Arrange()
        {
            base.Arrange();

            var builder = new TestConfigurationBuilder();

            configSource = new DictionaryConfigurationSource();
            builder.AddCachingSettings()
            .Build(configSource);

            var configurationSourceModel = Container.Resolve <ConfigurationSourceModel>();
            var source = new DesignDictionaryConfigurationSource();

            source.Add(BlockSectionNames.Caching, CachingConfiguration);
            configurationSourceModel.Load(source);

            CachingSettingsViewModel =
                configurationSourceModel.Sections
                .Where(x => x.ConfigurationType == typeof(CacheManagerSettings)).Single();
        }
コード例 #23
0
        protected override void Arrange()
        {
            base.Arrange();

            var locator = new Mock <ConfigurationSectionLocator>();

            locator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "testSection" });
            Container.RegisterInstance(locator.Object);

            var section = new MockSectionWithSingleChild();

            section.Children.Add(new TestHandlerDataWithChildren()
            {
                Name = "ParentOne"
            });
            TestHandlerDataWithChildren child = new TestHandlerDataWithChildren()
            {
                Name = "Parent Two"
            };

            child.Children.Add(new TestHandlerData()
            {
                Name = "One"
            });
            child.Children.Add(new TestHandlerData()
            {
                Name = "Two"
            });
            section.Children.Add(child);

            var source = new DesignDictionaryConfigurationSource();

            source.Add("testSection", section);

            SourceModel = Container.Resolve <ConfigurationSourceModel>();
            SourceModel.Load(source);
        }