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); }
public void InsertChild() { string refsText = Path.GetFullPath(Path.Combine(DataPath, "refs.txt")); BuildToolsRefsParser reader = new BuildToolsRefsParser(refsText); Assert.IsTrue(reader.FileExists); RootNode rootNode = reader.ReadFile(); RefsNode testNode = rootNode.First(); int middleIndex = 3; RefsNode first = new FileNode("TestStart.dll"); RefsNode middle = new FileNode("TestMiddle.dll"); RefsNode last = new FileNode("TestEnd.dll"); testNode.Insert(testNode.Count, last); testNode.Insert(0, first); testNode.Insert(middleIndex, middle); Assert.AreEqual(first, testNode[0]); Assert.AreEqual(middle, testNode[middleIndex]); Assert.AreEqual(last, testNode[testNode.Count - 1]); }