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();
        }
Ejemplo n.º 2
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());
        }
        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;
        }
        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>();
        }
        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 configurationSource = new DesignDictionaryConfigurationSource();

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

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

            configurationSourceModel.Load(configurationSource);

            UnitySectionViewModel = configurationSourceModel.Sections.OfType <UnitySectionViewModel>().First();
        }
Ejemplo n.º 7
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);
        }
        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);
        }
Ejemplo n.º 9
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();
        }
Ejemplo n.º 10
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";
        }
        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();
        }
        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);
        }