コード例 #1
0
        public void TestAddWayAndNodes()
        {
            Way testWay = new Way();

            testWay.Id    = 1;
            testWay.Nodes = new List <long>();
            testWay.Nodes.Add(1);
            testWay.Nodes.Add(2);

            Node node1 = new Node();

            node1.Id        = 1;
            node1.Longitude = 0;
            node1.Latitude  = 0;
            Node node2 = new Node();

            node2.Id        = 2;
            node2.Longitude = 0;
            node2.Latitude  = 0;

            var source = new MemoryDataSource();

            source.AddWay(testWay);

            IList <Way> resultWays = source.GetWaysFor(node1);

            Assert.IsNotNull(resultWays);
            Assert.AreEqual(1, resultWays.Count);
            Assert.AreEqual(testWay, resultWays[0]);

            // test if the way is actually there.
            Assert.AreEqual(testWay, source.GetWay(1));

            // test if the way was not removed after getting it.
            Assert.AreEqual(testWay, source.GetWay(1));
        }