[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); } }
public async Task EncryptionBulkCrud() { TestDoc docToReplace = await EncryptionTests.CreateItemAsync(EncryptionTests.itemContainerCore, EncryptionTests.dekId, TestDoc.PathsToEncrypt); docToReplace.NonSensitive = Guid.NewGuid().ToString(); docToReplace.Sensitive = Guid.NewGuid().ToString(); TestDoc docToUpsert = await EncryptionTests.CreateItemAsync(EncryptionTests.itemContainerCore, EncryptionTests.dekId, TestDoc.PathsToEncrypt); docToUpsert.NonSensitive = Guid.NewGuid().ToString(); docToUpsert.Sensitive = Guid.NewGuid().ToString(); TestDoc docToDelete = await EncryptionTests.CreateItemAsync(EncryptionTests.itemContainerCore, EncryptionTests.dekId, TestDoc.PathsToEncrypt); (string endpoint, string authKey) = TestCommon.GetAccountInfo(); CosmosClient clientWithBulk = new CosmosClientBuilder(endpoint, authKey) .WithEncryptor(EncryptionTests.encryptor) .WithBulkExecution(true) .Build(); DatabaseInternal databaseWithBulk = (DatabaseInlineCore)clientWithBulk.GetDatabase(EncryptionTests.databaseCore.Id); ContainerInternal containerWithBulk = (ContainerInlineCore)databaseWithBulk.GetContainer(EncryptionTests.itemContainer.Id); List <Task> tasks = new List <Task>(); tasks.Add(EncryptionTests.CreateItemAsync(containerWithBulk, EncryptionTests.dekId, TestDoc.PathsToEncrypt)); tasks.Add(EncryptionTests.UpsertItemAsync(containerWithBulk, TestDoc.Create(), EncryptionTests.dekId, TestDoc.PathsToEncrypt, HttpStatusCode.Created)); tasks.Add(EncryptionTests.ReplaceItemAsync(containerWithBulk, docToReplace, EncryptionTests.dekId, TestDoc.PathsToEncrypt)); tasks.Add(EncryptionTests.UpsertItemAsync(containerWithBulk, docToUpsert, EncryptionTests.dekId, TestDoc.PathsToEncrypt, HttpStatusCode.OK)); tasks.Add(EncryptionTests.DeleteItemAsync(containerWithBulk, docToDelete)); await Task.WhenAll(tasks); }