public void AncestryFrom_EC_DE_de_params() { var subdir = "de"; var fileName = "de.params"; var parent0 = "simple.params"; var fileSpec = Path.GetFullPath(Path.Combine(RelativePath, subdir, fileName)); Assert.IsTrue(System.IO.File.Exists(fileSpec)); // Set up the database var pd = new ParameterDatabase(new FileInfo(fileSpec)); // Now look up the parent.0 parameter value and make sure it matches what we expect var parent = pd.GetFile(new Parameter("parent.0"), null); Assert.AreEqual(parent.Name, parent0); // The following seems very convoluted. But keep in mind // we are trying to verify that one implementation is valid // using a second implementation that is entirely different. (Indeed, that is the whole point!) // Use the ParameterFileTree to double check the details var subnode = Tree.Root[subdir]; // We can search down from the root given a relative subdirectory Assert.IsTrue(subnode.Name == fileName.Split(new[] { '.' })[0]); // Doublecheck that we've been given the correct subdirectory var paramFile = subnode.Files[fileName]; // Now grab the relevant source param file var parentRelPath = paramFile.Properties["parent.0"]; // This now gives the relative path to the parent param file var parentAbsPath = Path.GetFullPath(Path.Combine(subnode.FullName, parentRelPath)); // Now we should have the full path of the parent Assert.IsTrue(System.IO.File.Exists(parentAbsPath)); //var fi = new FileInfo(parentAbsPath); // Now that we've verified the validity of the relative path specified in the source param file // we can get the copy from the Tree and use that to check all params // in the database hierarchy (which is only two levels deep in this case) // NOT FINISHED: This is currently comparing raw values from the Tree against over-shadowed values in the Database : NEED MORE WORK! //foreach (var p in Tree.FileCollection[Path.GetFullPath(fi.FullName)].Properties) // This if from the tree //{ // var v = pd.GetProperty(p.Key); // This is what we find in the database // Assert.AreEqual(v, p.Value); //} var childFile = Tree.NodeRegistry[fileSpec]; Assert.IsNotNull(childFile); var parentFile = Tree.NodeRegistry[parentAbsPath]; Assert.IsNotNull(parentFile); foreach (DictionaryEntry kv in pd) { context.WriteLine("{0} : {1}", kv.Key, kv.Value); } foreach (var prop in parentFile.Properties) { if (childFile.Properties.ContainsKey(prop.Key)) { context.WriteLine("ShadowedProperty: {0} Parent: {1} Child: {2}", prop.Key, childFile.Properties[prop.Key], prop.Value); } } }