protected override void Act() { //setup var section = MainSource.GetSection(SectionInChildSource1); MainSource.DoSourceChanged(new[] { ConfigurationSourceSection.SectionName }); }
protected override void Act() { //setup var section = MainSource.GetSection(SectionInChildSource1); CompositionHandler.Dispose(); }
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" }); }
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 }); }
public void then_does_not_throw_on_unregistered_missing_sections() { ConfigurationSection section = MainSource.GetSection("UnregisteredSection"); Assert.IsNull(section); }
public void then_throws_on_registered_but_missing_sections() { ConfigurationSection section = MainSource.GetSection("SectionInSource2"); }
public void Then_SectionCanBeAccessedFromMainSource() { DummySection sectionFromMainSource = (DummySection)MainSource.GetSection(SectionInChildSource1); }
public void Then_CompositeSourceReturnsUpdatedSectionFromOtherSource() { DummySection dummySectionAfterChange = (DummySection)MainSource.GetSection(SectionInChildSource1); Assert.AreEqual("SectionInSource2", dummySectionAfterChange.Name); }
public void Then_CompositeSourceReturnsUpdatedConfigurationSection() { DummySection dummySectionAfterChange = (DummySection)MainSource.GetSection(SectionInChildSource1); Assert.AreEqual("new name", dummySectionAfterChange.Name); }