public void UpdatePointWithTwoIcon_ShouldUpdate()
        {
            var gateway         = SetupHttpFactory();
            var pointOfInterest = new PointOfInterestExtended
            {
                ImagesUrls  = new string[0],
                Id          = "Node_1",
                Icon        = "icon-cave",
                Description = "new description",
                References  = new Reference[0]
            };

            _dataContainerConverterService.ToDataContainer(Arg.Any <byte[]>(), Arg.Any <string>()).Returns(new DataContainer {
                Routes = new List <RouteData>()
            });
            gateway.GetNode(1).Returns(new Node
            {
                Id   = 1,
                Tags = new TagsCollection
                {
                    new Tag("historic", "archaeological_site"),
                    new Tag("natural", "cave_entrance"),
                }
            });
            _elasticSearchGateway.GetContainers(Arg.Any <Coordinate>()).Returns(new List <Feature>());

            var results = _adapter.UpdatePointOfInterest(pointOfInterest, new TokenAndSecret("", ""), "en").Result;

            CollectionAssert.AreEqual(pointOfInterest.ImagesUrls.OrderBy(i => i).ToArray(), results.ImagesUrls.OrderBy(i => i).ToArray());
        }
Exemplo n.º 2
0
        public void UpdatePoint_SyncImages()
        {
            var gateway         = SetupHttpFactory();
            var pointOfInterest = new PointOfInterestExtended
            {
                ImagesUrls = new[] { "imageurl2", "imageurl1", "imageurl4" },
                Id         = "1",
                Icon       = "oldIcon",
                Type       = OsmGeoType.Node.ToString().ToLower()
            };

            _dataContainerConverterService.ToDataContainer(Arg.Any <byte[]>(), Arg.Any <string>()).Returns(new DataContainer {
                routes = new List <RouteData>()
            });
            gateway.GetNode(pointOfInterest.Id).Returns(new Node
            {
                Id   = 1,
                Tags = new TagsCollection
                {
                    new Tag("image", "imageurl1"),
                    new Tag("image1", "imageurl3"),
                }
            });

            var results = _adapter.UpdatePointOfInterest(pointOfInterest, null, "en").Result;

            CollectionAssert.AreEqual(pointOfInterest.ImagesUrls.OrderBy(i => i).ToArray(), results.ImagesUrls.OrderBy(i => i).ToArray());
        }