Beispiel #1
0
        public void MakeKeyValueUniqueToClosestTest()
        {
            var nodes = GetTestValues();
            var point = new PointLatLng(3, 3);

            var uniquedPoints = GeoSorter.MakeKeyValueUniqueToClosest(nodes, point, "place");

            Assert.AreEqual(2, uniquedPoints.Length);

            Assert.IsTrue(uniquedPoints.Contains(nodes[1]));
            Assert.IsTrue(uniquedPoints.Contains(nodes[2]));
        }
Beispiel #2
0
        public void SortByDistanceTest()
        {
            var nodes = GetTestValues();
            var point = new PointLatLng(3, 3);

            var sortedPoints = GeoSorter.SortByDistance(nodes, point);

            Assert.AreEqual(sortedPoints[0], nodes[2]);
            Assert.AreEqual(sortedPoints[1], nodes[3]);
            Assert.AreEqual(sortedPoints[2], nodes[1]);
            Assert.AreEqual(sortedPoints[3], nodes[0]);


            sortedPoints = GeoSorter.SortByDistance(nodes, point, false);

            Assert.AreEqual(sortedPoints[3], nodes[2]);
            Assert.AreEqual(sortedPoints[2], nodes[3]);
            Assert.AreEqual(sortedPoints[1], nodes[1]);
            Assert.AreEqual(sortedPoints[0], nodes[0]);
        }