Пример #1
0
        public void EncodePolyLineTest()
        {
            var locations      = new[] { new Location(1.0101, 1.0101), new Location(2.20202, 2.20202), new Location(3.30303, 3.30303) };
            var encodePolyLine = GoogleFunctions.EncodePolyLine(locations);

            Assert.IsNotNull(encodePolyLine.FirstOrDefault());
            Assert.AreEqual(GoogleFunctionsTest.POLY_LINE, encodePolyLine);
        }
Пример #2
0
        public void DecodePolyLineWhenEncdodedLocationsIsNullTest()
        {
            var exception = Assert.Throws <ArgumentNullException>(() =>
            {
                var decodePolyLine = GoogleFunctions.DecodePolyLine(null);
                Assert.IsNull(decodePolyLine);
            });

            Assert.AreEqual("encodedLocations", exception.ParamName);
        }
Пример #3
0
        public void DecodePolyLineTest()
        {
            var decodePolyLine = GoogleFunctions.DecodePolyLine(GoogleFunctionsTest.POLY_LINE).ToArray();

            Assert.IsNotNull(decodePolyLine.FirstOrDefault());
            Assert.AreEqual(3, decodePolyLine.Length);
            Assert.AreEqual(decodePolyLine[0].LocationString, location1.LocationString);
            Assert.AreEqual(decodePolyLine[1].LocationString, location2.LocationString);
            Assert.AreEqual(decodePolyLine[2].LocationString, location3.LocationString);
        }
Пример #4
0
 private IEnumerable <Location> DecodePoints()
 {
     try
     {
         return(GoogleFunctions.DecodePolyLine(this.EncodedPoints));
     }
     catch (Exception _ex)
     {
         throw new PointsDecodingException("Couldn't decode points", this.EncodedPoints, _ex);
     }
 }
Пример #5
0
        public void MergePolyLineTest()
        {
            var mergePolyLine = GoogleFunctions.MergePolyLine(GoogleFunctionsTest.POLY_LINE, GoogleFunctionsTest.POLY_LINE_2);

            Assert.IsNotNull(mergePolyLine);
            Assert.AreEqual("chdEchdEoxgFoxgFi`vEi`vEe~|g@e~|g@ore}@ore}@izs|@izs|@", mergePolyLine);

            var decodePolyLine = GoogleFunctions.DecodePolyLine(mergePolyLine).ToArray();

            Assert.IsNotNull(decodePolyLine.FirstOrDefault());
            Assert.AreEqual(6, decodePolyLine.Length);
            Assert.AreEqual(decodePolyLine[0].LocationString, location1.LocationString);
            Assert.AreEqual(decodePolyLine[1].LocationString, location2.LocationString);
            Assert.AreEqual(decodePolyLine[2].LocationString, location3.LocationString);
            Assert.AreEqual(decodePolyLine[3].LocationString, location4.LocationString);
            Assert.AreEqual(decodePolyLine[4].LocationString, location5.LocationString);
            Assert.AreEqual(decodePolyLine[5].LocationString, location6.LocationString);
        }
Пример #6
0
 private IEnumerable <Location> DecodePoints()
 {
     return(GoogleFunctions.DecodePolyLine(this.EncodedPoints));
 }
Пример #7
0
        public void MergePolyLineWhenEncdodedLocationsIsNullTest()
        {
            var exception = Assert.Throws <ArgumentNullException>(() => GoogleFunctions.MergePolyLine(null));

            Assert.AreEqual("encodedLocations", exception.ParamName);
        }