diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs index ca1a864dbc..801a09fb52 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemLinqTests.cs @@ -881,7 +881,7 @@ async Task TestSearch(Expression> expression, string ex } [TestMethod] - public async Task LinqCountWithContinuationTokenTest() + public async Task LinqAggregatesWithContinuationTokenTest() { await ToDoActivity.CreateRandomItems(container: this.Container, pkCount: 1, perPKItemCount: 2, randomPartitionKey: true); @@ -909,67 +909,32 @@ public async Task LinqCountWithContinuationTokenTest() Assert.AreEqual(2, count); Assert.IsNotNull(continuationToken); - IOrderedQueryable secondQuery = this.Container.GetItemLinqQueryable(continuationToken: continuationToken, requestOptions: requestOptions); + IOrderedQueryable secondQuery = this.Container.GetItemLinqQueryable(allowSynchronousQueryExecution: true, continuationToken: continuationToken, requestOptions: requestOptions); try { count = await secondQuery.CountAsync(); + Assert.Fail("Expected Count query to return exception"); } catch (CosmosException exception) { Assert.IsTrue(exception.StatusCode == System.Net.HttpStatusCode.BadRequest); Assert.IsTrue(exception.SubStatusCode == (int)Documents.SubStatusCodes.MalformedContinuationToken); Assert.IsTrue(exception.Message.Contains("ParallelCrossPartitionQueryPipelineStage")); - return; } - Assert.Fail("Expect Count query to return exception"); - } - - [TestMethod] - public async Task LinqAverageWithContinuationTokenTest() - { - await ToDoActivity.CreateRandomItems(container: this.Container, pkCount: 1, perPKItemCount: 2, randomPartitionKey: true); - - QueryRequestOptions requestOptions = new QueryRequestOptions() - { - MaxItemCount = 1 - }; - - IOrderedQueryable firstQuery = this.Container.GetItemLinqQueryable(allowSynchronousQueryExecution: true, requestOptions: requestOptions); - - double average = firstQuery.Average(x => x.taskNum); - - string continuationToken = null; - - FeedIterator firstFeedIterator = firstQuery.ToFeedIterator(); - - // if instead of while loop in order to retrieve continuation token - if (firstFeedIterator.HasMoreResults) - { - FeedResponse firstFeedResponse = await firstFeedIterator.ReadNextAsync(); - - continuationToken = firstFeedResponse.ContinuationToken; - } - - Assert.IsNotNull(continuationToken); - - IOrderedQueryable secondQuery = this.Container.GetItemLinqQueryable(allowSynchronousQueryExecution: true, continuationToken: continuationToken, requestOptions: requestOptions); - try { - average = secondQuery.Average(x => x.taskNum); + secondQuery.Average(x => x.taskNum); + Assert.Fail("Expected Average query to return exception"); } catch (CosmosException exception) { Assert.IsTrue(exception.StatusCode == System.Net.HttpStatusCode.BadRequest); Assert.IsTrue(exception.SubStatusCode == (int)Documents.SubStatusCodes.MalformedContinuationToken); Assert.IsTrue(exception.Message.Contains("ParallelCrossPartitionQueryPipelineStage")); - return; } - - Assert.Fail("Expect Average query to return exception"); - } + } [TestMethod] public async Task LinqSelectEverythingWithoutQueryableTest()