public void AddPointOfInterest_ShouldUpdateOsmAndElasticSearch()
        {
            var gateway  = SetupHttpFactory();
            var language = "he";

            gateway.CreateElement(Arg.Any <long>(), Arg.Any <Node>()).Returns(42);
            var pointOfInterestToAdd = new PointOfInterestExtended
            {
                Location   = new LatLng(),
                ImagesUrls = new [] { "image1", "image2" },
                Icon       = _tagsHelper.GetCategoriesByType(Categories.POINTS_OF_INTEREST).First().Icon,
                References = new[]
                {
                    new Reference {
                        Url = "he.wikipedia.org/wiki/%D7%AA%D7%9C_%D7%A9%D7%9C%D7%9D"
                    }
                }
            };

            _dataContainerConverterService.ToDataContainer(Arg.Any <byte[]>(), Arg.Any <string>()).Returns(new DataContainer {
                Routes = new List <RouteData>()
            });
            _elasticSearchGateway.GetContainers(Arg.Any <Coordinate>()).Returns(new List <Feature>());
            _wikipediaGateway.GetReference(Arg.Any <string>(), language).Returns(new Reference {
                Url = "Some-Url"
            });

            var resutls = _adapter.AddPointOfInterest(pointOfInterestToAdd, new TokenAndSecret("", ""), language).Result;

            Assert.IsNotNull(resutls);
            _elasticSearchGateway.Received(1).UpdatePointsOfInterestData(Arg.Any <List <Feature> >());
            gateway.Received().CreateElement(Arg.Any <long>(), Arg.Is <OsmGeo>(x => x.Tags[FeatureAttributes.WIKIPEDIA + ":" + language].Contains("תל שלם")));
        }
Exemplo n.º 2
0
        public void AddPointOfInterest_ShouldUpdateOsmAndElasticSearch()
        {
            var gateway = SetupHttpFactory();

            gateway.CreateElement(Arg.Any <string>(), Arg.Any <Node>()).Returns("42");
            var pointOfInterestToAdd = new PointOfInterestExtended
            {
                Location   = new LatLng(),
                ImagesUrls = new string[0],
                Icon       = _tagsHelper.GetIconsPerCategoryByType(Categories.POINTS_OF_INTEREST).Values.First().First().Icon
            };

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

            var resutls = _adapter.AddPointOfInterest(pointOfInterestToAdd, null, "he").Result;

            Assert.IsNotNull(resutls);
            _elasticSearchGateway.Received(1).UpdateNamesData(Arg.Any <Feature>());
        }