public void ProcessAppIncludes() { var cfg = @"app { process-includes=--include --include { name=SectionA provider{ type='Azos.Tests.Nub.Configuration.IncludeTests2+CustomProvider, Azos.Tests.Nub'} } --include { name=SectionB provider{ type='Azos.Tests.Nub.Configuration.IncludeTests2+CustomProvider, Azos.Tests.Nub'} } }".AsLaconicConfig(handling: ConvertErrorHandling.Throw); //When injecting config from the .ctor the process includes is not applied automatically CommonApplicationLogic.ProcessAllExistingConfigurationIncludes(cfg); cfg.ToLaconicString().See(); Aver.IsTrue(cfg["SectionA"].Exists); Aver.IsTrue(cfg["SectionB"].Exists); Aver.AreEqual(1, cfg["SectionA"].ValOf("a").AsInt()); Aver.AreEqual(-2, cfg["SectionA"].ValOf("b").AsInt()); Aver.AreEqual(1, cfg["SectionB"].ValOf("a").AsInt()); Aver.AreEqual(-2, cfg["SectionB"].ValOf("b").AsInt()); }
public void ProcessAppIncludeCopies() { var cfg = @"app { process-includes=--include sectionA { a=1 b=2 } --include { name=SectionZ copy=/sectionA } --include { copy=/sectionA } --include { copy=/dontexist-notrequired-soitworks } }".AsLaconicConfig(handling: ConvertErrorHandling.Throw); //When injecting config from the .ctor the process includes is not applied automatically CommonApplicationLogic.ProcessAllExistingConfigurationIncludes(cfg); cfg.ToLaconicString().See(); Aver.AreEqual(2, cfg.ChildCount);//sectionA nad SectionZ the next anonymous include goes under very root //copied over sectionA to root by the last un-named include Aver.AreEqual(3, cfg.AttrCount); Aver.AreEqual(1, cfg.ValOf("a").AsInt()); Aver.AreEqual(2, cfg.ValOf("b").AsInt()); Aver.AreEqual(2, cfg["SectionA"].AttrCount); Aver.AreEqual(1, cfg["SectionA"].ValOf("a").AsInt()); Aver.AreEqual(2, cfg["SectionA"].ValOf("b").AsInt()); Aver.AreEqual(2, cfg["SectionZ"].AttrCount); Aver.AreEqual(1, cfg["SectionZ"].ValOf("a").AsInt()); Aver.AreEqual(2, cfg["SectionZ"].ValOf("b").AsInt()); }
public void ProcessAppIncludeCopies_Required() { var cfg = @"app { process-includes=include include { name=a copy=!/not-there } }".AsLaconicConfig(handling: ConvertErrorHandling.Throw); CommonApplicationLogic.ProcessAllExistingConfigurationIncludes(cfg); }
public void ProcessAppIncludeCopies_Optional() { var cfg = @"app { process-includes=include include { name=a copy=/not-there } }".AsLaconicConfig(handling: ConvertErrorHandling.Throw); CommonApplicationLogic.ProcessAllExistingConfigurationIncludes(cfg); cfg.ToLaconicString().See(); Aver.AreEqual(0, cfg.ChildCount); }
public void ProcessAppIncludeCopies_ReferenceRequired() { var cfg = @"app { process-includes=--include sectionA { a=1 b=2 } --include { name=SectionZ copy=!/sectionIsNotThere } }".AsLaconicConfig(handling: ConvertErrorHandling.Throw); //When injecting config from the .ctor the process includes is not applied automatically CommonApplicationLogic.ProcessAllExistingConfigurationIncludes(cfg); }