public void TestRebuild_ShouldRebuildHighwaysAndPoints() { _service.Rebuild(new UpdateRequest { Highways = true, PointsOfInterest = true }).Wait(); _elasticSearchGateway.Received(1).UpdateHighwaysZeroDownTime(Arg.Any <List <Feature> >()); _elasticSearchGateway.Received(1).UpdatePointsOfInterestZeroDownTime(Arg.Any <List <Feature> >()); }
public void GetRating_ValidInput_ShouldReturnRating() { var id = "42"; var source = "source"; var result = _controller.GetRating(id, source).Result as OkObjectResult; Assert.IsNotNull(result); _elasticSearchGateway.Received(1).GetRating(id, source); }
public void TestRebuild_ShouldRebuildHighwaysAndPoints() { var adapter = Substitute.For <IPointsOfInterestAdapter>(); adapter.GetPointsForIndexing().Returns(new List <Feature>()); _pointsOfInterestAdapterFactory.GetBySource(Arg.Any <string>()).Returns(adapter); _elasticSearchGateway.GetExternalPoisBySource(Arg.Any <string>()).Returns(new List <Feature>()); _featuresMergeExecutor.Merge(Arg.Any <List <Feature> >()).Returns(new List <Feature>()); _service.Rebuild(new UpdateRequest { Highways = true, PointsOfInterest = true, SiteMap = true }).Wait(); _elasticSearchGateway.Received(1).UpdateHighwaysZeroDownTime(Arg.Any <List <Feature> >()); _elasticSearchGateway.Received(1).UpdatePointsOfInterestZeroDownTime(Arg.Any <List <Feature> >()); _pointsOfInterestFilesCreatorExecutor.Received(1).Create(Arg.Any <List <Feature> >()); }
public void PostUpdateData_RemoteIs10101010_ShouldUpdateGateways() { SetupContext(IPAddress.Parse("1.2.3.4"), IPAddress.Parse("10.10.10.10")); var file = Substitute.For <IFormFile>(); file.FileName.Returns("somefile.pbf"); file.OpenReadStream().Returns(new MemoryStream(new byte[] { 1 })); _geoJsonPreprocessorExecutor.Preprocess(Arg.Any <Dictionary <string, List <ICompleteOsmGeo> > >()).Returns(new Dictionary <string, List <Feature> >()); _updateController.PostUpdateData(file).Wait(); _graphHopperGateway.Received(1).Rebuild(Arg.Any <MemoryStream>(), Arg.Any <string>()); _elasticSearchGateway.Received(1).UpdateDataZeroDownTime(Arg.Any <List <Feature> >(), Arg.Any <List <Feature> >()); }
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>()); }
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>()); }