/// <summary> /// Compares what is in the complete list against the objects in the reference source. /// </summary> /// <param name="expected"></param> /// <param name="actual"></param> private void Compare(MemoryDataSource expected, List<CompleteOsmGeo> actual) { List<CompleteOsmGeo> exectedList = new List<CompleteOsmGeo>(); foreach (Node node in expected.GetNodes()) { CompleteNode completeNode = CompleteNode.CreateFrom(node); if (completeNode != null) { exectedList.Add(completeNode); } } foreach (Way way in expected.GetWays()) { CompleteWay completeWay = CompleteWay.CreateFrom(way, expected); if (completeWay != null) { exectedList.Add(completeWay); } } foreach (Relation relation in expected.GetRelations()) { CompleteRelation completeRelation = CompleteRelation.CreateFrom(relation, expected); if (completeRelation != null) { exectedList.Add(completeRelation); } } ComparisonHelpers.CompareComplete(exectedList, actual); }
public void TestAddWay() { Way testWay = new Way(); testWay.Id = -1; var source = new MemoryDataSource(); source.AddWay(testWay); // test if the way is actually there. Assert.AreEqual(testWay, source.GetWay(-1)); // test if the way was not remove after getting it. Assert.AreEqual(testWay, source.GetWays(new List<long>() { -1 })[0]); // test if the way is in the list of ways. Assert.AreEqual(testWay, new List<Way>(source.GetWays())[0]); // test if the way will be retrieved using a list of ids. var ids = new List<long>(); ids.Add(-1); IList<Way> ways = source.GetWays(ids); Assert.IsNotNull(ways); Assert.AreEqual(1, ways.Count); Assert.AreEqual(testWay, ways[0]); }