public void GetFilename() { string refsText = Path.GetFullPath(Path.Combine(DataPath, "refs.txt")); string fileName = "Main.dll"; BuildToolsRefsParser reader = new BuildToolsRefsParser(refsText); Assert.IsTrue(reader.FileExists); RootNode rootNodes = reader.ReadFile(); RefsNode testNode = rootNodes[0]; Assert.IsTrue(testNode.TryGetReference(fileName, out FileNode fileNode)); Console.WriteLine(fileNode.GetRelativePath()); }
public void TryGetReference_NonExistant() { string refsText = Path.GetFullPath(Path.Combine(DataPath, "refs.txt")); string fileName = "NonExistant.dll"; BuildToolsRefsParser reader = new BuildToolsRefsParser(refsText); Assert.IsTrue(reader.FileExists); RootNode rootNodes = reader.ReadFile(); RefsNode testNode = rootNodes[0]; int childCount = testNode.Count; testNode.Insert(childCount, new FileNode("TestEnd.dll")); testNode.Insert(0, new FileNode("TestStart.dll")); testNode.Insert(3, new FileNode("TestMiddle.dll")); Assert.IsFalse(testNode.TryGetReference(fileName, out FileNode fileNode)); Assert.IsNull(fileNode); }