Example #1
0
        /// <inheritdoc />
        public async Task <PointOfInterestExtended> GetPointOfInterestById(string id, string language, string type = "")
        {
            var featureCollection = await _offRoadGateway.GetById(id);

            var mainFeature = featureCollection.Features.FirstOrDefault(f => f.Geometry is LineString);
            var poiItem     = await ConvertToPoiItem <PointOfInterestExtended>(mainFeature, language);

            await AddExtendedData(poiItem, mainFeature, language);

            poiItem.IsRoute = true;
            return(poiItem);
        }
        /// <inheritdoc />
        public override async Task <PointOfInterestExtended> GetPointOfInterestById(string id, string language)
        {
            var featureCollection = await GetFromCacheIfExists(id);

            if (featureCollection == null)
            {
                featureCollection = await _offRoadGateway.GetById(id);

                SetToCache(featureCollection);
            }
            var poiItem = await ConvertToPoiExtended(featureCollection, language);

            poiItem.IsRoute = true;
            return(poiItem);
        }
Example #3
0
        public void GetPointOfInterestById_ShouldGetIt()
        {
            var poiId             = "42";
            var language          = "en";
            var featureCollection = new FeatureCollection
            {
                Features = { GetValidFeature(poiId, _adapter.Source) }
            };

            _offRoadGateway.GetById("42").Returns(featureCollection);

            var results = _adapter.GetPointOfInterestById(poiId, language).Result;

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.SourceImageUrl);
            Assert.IsFalse(results.IsEditable);
            _elevationDataStorage.Received().GetElevation(Arg.Any <Coordinate>());
            _elasticSearchGateway.Received().GetRating(poiId, Arg.Any <string>());
        }
Example #4
0
        public void GetPointOfInterestById_ShouldGetIt()
        {
            var poiId             = "42";
            var language          = "en";
            var featureCollection = new FeatureCollection
            {
                Features = { GetValidFeature(poiId, _adapter.Source) }
            };

            _dataContainerConverterService.ToDataContainer(Arg.Any <byte[]>(), Arg.Any <string>()).Returns(new DataContainer {
                Routes = new List <RouteData>()
            });

            _offRoadGateway.GetById("42").Returns(featureCollection);

            var results = _adapter.GetPointOfInterestById(poiId, language).Result;

            Assert.IsNotNull(results);
            Assert.AreEqual(0, results.References.Length);
            Assert.IsFalse(results.IsEditable);
            _elevationDataStorage.Received().GetElevation(Arg.Any <Coordinate>());
            _elasticSearchGateway.Received().GetRating(poiId, Arg.Any <string>());
        }