public void TestApplyMatchingIfScopes( string environmentType, string nodeName, string expectedFirst, string expectedSecond, string expectedThird, string expectedFourth) { //-- Arrange var framework = new TestFramework(base.Module); framework.NodeConfiguration.EnvironmentType = environmentType; framework.NodeConfiguration.NodeName = nodeName; var one = framework.ConfigSection<ISectionOne>(); var two = framework.ConfigSection<ISectionTwo>(); var xml = @"<CONFIGURATION> <IF environment-type='dev' comment='only for dev environments'> <One first='1-DEV' /> <Two fourth='4-DEV' /> </IF> <IF environment-type='prod' comment='only for prod environments'> <One first='1-PROD' /> <Two fourth='4-PROD' /> </IF> <IF node='BACKEND' comment='only for backend node instances'> <One second='2-BACKEND' /> <Two third='3-BACKEND' /> </IF> <IF node='!BACKEND' comment='for all but backend node instances'> <One second='2-NOT-BACKEND' /> <Two third='3-NOT-BACKEND' /> </IF> </CONFIGURATION>"; var loader = new XmlConfigurationLoader( framework, framework.LoggerAuto<IConfigurationLogger>(), new IConfigurationSection[] { one, two }); //-- Act loader.LoadConfigurationDocument(XDocument.Parse(xml)); //-- Assert Assert.That(one.First, Is.EqualTo(expectedFirst)); Assert.That(one.Second, Is.EqualTo(expectedSecond)); Assert.That(two.Third, Is.EqualTo(expectedThird)); Assert.That(two.Fourth, Is.EqualTo(expectedFourth)); }