From b52bd80d14ef886d1470274431e2e5000b5baa27 Mon Sep 17 00:00:00 2001 From: Darren Cunningham Date: Thu, 7 Nov 2024 11:32:54 -0500 Subject: [PATCH] allow cursor with query --- Fauna.Test/Integration.Tests.cs | 19 +++++++++---------- Fauna/IClient.cs | 5 ----- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Fauna.Test/Integration.Tests.cs b/Fauna.Test/Integration.Tests.cs index f84a5792..7b49c5ef 100644 --- a/Fauna.Test/Integration.Tests.cs +++ b/Fauna.Test/Integration.Tests.cs @@ -661,28 +661,27 @@ await _client.QueryAsync( } [Test, Category("EventFeed")] - public void ThrowsWhenQueryDoesntReturnEventSource() + public async Task CanUseCursorWithQuery() { - var ex = Assert.ThrowsAsync(async () => - await _client.EventFeedAsync(FQL($"42")) + var feed = await _client.EventFeedAsync( + FQL($"StreamingSandbox.all().eventSource()"), + feedOptions: new FeedOptions("abc1234==") ); - Assert.That(ex!.Message, Does.Contain("Query must return an EventSource.")); + Assert.NotNull(feed); } [Test, Category("EventFeed")] - public void ThrowsWhenAttemptingToUseCursorWithQuery() + public void ThrowsWhenQueryDoesntReturnEventSource() { var ex = Assert.ThrowsAsync(async () => - await _client.EventFeedAsync( - FQL($"StreamingSandbox.all().eventSource()"), - feedOptions: new FeedOptions("abc1234==") - ) + await _client.EventFeedAsync(FQL($"42")) ); - Assert.AreEqual("Cannot use Cursor when opening an EventFeed with a Query.", ex!.Message); + Assert.That(ex!.Message, Does.Contain("Query must return an EventSource.")); } + #endregion [Test] diff --git a/Fauna/IClient.cs b/Fauna/IClient.cs index 05dff6ce..afc294e9 100644 --- a/Fauna/IClient.cs +++ b/Fauna/IClient.cs @@ -652,11 +652,6 @@ public async Task> EventFeedAsync( FeedOptions? feedOptions = null, CancellationToken cancellationToken = default) where T : notnull { - if (feedOptions?.Cursor != null) - { - throw new InvalidOperationException("Cannot use Cursor when opening an EventFeed with a Query."); - } - EventSource eventSource = await GetEventSourceFromQueryAsync(query, null, cancellationToken); if (feedOptions != null) eventSource.Options = feedOptions;