Beispiel #1
0
        /// <inheritdoc />
        public async Task <PointOfInterestExtended> GetPointOfInterestById(string id, string language, string type = "")
        {
            var featureCollection = await _nakebGateway.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);
        }
Beispiel #2
0
        /// <inheritdoc />
        public async Task <PointOfInterestExtended> GetPointOfInterestById(string id, string language)
        {
            var featureCollection = await _nakebGateway.GetById(int.Parse(id));

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

            await AddExtendedData(poiItem, mainFeature, language);

            poiItem.FeatureCollection = featureCollection;
            poiItem.IsEditable        = false;
            return(poiItem);
        }
Beispiel #3
0
        /// <inheritdoc />
        public async Task <PointOfInterestExtended> GetPointOfInterestById(string id, string language, string type = "")
        {
            var featureCollection = await _nakebGateway.GetById(int.Parse(id));

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

            await AddExtendedData(poiItem, mainFeature, language);

            poiItem.IsEditable     = false;
            poiItem.IsRoute        = true;
            poiItem.SourceImageUrl = "https://www.nakeb.co.il/static/images/hikes/logo_1000x667.jpg";
            return(poiItem);
        }
        /// <inheritdoc />
        public override async Task <PointOfInterestExtended> GetPointOfInterestById(string id, string language)
        {
            var featureCollection = await GetFromCacheIfExists(id);

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

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

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

            _nakebGateway.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>());
        }
Beispiel #6
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>()
            });
            _nakebGateway.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>());
        }
 /// <inheritdoc />
 public override Task <Feature> GetRawPointOfInterestById(string id)
 {
     return(_nakebGateway.GetById(id));
 }