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);
        }
Exemple #2
0
        protected virtual async Task CreateJsonTestDocsAsync(Container container)
        {
            this.TestDocPk1ExistingA = await BatchTestBase.CreateJsonTestDocAsync(container, this.PartitionKey1);

            this.TestDocPk1ExistingB = await BatchTestBase.CreateJsonTestDocAsync(container, this.PartitionKey1);

            this.TestDocPk1ExistingC = await BatchTestBase.CreateJsonTestDocAsync(container, this.PartitionKey1);

            this.TestDocPk1ExistingD = await BatchTestBase.CreateJsonTestDocAsync(container, this.PartitionKey1);
        }