public void GetNodeByName_Should_Retrieve_Node_By_Name() { var tracker = new NodeTracker(); var node1 = new GraphNode("name1"); var node2 = new GraphNode("name2"); tracker.AddNode(node1); tracker.AddNode(node2); Assert.AreEqual(tracker.Nodes.Count(), 2); Assert.AreSame(tracker.GetNodeByName("name1"), node1); Assert.AreSame(tracker.GetNodeByName("name2"), node2); }
public void GetNodeByTag_Should_Retrieve_Node_By_Tag() { var tracker = new NodeTracker(); var node1 = new GraphNode("name1") {Tag = 1}; var node2 = new GraphNode("name2") {Tag = 2}; tracker.AddNode(node1); tracker.AddNode(node2); Assert.AreEqual(tracker.Nodes.Count(), 2); Assert.AreSame(tracker.GetNodeByTag(1), node1); Assert.AreSame(tracker.GetNodeByTag(2), node2); }
public void Add_Should_Add_Node_To_Collection() { var tracker = new NodeTracker(); var node = new GraphNode("name"); tracker.AddNode(node); Assert.AreEqual(tracker.Nodes.Count(), 1); Assert.AreSame(tracker.Nodes.First(), node); }
public void GetNodeByTag_With_Invalid_Tag_Should_Return_Null() { var tracker = new NodeTracker(); var node1 = new GraphNode("name1") { Tag = 1 }; tracker.AddNode(node1); Assert.AreEqual(tracker.Nodes.Count(), 1); Assert.IsNull(tracker.GetNodeByTag(2)); }