Exemplo n.º 1
0
        protected override void Act()
        {
            //setup
            var section = MainSource.GetSection(SectionInChildSource1);

            MainSource.DoSourceChanged(new[] { ConfigurationSourceSection.SectionName });
        }
Exemplo n.º 2
0
        protected override void Act()
        {
            //setup
            var section = MainSource.GetSection(SectionInChildSource1);

            CompositionHandler.Dispose();
        }
Exemplo n.º 3
0
        protected override void Act()
        {
            DummySection dummySectionBeforeChange = (DummySection)MainSource.GetSection(SectionInChildSource1);

            var sourcesSection = CreateConfigurationSourceSection();
            var redirect       = sourcesSection.RedirectedSections.Where(x => x.Name == SectionInChildSource1).First();

            redirect.SourceName = "Source2";

            MainSource.Remove(ConfigurationSourceSection.SectionName);
            MainSource.Add(ConfigurationSourceSection.SectionName, sourcesSection);
            MainSource.DoSourceChanged(new [] { ConfigurationSourceSection.SectionName });


            try
            {
                MainSource.GetSection(SectionInChildSource1);
                Assert.Fail(); // Getting here indicates the section is still in original source
            }
            catch (ConfigurationSourceErrorsException)
            {
                // not caught intentionally
            }

            ChildSource2 = (TestConfigurationSource)CompositionHandler["Source2"];
            ChildSource2.Add(SectionInChildSource1, new DummySection {
                Name = "SectionInSource2"
            });
        }
Exemplo n.º 4
0
        protected override void Act()
        {
            DummySection dummySectionBeforeChange = (DummySection)MainSource.GetSection(SectionInChildSource1);

            ChildSource1.Remove(SectionInChildSource1);
            ChildSource1.Add(SectionInChildSource1, new DummySection {
                Name = "new name", Value = 16
            });
            ChildSource1.DoSourceChanged(new[] { SectionInChildSource1 });
        }
Exemplo n.º 5
0
        public void then_does_not_throw_on_unregistered_missing_sections()
        {
            ConfigurationSection section = MainSource.GetSection("UnregisteredSection");

            Assert.IsNull(section);
        }
Exemplo n.º 6
0
 public void then_throws_on_registered_but_missing_sections()
 {
     ConfigurationSection section = MainSource.GetSection("SectionInSource2");
 }
Exemplo n.º 7
0
 public void Then_SectionCanBeAccessedFromMainSource()
 {
     DummySection sectionFromMainSource = (DummySection)MainSource.GetSection(SectionInChildSource1);
 }
Exemplo n.º 8
0
        public void Then_CompositeSourceReturnsUpdatedSectionFromOtherSource()
        {
            DummySection dummySectionAfterChange = (DummySection)MainSource.GetSection(SectionInChildSource1);

            Assert.AreEqual("SectionInSource2", dummySectionAfterChange.Name);
        }
Exemplo n.º 9
0
        public void Then_CompositeSourceReturnsUpdatedConfigurationSection()
        {
            DummySection dummySectionAfterChange = (DummySection)MainSource.GetSection(SectionInChildSource1);

            Assert.AreEqual("new name", dummySectionAfterChange.Name);
        }