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() { MainSource.Remove(SectionInChildSource1); MainSource.Add(SectionInChildSource1, section); }