예제 #1
0
 public void Ctor_InvalidCustomValues()
 {
     VehicleTracker trk = new VehicleTracker(new GeoCoordinate[] { new GeoCoordinate(-40, -40), new GeoCoordinate(-40, -40) },
         -1,
         15,
         5, 5, 5, 5);
 }
예제 #2
0
        public void Tracker_FiresEventsAndUpdatesCoords()
        {
            GeoCoordinate startPoint = new GeoCoordinate(-40, -40);
            GeoCoordinate endPoint = new GeoCoordinate(-40.00001, -40.00001);

            MockConsumer mck = new MockConsumer();
            VehicleTracker trk = new VehicleTracker(new GeoCoordinate[] { startPoint, endPoint });

            mck.Subscribe(trk);
            trk.StartTracker();

            Assert.AreEqual(mck.latitude, endPoint.Latitude);
        }
예제 #3
0
        static void Main(string[] args)
        {
            // Must contain at least 2 valid coordinates
            GeoCoordinate[] waypoints = new GeoCoordinate[]
            {
                new GeoCoordinate(38.048196, -121.089409),
                new GeoCoordinate(38.041013, -121.091238),
                new GeoCoordinate(37.984013, -121.103238)
            };

            VehicleTracker gpsTracker = new VehicleTracker(waypoints);

            Vehicle car = new Vehicle();
            car.Subscribe(gpsTracker);

            gpsTracker.StartTracker();
        }
예제 #4
0
 public void Ctor_InvalidCoordinateFormat()
 {
     VehicleTracker trk = new VehicleTracker(new GeoCoordinate[] { new GeoCoordinate(-1000, -1000) });
 }
예제 #5
0
 public void Ctor_InvalidCoordinateQuantity()
 {
     VehicleTracker trk = new VehicleTracker(new GeoCoordinate[] { new GeoCoordinate(-1, -1) });
 }
예제 #6
0
 public void Subscribe(VehicleTracker theTracker)
 {
     theTracker.PositionChange +=
        new VehicleTracker.PositionChangeHandler(PositionHasChanged);
 }