Beispiel #1
0
        public async void CanRunMultipleGLOSARequests_ShouldReturnTrue()
        {
            // arrange

            //SETTINGS_ROUTE_DIRECTION_ANY = 0: - Not Supported Yet
            //SETTINGS_ROUTE_DIRECTION_IB = 1: - Not Supported Yet
            //SETTINGS_ROUTE_DIRECTION_OB = 2;

            var intersectionId = "1992";
            var route          = KMLHelper.GLOSATestRoute().ToList();
            var gpsHistory     = KMLHelper.GLOSATestRouteIntersectionHistory(intersectionId, 2);

            NavigationService navigationService = new NavigationService();

            var waypoint1  = navigationService.LocateWaypointOnRoute(WaypointDetectionMethod.GPSHistoryDirection, route, gpsHistory, 0, 0);
            var waypoint2  = navigationService.LocateWaypointOnRoute(WaypointDetectionMethod.GPSHistoryDirection, route, gpsHistory, 0, 1);
            var webService = new GLOSAWebService(null);

            //await Task.Run(async () => await webService.SyncMAPSPATAsync(KMLHelper.IntersectionIdOfPlacemark(waypoint1)));
            //await Task.Run(async () => await webService.SyncMAPSPATAsync(KMLHelper.IntersectionIdOfPlacemark(waypoint2)));
            var waypoint1Id = KMLHelper.IntersectionIdOfPlacemark(waypoint1);
            var waypoint2Id = waypoint2 != null?KMLHelper.IntersectionIdOfPlacemark(waypoint2) : null;

            await Task.Run(async() => await webService.SyncMAPSPATAsync(waypoint1Id, waypoint2Id));

            bool expectedResult = true;
            //act
            bool actualResult = waypoint1 != null;

            //assert
            Assert.Equal(expectedResult, actualResult);
        }
        /// <summary>
        /// Finds next waypoint by distance from current location
        /// </summary>
        private void LocateWaypoint()
        {
            if (_routeMode == true)
            {
                _currentWaypoint = null;

                var waypoint = LocateWaypointWithLineOfSight(WaypointDetectionMethod.GPSHistoryDirection, 0, 50, 1.0);
                if (waypoint == null)
                {
                    return;
                }
                var waypointID       = waypoint.intersections.IntersectionGeometry.id.id.ToString();
                var nextMAPPlacemark = _testRoute.Find(match => match.name.Contains(waypointID));
                if (nextMAPPlacemark != null)
                {
                    var nextIntersectionId = KMLHelper.IntersectionIdOfPlacemark(nextMAPPlacemark);
                    _currentWaypointId = waypoint.intersections.IntersectionGeometry.id.id.ToString();
                    _currentWaypoint   = nextMAPPlacemark;
                }
            }
        }