Пример #1
0
        public void IsNextMAPDataWaypointInSameDirectionAsTravel_ShouldReturnTrue()
        {
            // arrange

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

            //< name > 2130 - Gilberstone Avenue </ name >
            // 2130 only has inbound SPAT

            var intersectionId = "2130";
            var route          = KMLHelper.GLOSATestRoute().ToList();
            var gpsHistory     = KMLHelper.GLOSATestRouteIntersectionHistory(intersectionId, 1);

            NavigationService navigationService = new NavigationService();
            var waypoint = navigationService.LocateWaypointWithLineOfSight(WaypointDetectionMethod.GPSHistoryDirection, gpsHistory, 0, 50, 0.04);

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

            //assert
            Assert.Equal(expectedResult, actualResult);
        }
Пример #2
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);
        }
Пример #3
0
        private void PopulateGeofenceList()
        {
            IList <kmlDocumentPlacemark> placemarks = KMLHelper.GLOSATestRoute();

            foreach (var placemark in placemarks)
            {
                // https://developers.google.com/kml/documentation/kmlreference?csw=1#coordinates
                var      coordinatesString = placemark.Point.coordinates;
                string[] parts             = coordinatesString.Split(',');
                double   longitude         = double.Parse(parts[0]);
                double   latitude          = double.Parse(parts[1]);

                _geoList.Add(new GeofenceBuilder().SetRequestId(placemark.name).SetCircularRegion(latitude, longitude, Constants.GeofenceDefaultRadiusMeters).SetExpirationDuration(Geofence.NeverExpire).SetTransitionTypes(Geofence.GeofenceTransitionEnter | Geofence.GeofenceTransitionExit).Build());
            }
        }
Пример #4
0
        public async void IsNextWaypointInSameDirection_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 = "2105";
            var route          = KMLHelper.GLOSATestRoute().ToList();
            var gpsHistory     = KMLHelper.GLOSATestRouteIntersectionHistory(intersectionId, 2);

            NavigationService navigationService = new NavigationService();
            var waypoint = navigationService.LocateWaypointOnRoute(WaypointDetectionMethod.GPSHistoryDirection, route, gpsHistory, 0, 0);

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

            //assert
            Assert.Equal(expectedResult, actualResult);
        }