示例#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);
 }