[TestCategory("Quarantine")] // Not currently working with emulator public async Task CreateDropAutoscaleContainerStreamApi() { DatabaseInternal database = (DatabaseInlineCore)await this.cosmosClient.CreateDatabaseAsync( Guid.NewGuid().ToString()); ThroughputResponse databaseThroughput = await database.ReadThroughputIfExistsAsync(requestOptions : null); Assert.IsNotNull(databaseThroughput); Assert.AreEqual(HttpStatusCode.NotFound, databaseThroughput.StatusCode); string streamContainerId = Guid.NewGuid().ToString(); using (ResponseMessage response = await database.CreateContainerStreamAsync( new ContainerProperties(streamContainerId, "/pk"), ThroughputProperties.CreateAutoscaleThroughput(5000))) { Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); ContainerInternal streamContainer = (ContainerInlineCore)database.GetContainer(streamContainerId); ThroughputResponse autoscaleIfExists = await streamContainer.ReadThroughputIfExistsAsync( requestOptions : null, default(CancellationToken)); Assert.IsNotNull(autoscaleIfExists); Assert.AreEqual(5000, autoscaleIfExists.Resource.AutoscaleMaxThroughput); } }
[TestCategory("Quarantine")] // Not currently working with emulator public async Task ContainerAutoscaleIfExistsTest() { DatabaseInternal database = (DatabaseInlineCore)await this.cosmosClient.CreateDatabaseAsync( nameof(CreateDropAutoscaleDatabase) + Guid.NewGuid().ToString()); Container container = await database.CreateContainerAsync( containerProperties : new ContainerProperties("Test", "/id"), throughputProperties : ThroughputProperties.CreateAutoscaleThroughput(5000)); ContainerInternal containerCore = (ContainerInlineCore)container; ThroughputResponse throughputResponse = await database.ReadThroughputIfExistsAsync(requestOptions : null); Assert.IsNotNull(throughputResponse); Assert.AreEqual(HttpStatusCode.NotFound, throughputResponse.StatusCode); Assert.IsNull(throughputResponse.Resource); throughputResponse = await database.ReplaceThroughputPropertiesIfExistsAsync( ThroughputProperties.CreateAutoscaleThroughput(6000)); Assert.IsNotNull(throughputResponse); Assert.AreEqual(HttpStatusCode.NotFound, throughputResponse.StatusCode); Assert.IsNull(throughputResponse.Resource); throughputResponse = await containerCore.ReadThroughputIfExistsAsync( requestOptions : null, default(CancellationToken)); Assert.IsNotNull(throughputResponse); Assert.IsTrue(throughputResponse.Resource.Throughput > 400); Assert.AreEqual(5000, throughputResponse.Resource.AutoscaleMaxThroughput); throughputResponse = await containerCore.ReplaceThroughputIfExistsAsync( ThroughputProperties.CreateAutoscaleThroughput(6000), requestOptions : null, default(CancellationToken)); Assert.IsNotNull(throughputResponse); Assert.IsTrue(throughputResponse.Resource.Throughput > 400); Assert.AreEqual(6000, throughputResponse.Resource.AutoscaleMaxThroughput); await database.DeleteAsync(); }