Пример #1
0
        public async Task GetPublicTransportLines()
        {
            var response = await _publicTransportLinesCollector.GetPublicTransportLines().ConfigureAwait(false);

            response.Should().HaveCountGreaterOrEqualTo(1);
            response.Should().Contain(predicate: x => x.From == "Kleinzschachwitz" && x.To == "Gorbitz" && x.Title == "Straßenbahnlinie 2", "One Correct Tram Line should be exist.");
            response.Should().Contain(predicate: x => x.From == "Dresden-Löbtau" && x.To == "Somsdorf/Pfaffengrund" && x.Title == "Buslinie A", "One Correct Bus Line should be exist.");
        }
Пример #2
0
        private async Task LoadCacheFromStorage()
        {
            var data = await _databaseAdapter.GetAllStopPoints().ConfigureAwait(false);

            var istStopPoints = data.Select(x => new KeyValuePair <string, bool>(x.TriasIdStopPoint, true));

            _existsStopPoints = new ConcurrentDictionary <string, bool>(istStopPoints);
            var istStopPointCache = data.Select(x => new KeyValuePair <string, CachedStopPoint>(x.TriasIdStopPoint, new CachedStopPoint
            {
                TriasIdStopPoint = x.TriasIdStopPoint,
                Latitude         = x.Latitude,
                Longitude        = x.Longitude,
                StopPointName    = x.StopPointName
            }));

            _stopPointCache = new ConcurrentDictionary <string, CachedStopPoint>(istStopPointCache);
            var dataLines = await _publicTransportLinesCollector.GetPublicTransportLines().ConfigureAwait(false);

            _linesCache = dataLines.ToArray();
        }