private async Task SpatialBoundingBoxImplementation() { Cosmos.IndexingPolicy indexingPolicy = new Cosmos.IndexingPolicy() { Automatic = true, IncludedPaths = new Collection <Cosmos.IncludedPath>() { new Cosmos.IncludedPath() { Path = DefaultPath, } }, ExcludedPaths = new Collection <Cosmos.ExcludedPath>(), IndexingMode = Cosmos.IndexingMode.Consistent, SpatialIndexes = new Collection <Cosmos.SpatialPath>() { new Cosmos.SpatialPath { Path = "/location/?", SpatialTypes = new Collection <Cosmos.SpatialType>() { Cosmos.SpatialType.LineString, Cosmos.SpatialType.MultiPolygon, Cosmos.SpatialType.Point, Cosmos.SpatialType.Polygon, }, BoundingBox = new Cosmos.BoundingBoxProperties() { Xmin = 0, Ymin = 0, Xmax = 10, Ymax = 10, } }, new Cosmos.SpatialPath { Path = "/spatial/*", SpatialTypes = new Collection <Cosmos.SpatialType>() { Cosmos.SpatialType.Point }, BoundingBox = new Cosmos.BoundingBoxProperties() { Xmin = 0, Ymin = 0, Xmax = 10, Ymax = 10, } } } }; Cosmos.GeospatialConfig geospatialConfig = new Cosmos.GeospatialConfig(); geospatialConfig.GeospatialType = Cosmos.GeospatialType.Geometry; await IndexingPolicyTests.RoundTripWithLocal(indexingPolicy, geospatialConfig); }
private static async Task RoundTripWithLocal(Cosmos.IndexingPolicy indexingPolicy, Cosmos.GeospatialConfig geospatialConfig = null) { PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition { Paths = new System.Collections.ObjectModel.Collection <string>(new[] { "/id" }), Kind = PartitionKind.Hash }; ContainerProperties containerSetting = new ContainerProperties() { Id = Guid.NewGuid().ToString(), IndexingPolicy = indexingPolicy, PartitionKey = partitionKeyDefinition, GeospatialConfig = geospatialConfig }; Cosmos.Database cosmosDatabase = await cosmosClient.CreateDatabaseIfNotExistsAsync(IndexingPolicyTests.database.Id); ContainerResponse cosmosContainerResponse = await cosmosDatabase.CreateContainerAsync(containerSetting); Assert.IsTrue(IndexingPolicyTests.indexingPolicyEqualityComparer.Equals(indexingPolicy, containerSetting.IndexingPolicy)); }