public void Initialize() { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; var content = File.ReadAllText(IOSamples.GetSamplePath("primary.yml")); _config = new ConfigSection(new YamlSectionResolver(content)); }
public void Merge() { var content = File.ReadAllText(IOSamples.GetSamplePath("secondary.json")); var other = new ConfigSection(new JsonSectionResolver(content)); _config.Merge(other, true); Assert.AreEqual(1000, _config.AsInt("int")); Assert.IsFalse(_config.AsBoolean("boolean")); Assert.AreEqual(2, _config.AsInt("sub-section/level")); Assert.AreEqual("json", _config.AsString("sub-section/name")); }
public void Advanced() { var sample = File.ReadAllText(IOSamples.GetSamplePath("advanced.yml")); var config = new ConfigSection(new YamlSectionResolver(sample)); Assert.IsTrue(config.HasSection("level-1")); Assert.IsTrue(config.HasSection("level-1/level-2")); Assert.IsTrue(config.HasKey("level-1/level-2/level-3")); Assert.IsTrue(config.HasSection("sub-1")); Assert.IsTrue(config.HasSection("sub-1/sub-2")); Assert.IsTrue(config.HasKey("sub-1/sub-2/sub-3")); }
public void Default(string fileName, int files, int folders) { int filesCount = 0; var result = WorkflowTester.Run(new ZipEntriesCount { FilesCount = new System.Activities.OutArgument <int>(_ => filesCount) }, GetArgs(IOSamples.GetSamplePath(fileName))); Assert.AreEqual(files, filesCount); Assert.AreEqual(files, result.Get(p => p.FilesCount)); Assert.AreEqual(folders, result.Get(p => p.FoldersCount)); Assert.AreEqual(files + folders, result.Get(p => p.EntriesCount)); }