public void GeoShapeLineString_Deserializes(string cacheName, string cacheKey, bool cache) { var coordinates = new[] { new[] { 13.0, 53.0 }, new[] { 14.0, 52.0 } }; var geoBaseShapeFilter = this.SerializeThenDeserialize(cacheName, cacheKey, cache, f => f.GeoShape, f => f.GeoShapeLineString(p => p.Origin, d => d .Coordinates(coordinates) ) ); var filter = geoBaseShapeFilter as IGeoShapeLineStringFilter; filter.Should().NotBeNull(); filter.Field.Should().Be("origin"); filter.Should().NotBeNull(); filter.Shape.Should().NotBeNull(); filter.Shape.Type.Should().Be("linestring"); filter.Shape.Coordinates.SelectMany(c => c).Should() .BeEquivalentTo(coordinates.SelectMany(c => c)); }
public void GeoShapePolygon_Deserializes(string cacheName, string cacheKey, bool cache) { var coordinates = new[] { new[] { new[] { 100.0, 0.0 }, new[] { 101.0, 0.0 }, new[] { 101.0, 1.0 }, new[] { 100.0, 1.0 }, new [] { 100.0, 0.0 } }, new[] { new[] { 100.2, 0.2 }, new[] { 100.8, 0.2 }, new[] { 100.8, 0.8 }, new[] { 100.2, 0.8 }, new [] { 100.2, 0.2 } } }; var geoBaseShapeFilter = this.SerializeThenDeserialize(cacheName, cacheKey, cache, f => f.GeoShape, f => f.GeoShapePolygon(p => p.Origin, d => d .Coordinates(coordinates) ) ); var filter = geoBaseShapeFilter as IGeoShapePolygonFilter; filter.Should().NotBeNull(); filter.Field.Should().Be("origin"); filter.Should().NotBeNull(); filter.Shape.Should().NotBeNull(); filter.Shape.Type.Should().Be("polygon"); filter.Shape.Coordinates.SelectMany(c => c.SelectMany(cc => cc)).Should() .BeEquivalentTo(coordinates.SelectMany(c => c.SelectMany(cc => cc))); }