Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static TryCatch<IQueryPipelineStage> MonadicCreate(
top = 0;
}

if (top > int.MaxValue)
if (queryInfo.HasTop && (top > int.MaxValue))
{
throw new ArgumentOutOfRangeException(nameof(queryInfo.Top.Value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,26 @@ public async Task LinqSelectEverythingWithoutQueryableTest()
Assert.AreEqual(2, (await this.FetchResults<ToDoActivity>(queryDefinition)).Count);
}

[TestMethod]
public async Task LinqSkipOrderBy()
{
IList<ToDoActivity> itemList = await ToDoActivity.CreateRandomItems(this.Container, 3, randomPartitionKey: true);
IQueryable<ToDoActivity> queryable = this.Container.GetItemLinqQueryable<ToDoActivity>()
.OrderBy(x => x.cost)
.Skip(1);

FeedIterator<ToDoActivity> feedIterator = queryable.ToFeedIterator();

int count = 0;
while (feedIterator.HasMoreResults)
{
FeedResponse<ToDoActivity> feedResponse = feedIterator.ReadNextAsync().Result;
count += feedResponse.Count;
}

Assert.AreEqual(2, count);
}

private class NumberLinqItem
{
public string id;
Expand Down
Loading