Exemple #1
0
        public async Task ExecuteAsync_ShouldScaleIfThrowTooLargeException(string database, string collection)
        {
            var funcAsync = new Mock <Func <IDocumentClient, Task <ResourceResponse <Document> > > >();

            funcAsync.Setup(x => x.Invoke(It.IsAny <IDocumentClient>())).Throws(_documentClientException);
            var previousOffer = await _documentClient.GetOfferAsync(database, collection);

            try
            {
                await _customDocumentClient.ExecuteAsync(funcAsync.Object, database, collection);
            }
            catch
            {
                // ignored
            }

            var newOffer = await _documentClient.GetOfferAsync(database, collection);

            Assert.IsTrue(newOffer.Content.OfferThroughput > previousOffer.Content.OfferThroughput);
        }
Exemple #2
0
        public static async Task ScaleAsync(this IDocumentClient documentClient, string database, string collection, int scaleBatch, int minThroughput, int maxThroughput)
        {
            var offer = await documentClient.GetOfferAsync(database, collection);

            await documentClient.ScaleAsync(offer, scaleBatch, minThroughput, maxThroughput);
        }