protected override void Act() { //setup var section = MainSource.GetSection(SectionInChildSource1); MainSource.DoSourceChanged(new[] { ConfigurationSourceSection.SectionName }); }
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" }); }
public void Then_MainSourceKeepsRaisingEventsAfterReset() { TestConfigurationSource.ConfigurationSourceContents["section1"] = new DummySection(); //force reset MainSource.DoSourceChanged(new [] { ConfigurationSourceSection.SectionName }); Assert.AreEqual(1, CompositionHandler.RefreshCallCount); this.MainSourceEventListener.ConfigurationSourceChangedRaiseCount = 0; //reset counter var childSource = (TestConfigurationSource)CompositionHandler["Source1"]; childSource.DoSourceChanged(new[] { "section1" }); Assert.IsTrue(MainSourceEventListener.ConfigurationSourceChangedRaiseCount > 0); }