public async Task BatchServerResponseTooLargeAsync() { Container container = BatchTestBase.JsonContainer; const int operationCount = 10; int appxDocSizeInBytes = 1 * 1024 * 1024; TestDoc doc = await BatchTestBase.CreateJsonTestDocAsync(container, this.PartitionKey1, appxDocSizeInBytes); TransactionalBatch batch = new BatchCore((ContainerCore)container, BatchTestBase.GetPartitionKey(this.PartitionKey1)); for (int i = 0; i < operationCount; i++) { batch.ReadItem(doc.Id); } TransactionalBatchResponse batchResponse = await batch.ExecuteAsync(); BatchSinglePartitionKeyTests.VerifyBatchProcessed( batchResponse, numberOfOperations: operationCount, expectedStatusCode: HttpStatusCode.RequestEntityTooLarge); Assert.AreEqual((int)StatusCodes.FailedDependency, (int)batchResponse[0].StatusCode); Assert.AreEqual(HttpStatusCode.RequestEntityTooLarge, batchResponse[operationCount - 1].StatusCode); }
public async Task BatchWithTooManyOperationsAsync() { Container container = BatchTestBase.JsonContainer; const int operationCount = Constants.MaxOperationsInDirectModeBatchRequest + 1; TransactionalBatch batch = new BatchCore((ContainerCore)container, new Cosmos.PartitionKey(this.PartitionKey1)); for (int i = 0; i < operationCount; i++) { batch.ReadItem("someId"); } TransactionalBatchResponse batchResponse = await batch.ExecuteAsync(); Assert.AreEqual(HttpStatusCode.BadRequest, batchResponse.StatusCode); }
public async Task BatchWithTooManyOperationsAsync() { Container container = BatchUnitTests.GetContainer(); const int operationCount = Constants.MaxOperationsInDirectModeBatchRequest + 1; Batch batch = new BatchCore((ContainerCore)container, new Cosmos.PartitionKey(BatchUnitTests.PartitionKey1)); for (int i = 0; i < operationCount; i++) { batch.ReadItem("someId"); } await BatchUnitTests.VerifyExceptionThrownOnExecuteAsync( batch, typeof(ArgumentException), ClientResources.BatchTooLarge); }