public async Task AllowBatchingRequestsSendsToExecutor_Replace() { CosmosClient cosmosClient = MockCosmosUtil.CreateMockCosmosClient(); ClientContextCore clientContextCore = new ClientContextCore( cosmosClient, new CosmosClientOptions() { AllowBulkExecution = true }, new CosmosJsonDotNetSerializer(), new CosmosJsonDotNetSerializer(), null, cosmosClient.ResponseFactory, null, new MockDocumentClient() ); DatabaseCore db = new DatabaseCore(clientContextCore, "test"); ExecutorContainerCore container = new ExecutorContainerCore(clientContextCore, db, "test"); dynamic testItem = new { id = Guid.NewGuid().ToString(), pk = "FF627B77-568E-4541-A47E-041EAC10E46F", }; Cosmos.PartitionKey partitionKey = new Cosmos.PartitionKey(testItem.pk); ItemResponse <dynamic> response = await container.ReplaceItemAsync <dynamic>( testItem, testItem.id); container.MockedExecutor.Verify(c => c.AddAsync(It.IsAny <ItemBatchOperation>(), It.IsAny <ItemRequestOptions>(), It.IsAny <CancellationToken>()), Times.Once); }
public async Task AllowBatchingRequestsSendsToExecutor_Replace() { ClientContextCore clientContextCore = this.CreateMockBulkClientContextCore(); DatabaseCore db = new DatabaseCore(clientContextCore, "test"); ExecutorContainerCore container = new ExecutorContainerCore(clientContextCore, db, "test"); dynamic testItem = new { id = Guid.NewGuid().ToString(), pk = "FF627B77-568E-4541-A47E-041EAC10E46F", }; Cosmos.PartitionKey partitionKey = new Cosmos.PartitionKey(testItem.pk); ItemResponse <dynamic> response = await container.ReplaceItemAsync <dynamic>( testItem, testItem.id); container.MockedExecutor.Verify(c => c.AddAsync(It.IsAny <ItemBatchOperation>(), It.IsAny <ItemRequestOptions>(), It.IsAny <CancellationToken>()), Times.Once); }