示例#1
0
        public void Points_One()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng first = new LatLng(30.1, -60.2);

            accessor.Path = new Path(first);

            string expected = "path=30.1,-60.2";
            string actual   = accessor.GetPathsStr();

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void Points_Two()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng first  = new LatLng(30.1, -60.2);
            LatLng second = new LatLng(40.3, -70.4);

            accessor.Path = new Path(first, second);

            string expected = "path=30.1,-60.2%7C40.3,-70.4";
            string actual   = accessor.GetPathsStr();

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void Encoded_SinglePoint()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng zero = new LatLng(30.0, -60.0);

            accessor.Path = new Path(zero)
            {
                Encode = true
            };

            string expected = "path=enc:" + PolylineEncoder.EncodeCoordinates(new LatLng[] { zero });
            string actual   = accessor.GetPathsStr();

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void Encode_set_but_not_all_LatLng_positions()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng   first  = new LatLng(30.0, -60.0);
            Location second = new Location("New York");

            accessor.Path = new Path(first, second)
            {
                Encode = true
            };

            string expected = null;            //expecting an Exception
            string actual   = accessor.GetPathsStr();

            Assert.Fail("Expected an InvalidOperationException because first point was LatLng but second point was Location.");
        }
        public void Points_Two()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng first = new LatLng(30.1, -60.2);
            LatLng second = new LatLng(40.3, -70.4);

            accessor.Path = new Path(first, second);

            string expected = "path=30.1,-60.2%7C40.3,-70.4";
            string actual = accessor.GetPathsStr();

            Assert.AreEqual(expected, actual);
        }
        public void Points_One()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng first = new LatLng(30.1, -60.2);
            accessor.Path = new Path(first);

            string expected = "path=30.1,-60.2";
            string actual = accessor.GetPathsStr();

            Assert.AreEqual(expected, actual);
        }
        public void Encode_set_but_not_all_LatLng_positions()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng first = new LatLng(30.0, -60.0);
            Location second = new Location("New York");
            accessor.Path = new Path(first, second) { Encode = true };

            string expected = null;//expecting an Exception
            string actual = accessor.GetPathsStr();

            Assert.Fail("Expected an InvalidOperationException because first point was LatLng but second point was Location.");
        }
        public void Encoded_SinglePoint()
        {
            StaticMapRequestAccessor accessor = new StaticMapRequestAccessor();

            LatLng zero = new LatLng(30.0, -60.0);
            accessor.Path = new Path(zero) { Encode = true };

            string expected = "path=enc:" + PolylineEncoder.EncodeCoordinates(new LatLng[] { zero });
            string actual = accessor.GetPathsStr();

            Assert.AreEqual(expected, actual);
        }