Exemplo n.º 1
0
        private static async Task VerifyServerRequestCreationsByCountAsync(
            int expectedOperationCount,
            int operationCount,
            int docSizeInBytes)
        {
            int maxServerRequestBodyLength     = int.MaxValue;
            int maxServerRequestOperationCount = expectedOperationCount;

            (PartitionKeyRangeServerBatchRequest request, ArraySegment <ItemBatchOperation> overflow) = await PartitionKeyRangeServerBatchRequestTests.GetBatchWithCreateOperationsAsync(operationCount, maxServerRequestBodyLength, maxServerRequestOperationCount, docSizeInBytes);

            Assert.AreEqual(expectedOperationCount, request.Operations.Count);
            Assert.AreEqual(overflow.Count, operationCount - request.Operations.Count);
        }
Exemplo n.º 2
0
        private static async Task VerifyServerRequestCreationsBySizeAsync(
            int expectedOperationCount,
            int operationCount,
            int docSizeInBytes)
        {
            const int perRequestOverheadEstimateInBytes = 30;
            const int perDocOverheadEstimateInBytes     = 50;
            int       maxServerRequestBodyLength        = ((docSizeInBytes + perDocOverheadEstimateInBytes) * expectedOperationCount) + perRequestOverheadEstimateInBytes;
            int       maxServerRequestOperationCount    = int.MaxValue;

            (PartitionKeyRangeServerBatchRequest request, ArraySegment <ItemBatchOperation> overflow) = await PartitionKeyRangeServerBatchRequestTests.GetBatchWithCreateOperationsAsync(operationCount, maxServerRequestBodyLength, maxServerRequestOperationCount, docSizeInBytes);

            Assert.AreEqual(expectedOperationCount, request.Operations.Count);
            Assert.AreEqual(overflow.Count, operationCount - request.Operations.Count);
        }