public OfflineDataViewModel()
        {
            _weatherService = new WeatherService();
            _trafficService = new TrafficService();

            _weatherModel = _weatherService.GetOfflineModel(localFolder);
            _trafficModel = _trafficService.GetOfflineModel(localFolder);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Erzeugt eine neue Instanz und verwendet den angegebenen Endpunkt.
 /// </summary>
 /// <param name="url">der Endpunkt eines Dienstes</param>
 /// <param name="mapSpatialReference">der Raumbezug der Karte</param>
 public TrafficLayer(string url, Esri.ArcGISRuntime.Geometry.SpatialReference mapSpatialReference)
 {
     // TODO: Dispose des Dienstes implementieren
     _service             = new TrafficService();
     _url                 = url;
     _mapSpatialReference = mapSpatialReference;
     Overlay              = CreateOverlay();
     AreaOfInterest       = new EnvelopeBuilder(mapSpatialReference).ToGeometry();
 }
        public void DisplayTrafficInfo_NullLocation()
        {
            var ex = Assert.Throws <ArgumentNullException>(() =>
            {
                TrafficService.DisplayTrafficInfo(null, happyDateAndTime);
            });

            Assert.That(ex.Message, Is.EqualTo("Location is required."));
        }
        public void DisplayTrafficInfo_InvalidDateTime()
        {
            var ex = Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                TrafficService.DisplayTrafficInfo(happyLocation, invalidDateAndTime);
            });

            Assert.That(ex.Message, Is.EqualTo("Invalid dateAndTime input."));
        }
 public void TestQueryCityOfBonn()
 {
     using (var service = new TrafficService())
     {
         var featureCollection = service.Query(@"http://stadtplan.bonn.de/geojson?Thema=19584").Result;
         Assert.IsNotNull(featureCollection, @"Die FeatureCollection muss instanziert sein!");
         foreach (var feature in featureCollection.Features)
         {
             Assert.IsNotNull(feature, @"Ein jedes Feature muss instanziert sein!");
             var geometry = feature.Geometry;
             Assert.IsNotNull(geometry, @"Die Geometrie muss instanziert sein!");
             var properties = feature.Properties;
             Assert.IsNotNull(properties, @"Die Eigenschaften müssen instanziert sein!");
         }
     }
 }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            hotelService                = new HotelService("Crawler");
            roomFacilityService         = new RoomFacilityService("Crawler");
            hotelRoomFacilityService    = new HotelRoomFacilityService("Crawler");
            baseFacilityService         = new BaseFacilityService("Crawler");
            serviceFacilityService      = new ServiceFacilityService("Crawler");
            hotelBaseFacilityService    = new HotelBaseFacilityService("Crawler");
            hotelServiceFacilityService = new HotelServiceFacilityService("Crawler");
            trafficService              = new TrafficService("Crawler");
            _allRoomFacilities          = roomFacilityService.GetAll();
            _allServiceFacilities       = serviceFacilityService.GetAll();
            _allBaseFacilities          = baseFacilityService.GetAll();
            //var url = "http://hotel.qunar.com/city/beijing_city/dt-21056";
            var urls = new List <string>
            {
                "http://hotel.qunar.com/city/singapore_city/dt-183",
                "http://hotel.qunar.com/city/singapore_city/dt-1104",
                "http://hotel.qunar.com/city/singapore_city/dt-118",
                "http://hotel.qunar.com/city/singapore_city/dt-58",
                "http://hotel.qunar.com/city/singapore_city/dt-1655",
                "http://hotel.qunar.com/city/singapore_city/dt-95",
                "http://hotel.qunar.com/city/singapore_city/dt-1105",
                "http://hotel.qunar.com/city/singapore_city/dt-1088",
                "http://hotel.qunar.com/city/singapore_city/dt-53"
            };

            foreach (var url in urls)
            {
                try
                {
                    var hotelCrawler = new PoliteWebCrawler();
                    hotelCrawler.PageCrawlStartingAsync        += hotel_ProcessPageCrawlStarting;
                    hotelCrawler.PageCrawlCompletedAsync       += hotel_ProcessPageCrawlCompleted;
                    hotelCrawler.PageCrawlDisallowedAsync      += hotel_PageCrawlDisallowed;
                    hotelCrawler.PageLinksCrawlDisallowedAsync += hotel_PageLinksCrawlDisallowed;
                    hotelCrawler.Crawl(new Uri(url));
                }
                catch (Exception ex)
                {
                    string ssss = ex.Message;
                }
            }
        }
        public void DisplayTrafficInfo_Happy()
        {
            TrafficDataModel expected = new TrafficDataModel()
            {
                Location            = happyLocation,
                DateAndTime         = happyDateAndTime,
                TrafficAverageSpeed = 35.4,
                TrafficDensity      = 0.24,
                TruckPercentage     = 0.15,
                NumberOfAccidents   = 5
            };
            var actual = TrafficService.DisplayTrafficInfo(happyLocation, happyDateAndTime);

            Assert.AreEqual(expected.Location, actual.Location);
            Assert.AreEqual(expected.DateAndTime, actual.DateAndTime);
            Assert.AreEqual(expected.TrafficAverageSpeed, actual.TrafficAverageSpeed);
            Assert.AreEqual(expected.TrafficDensity, actual.TrafficDensity);
            Assert.AreEqual(expected.TruckPercentage, actual.TruckPercentage);
            Assert.AreEqual(expected.NumberOfAccidents, actual.NumberOfAccidents);
        }
Ejemplo n.º 8
0
 static UpdateTrafficLayerUsingTimer()
 {
     TrafficServiceInstance = new TrafficService();
 }
Ejemplo n.º 9
0
 public TrafficController(TrafficService trafficService)
 {
     _trafficService = trafficService;
 }