コード例 #1
0
        public void Can_Create_New_Point()
        {
            // Arrange
            var point = new MapPoint();
            var anotherPoint = new MapPoint(35.04, 48.32);

            // Assert
            Assert.AreNotEqual(point.Latitude, 10.0);
            Assert.AreEqual(48.32, anotherPoint.Longitude);
        }
コード例 #2
0
        public void Can_Convert_To_String()
        {
            // Arrange
            var point = new MapPoint(35.04, 48.32);

            // Act
            var stringValue = point.ToString();

            // Assert
            Assert.AreEqual("35.04 48.32", stringValue);
        }
コード例 #3
0
        public void Can_Convert_To_SqlGeography()
        {
            // Arrange
            var point = new MapPoint(35.04, 48.32);

            // Act
            var sqlGeoValue = point.ToSqlGeography();

            // Assert
            Assert.AreEqual((SqlDouble)48.32, sqlGeoValue.Lat);
        }
コード例 #4
0
        public void CanGetSteps()
        {
            var startPoint = new MapPoint(35.048072199999979, 48.437927).ToSqlGeography();
            var endPoint = new MapPoint(35.045630999999958, 48.46442).ToSqlGeography();
            var urlForDirection = GoogleMapHelper.CreateUrlForDirectionRequest(
               GeneralSettings.GoogleApiKey, startPoint, endPoint);
            var responce = GoogleMapHelper.GetResponceFromGoogleApi(urlForDirection);
            var stepsFromGoogle = GoogleMapHelper.GetStepsOfDirection(responce);

            var steps = new List<Step>
                {
                    new Step()
                        {
                            Instruction =
                                "Направляйтесь на <b>юго-восток</b> по <b>просп. Карла Маркса</b> в сторону <b>пл. В.И. Ленина</b>",
                            Length = "1,8 км",
                            Time = "21,8мин"
                        },
                    new Step()
                        {
                            Instruction = "Поверните <b>направо</b> на <b>просп. Гагарина</b>",
                            Length = "3 м",
                            Time = "0,0мин"
                        }
                };

            var result = stepsFromGoogle != null && (stepsFromGoogle.Except(steps) == null ? false : true);

            Assert.True(result);
        }
コード例 #5
0
        public void GetSummaryPolyline()
        {
            var startPoint = new MapPoint(35.048072199999979, 48.437927).ToSqlGeography();
            var endPoint = new MapPoint(35.045630999999958, 48.46442).ToSqlGeography();
            var urlForDirection = GoogleMapHelper.CreateUrlForDirectionRequest(
               GeneralSettings.GoogleApiKey, startPoint, endPoint);
            var responce = GoogleMapHelper.GetResponceFromGoogleApi(urlForDirection);
            var decodePolyline = GoogleMapHelper.GetSummaryPolyline(responce);
            var points = new List<MapPoint>()
                {
                    new MapPoint() { Latitude = 35.04858, Longitude = 48.43849 },
                    new MapPoint() { Latitude = 35.04807, Longitude = 48.43793 }
                };
            var result = decodePolyline != null && (decodePolyline.Except(points) == null ? false : true);

            Assert.True(result);
        }