コード例 #1
0
        protected override void Act()
        {
            //setup
            var section = MainSource.GetSection(SectionInChildSource1);

            MainSource.DoSourceChanged(new[] { ConfigurationSourceSection.SectionName });
        }
コード例 #2
0
        protected override void Act()
        {
            //setup
            var section = MainSource.GetSection(SectionInChildSource1);

            CompositionHandler.Dispose();
        }
コード例 #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"
            });
        }
コード例 #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 });
        }
コード例 #5
0
        public void then_does_not_throw_on_unregistered_missing_sections()
        {
            ConfigurationSection section = MainSource.GetSection("UnregisteredSection");

            Assert.IsNull(section);
        }
コード例 #6
0
 public void then_throws_on_registered_but_missing_sections()
 {
     ConfigurationSection section = MainSource.GetSection("SectionInSource2");
 }
コード例 #7
0
 public void Then_SectionCanBeAccessedFromMainSource()
 {
     DummySection sectionFromMainSource = (DummySection)MainSource.GetSection(SectionInChildSource1);
 }
コード例 #8
0
        public void Then_CompositeSourceReturnsUpdatedSectionFromOtherSource()
        {
            DummySection dummySectionAfterChange = (DummySection)MainSource.GetSection(SectionInChildSource1);

            Assert.AreEqual("SectionInSource2", dummySectionAfterChange.Name);
        }
コード例 #9
0
        public void Then_CompositeSourceReturnsUpdatedConfigurationSection()
        {
            DummySection dummySectionAfterChange = (DummySection)MainSource.GetSection(SectionInChildSource1);

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