public void TestAddNode() { Node testNode =new Node(); testNode.Id = -1; testNode.Latitude = 0; testNode.Longitude = 0; var source = new MemoryDataSource(); source.AddNode(testNode); // test if the node is actually there. Assert.AreEqual(testNode, source.GetNode(-1)); // test if the node was not remove after getting it. Assert.AreEqual(testNode, source.GetNodes(new List<long>() { -1 })[0]); // test if the node is in the list of nodes. Assert.AreEqual(testNode, new List<Node>(source.GetNodes())[0]); // test if the node will be retrieved using a list of ids. var ids = new List<long>(); ids.Add(-1); IList<Node> nodes = source.GetNodes(ids); Assert.IsNotNull(nodes); Assert.AreEqual(1, nodes.Count); Assert.AreEqual(testNode, nodes[0]); }
public void TestRemoveNode() { Node testNode = new Node(); testNode.Id = -1; testNode.Latitude = 0; testNode.Longitude = 0; var source = new MemoryDataSource(); source.AddNode(testNode); // test if the node is actually there. Assert.AreEqual(testNode, source.GetNode(-1)); // remove the node. source.RemoveNode(-1); // test if the node is actually gone. Assert.IsNull(source.GetNode(-1)); }