public void testAddingTotheBeginning() { Converter.SortedNodeContainer test = new Converter.SortedNodeContainer(); Node node1 = new Node(); node1.OfficeLocation = 666; node1.CrossingPoint = new Point(5, 5); test.Add(node1); Node node2 = new Node(); node2.CrossingPoint = new Point(7, 7); test.Add(node2); Node node3 = new Node(); node3.CrossingPoint = new Point((float)0.5, (float)0.5); test.Add(node3); Assert.AreEqual(3, test.Count, "the resulting container correctly has 3 elements"); Assert.AreEqual(node3, test[0], "the node has been correctly added to the beginning"); }
public void ifEmptyAddNode() { Converter.SortedNodeContainer test = new Converter.SortedNodeContainer(); Node node = new Node(); node.OfficeLocation = 666; node.CrossingPoint = new Point(5, 5); test.Add(node); Assert.AreEqual(1, test.Count, "the resulting container correctly has 1 element"); Assert.AreEqual(node, test[0], "the resulting container has the correct node"); }
public void testAddingTotheMiddle() { Converter.SortedNodeContainer test = new Converter.SortedNodeContainer(); Node node1 = new Node(); node1.OfficeLocation = 666; node1.CrossingPoint = new Point(0, 0); test.Add(node1); Node node2 = new Node(); node2.CrossingPoint = new Point((float)7.5, (float)7.5); test.Add(node2); Node node3 = new Node(); node3.CrossingPoint = new Point((float)4.2, (float)4.2); test.Add(node3); Assert.AreEqual(3, test.Count, "the container correctly has 3 elements"); Assert.AreEqual(node3, test[1], "the node has been correctly added to the middle"); Node node4 = new Node(); node4.CrossingPoint = new Point((float)3.1, (float)3.1); test.Add(node4); Assert.AreEqual(4, test.Count, "the container correctly has 4 elements"); Assert.AreEqual(node4, test[1], "the node has been correctly added to position 1"); Node node5 = new Node(); node5.CrossingPoint = new Point((float)5.3, (float)5.3); test.Add(node5); Assert.AreEqual(5, test.Count, "the container correctly has 5 elements"); Assert.AreEqual(node5, test[3], "the node has been correctly added to position 3"); Node node6 = new Node(); node6.CrossingPoint = new Point((float)6.4, (float)6.4); test.Add(node6); Assert.AreEqual(6, test.Count, "the container correctly has 6 elements"); Assert.AreEqual(node6, test[4], "the node has been correctly added to position 4"); }