From 9f05ee159a6c775622dd7926d1344abb4785f38e Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Tue, 3 Feb 2026 02:02:33 +0100 Subject: [PATCH] Optimization: skip COUNT query when pagination is disabled --- .../Services/InMemoryResourceService.cs | 82 ++--- .../CollectionConverter.cs | 19 ++ .../Queries/IQueryLayerComposer.cs | 2 + .../Queries/QueryLayerComposer.cs | 1 + .../Services/JsonApiResourceService.cs | 73 ++++- .../IntegrationTests/DapperTestContext.cs | 6 +- .../QueryStrings/FilterTests.cs | 291 ++---------------- .../QueryStrings/IncludeTests.cs | 24 +- .../QueryStrings/SortTests.cs | 81 +---- .../QueryStrings/SparseFieldSets.cs | 27 +- .../Relationships/FetchRelationshipTests.cs | 15 +- .../ReadWrite/Resources/FetchResourceTests.cs | 27 +- .../Sql/SubQueryInJoinTests.cs | 132 +------- .../Reading/ResourceDefinitionReadTests.cs | 71 +++-- 14 files changed, 216 insertions(+), 635 deletions(-) diff --git a/src/Examples/NoEntityFrameworkExample/Services/InMemoryResourceService.cs b/src/Examples/NoEntityFrameworkExample/Services/InMemoryResourceService.cs index 0dcc5d9905..847f512fbc 100644 --- a/src/Examples/NoEntityFrameworkExample/Services/InMemoryResourceService.cs +++ b/src/Examples/NoEntityFrameworkExample/Services/InMemoryResourceService.cs @@ -50,17 +50,27 @@ public Task> GetAsync(CancellationToken cancellat { LogFiltersInTopScope(); - if (SetPrimaryTotalCountIsZero()) + QueryLayer queryLayer = _queryLayerComposer.ComposeFromConstraints(_resourceType); + int? pageSize = queryLayer.Pagination?.PageSize?.Value; + + if (_options.IncludeTotalResourceCount && pageSize != null) { - return Task.FromResult>(Array.Empty()); - } + _paginationContext.TotalResourceCount = GetResourceCountForPrimaryEndpoint(queryLayer.Filter); - QueryLayer queryLayer = _queryLayerComposer.ComposeFromConstraints(_resourceType); + if (_paginationContext.TotalResourceCount == 0) + { + return Task.FromResult>(Array.Empty()); + } + } IEnumerable dataSource = GetDataSource(_resourceType).Cast(); TResource[] resources = _queryLayerToLinqConverter.ApplyQueryLayer(queryLayer, dataSource).ToArray(); - if (queryLayer.Pagination?.PageSize?.Value == resources.Length) + if (pageSize == null) + { + _paginationContext.TotalResourceCount = resources.Length; + } + else if (pageSize == resources.Length) { _paginationContext.IsPageFull = true; } @@ -91,27 +101,17 @@ private void LogFiltersInTopScope() } } - private bool SetPrimaryTotalCountIsZero() + private int GetResourceCountForPrimaryEndpoint(FilterExpression? filter) { - if (_options.IncludeTotalResourceCount) + var queryLayer = new QueryLayer(_resourceType) { - var queryLayer = new QueryLayer(_resourceType) - { - Filter = _queryLayerComposer.GetPrimaryFilterFromConstraints(_resourceType) - }; + Filter = filter + }; - IEnumerable dataSource = GetDataSource(_resourceType).Cast(); - IEnumerable resources = _queryLayerToLinqConverter.ApplyQueryLayer(queryLayer, dataSource); - - _paginationContext.TotalResourceCount = resources.Count(); - - if (_paginationContext.TotalResourceCount == 0) - { - return true; - } - } + IEnumerable dataSource = GetDataSource(_resourceType).Cast(); + IEnumerable resources = _queryLayerToLinqConverter.ApplyQueryLayer(queryLayer, dataSource); - return false; + return resources.Count(); } /// @@ -141,10 +141,14 @@ public Task GetAsync([DisallowNull] TId id, CancellationToken cancell throw new RelationshipNotFoundException(relationshipName, _resourceType.PublicName); } - SetNonPrimaryTotalCount(id, relationship); - QueryLayer secondaryLayer = _queryLayerComposer.ComposeFromConstraints(relationship.RightType); QueryLayer primaryLayer = _queryLayerComposer.WrapLayerForSecondaryEndpoint(secondaryLayer, _resourceType, id, relationship); + int? pageSize = secondaryLayer.Pagination?.PageSize?.Value; + + if (_options.IncludeTotalResourceCount && relationship is HasManyAttribute hasManyRelationship && pageSize != null) + { + SetResourceCountForNonPrimaryEndpoint(id, hasManyRelationship); + } IEnumerable dataSource = GetDataSource(_resourceType).Cast(); IEnumerable primaryResources = _queryLayerToLinqConverter.ApplyQueryLayer(primaryLayer, dataSource); @@ -157,31 +161,35 @@ public Task GetAsync([DisallowNull] TId id, CancellationToken cancell object? rightValue = relationship.GetValue(primaryResource); - if (rightValue is ICollection rightResources && secondaryLayer.Pagination?.PageSize?.Value == rightResources.Count) + if (rightValue is IEnumerable rightResources) { - _paginationContext.IsPageFull = true; + int resourceCount = rightResources.Cast().Count(); + + if (pageSize == null) + { + _paginationContext.TotalResourceCount = resourceCount; + } + else if (pageSize == resourceCount) + { + _paginationContext.IsPageFull = true; + } } return Task.FromResult(rightValue); } - private void SetNonPrimaryTotalCount([DisallowNull] TId id, RelationshipAttribute relationship) + private void SetResourceCountForNonPrimaryEndpoint([DisallowNull] TId id, HasManyAttribute relationship) { - if (_options.IncludeTotalResourceCount && relationship is HasManyAttribute hasManyRelationship) - { - FilterExpression? secondaryFilter = _queryLayerComposer.GetSecondaryFilterFromConstraints(id, hasManyRelationship); + FilterExpression? secondaryFilter = _queryLayerComposer.GetSecondaryFilterFromConstraints(id, relationship); - if (secondaryFilter == null) - { - return; - } - - var queryLayer = new QueryLayer(hasManyRelationship.RightType) + if (secondaryFilter != null) + { + var queryLayer = new QueryLayer(relationship.RightType) { Filter = secondaryFilter }; - IEnumerable dataSource = GetDataSource(hasManyRelationship.RightType); + IEnumerable dataSource = GetDataSource(relationship.RightType); IEnumerable resources = _queryLayerToLinqConverter.ApplyQueryLayer(queryLayer, dataSource); _paginationContext.TotalResourceCount = resources.Count(); diff --git a/src/JsonApiDotNetCore.Annotations/CollectionConverter.cs b/src/JsonApiDotNetCore.Annotations/CollectionConverter.cs index 683e34764b..45db83e695 100644 --- a/src/JsonApiDotNetCore.Annotations/CollectionConverter.cs +++ b/src/JsonApiDotNetCore.Annotations/CollectionConverter.cs @@ -60,6 +60,8 @@ public IEnumerable CopyToTypedCollection(IEnumerable source, Type collectionType /// private Type ToConcreteCollectionType(Type collectionType) { + ArgumentNullException.ThrowIfNull(collectionType); + if (collectionType is { IsInterface: true, IsGenericType: true }) { Type openCollectionType = collectionType.GetGenericTypeDefinition(); @@ -94,6 +96,23 @@ public IReadOnlyCollection ExtractResources(object? value) }; } + /// + /// Returns the number of elements in a collection of resources. + /// + public int GetCount(IEnumerable source) + { + ArgumentNullException.ThrowIfNull(source); + + return source switch + { + List resourceList => resourceList.Count, + HashSet resourceSet => resourceSet.Count, + IReadOnlyCollection resourceCollection => resourceCollection.Count, + IEnumerable resources => resources.Count(), + _ => source.Cast().Count() + }; + } + /// /// Returns the element type if the specified type is a generic collection, for example: -> string diff --git a/src/JsonApiDotNetCore/Queries/IQueryLayerComposer.cs b/src/JsonApiDotNetCore/Queries/IQueryLayerComposer.cs index 8b14590e83..da65dbedc5 100644 --- a/src/JsonApiDotNetCore/Queries/IQueryLayerComposer.cs +++ b/src/JsonApiDotNetCore/Queries/IQueryLayerComposer.cs @@ -14,6 +14,8 @@ public interface IQueryLayerComposer /// /// Builds a filter from constraints, used to determine total resource count on a primary collection endpoint. /// + [Obsolete("This method is no longer used and will be removed in a future version.")] + // ReSharper disable once UnusedMemberInSuper.Global FilterExpression? GetPrimaryFilterFromConstraints(ResourceType primaryResourceType); /// diff --git a/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs b/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs index c8fe4c5495..16ec95525b 100644 --- a/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs +++ b/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs @@ -44,6 +44,7 @@ public QueryLayerComposer(IEnumerable constraintProvid } /// + [Obsolete("This method is no longer used and will be removed in a future version.")] public FilterExpression? GetPrimaryFilterFromConstraints(ResourceType primaryResourceType) { // @formatter:wrap_chained_method_calls chop_always diff --git a/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs b/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs index de5d3b7b1f..5a140047f4 100644 --- a/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs +++ b/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs @@ -62,10 +62,12 @@ public virtual async Task> GetAsync(CancellationT using IDisposable _ = CodeTimingSessionManager.Current.Measure("Service - Get resources"); - if (_options.IncludeTotalResourceCount) + QueryLayer queryLayer = _queryLayerComposer.ComposeFromConstraints(_request.PrimaryResourceType); + int? pageSize = queryLayer.Pagination?.PageSize?.Value; + + if (_options.IncludeTotalResourceCount && pageSize != null) { - FilterExpression? topFilter = _queryLayerComposer.GetPrimaryFilterFromConstraints(_request.PrimaryResourceType); - _paginationContext.TotalResourceCount = await _repositoryAccessor.CountAsync(_request.PrimaryResourceType, topFilter, cancellationToken); + _paginationContext.TotalResourceCount = await _repositoryAccessor.CountAsync(_request.PrimaryResourceType, queryLayer.Filter, cancellationToken); if (_paginationContext.TotalResourceCount == 0) { @@ -73,10 +75,13 @@ public virtual async Task> GetAsync(CancellationT } } - QueryLayer queryLayer = _queryLayerComposer.ComposeFromConstraints(_request.PrimaryResourceType); IReadOnlyCollection resources = await _repositoryAccessor.GetAsync(queryLayer, cancellationToken); - if (queryLayer.Pagination?.PageSize?.Value == resources.Count) + if (pageSize == null) + { + _paginationContext.TotalResourceCount = resources.Count; + } + else if (pageSize == resources.Count) { _paginationContext.IsPageFull = true; } @@ -107,12 +112,17 @@ public virtual async Task GetAsync([DisallowNull] TId id, Cancellatio }); ArgumentNullException.ThrowIfNull(relationshipName); - AssertPrimaryResourceTypeInJsonApiRequestIsNotNull(_request.PrimaryResourceType); AssertHasRelationship(_request.Relationship, relationshipName); + AssertPrimaryResourceTypeInJsonApiRequestIsNotNull(_request.PrimaryResourceType); + AssertSecondaryResourceTypeInJsonApiRequestIsNotNull(_request.SecondaryResourceType); using IDisposable _ = CodeTimingSessionManager.Current.Measure("Service - Get secondary resource(s)"); - if (_options.IncludeTotalResourceCount && _request.IsCollection) + QueryLayer secondaryLayer = _queryLayerComposer.ComposeFromConstraints(_request.SecondaryResourceType); + QueryLayer primaryLayer = _queryLayerComposer.WrapLayerForSecondaryEndpoint(secondaryLayer, _request.PrimaryResourceType, id, _request.Relationship); + int? pageSize = secondaryLayer.Pagination?.PageSize?.Value; + + if (_options.IncludeTotalResourceCount && _request.IsCollection && pageSize != null) { await RetrieveResourceCountForNonPrimaryEndpointAsync(id, (HasManyAttribute)_request.Relationship, cancellationToken); @@ -120,8 +130,6 @@ public virtual async Task GetAsync([DisallowNull] TId id, Cancellatio // the parent resource exists. In case the parent does not exist, an error is produced below. } - QueryLayer secondaryLayer = _queryLayerComposer.ComposeFromConstraints(_request.SecondaryResourceType!); - QueryLayer primaryLayer = _queryLayerComposer.WrapLayerForSecondaryEndpoint(secondaryLayer, _request.PrimaryResourceType, id, _request.Relationship); IReadOnlyCollection primaryResources = await _repositoryAccessor.GetAsync(primaryLayer, cancellationToken); TResource? primaryResource = primaryResources.SingleOrDefault(); @@ -129,9 +137,18 @@ public virtual async Task GetAsync([DisallowNull] TId id, Cancellatio object? rightValue = _request.Relationship.GetValue(primaryResource); - if (rightValue is ICollection rightResources && secondaryLayer.Pagination?.PageSize?.Value == rightResources.Count) + if (rightValue is IEnumerable rightResources) { - _paginationContext.IsPageFull = true; + int resourceCount = CollectionConverter.Instance.GetCount(rightResources); + + if (pageSize == null) + { + _paginationContext.TotalResourceCount = resourceCount; + } + else if (pageSize == resourceCount) + { + _paginationContext.IsPageFull = true; + } } return rightValue; @@ -147,12 +164,17 @@ public virtual async Task GetAsync([DisallowNull] TId id, Cancellatio }); ArgumentNullException.ThrowIfNull(relationshipName); - AssertPrimaryResourceTypeInJsonApiRequestIsNotNull(_request.PrimaryResourceType); AssertHasRelationship(_request.Relationship, relationshipName); + AssertPrimaryResourceTypeInJsonApiRequestIsNotNull(_request.PrimaryResourceType); + AssertSecondaryResourceTypeInJsonApiRequestIsNotNull(_request.SecondaryResourceType); using IDisposable _ = CodeTimingSessionManager.Current.Measure("Service - Get relationship"); - if (_options.IncludeTotalResourceCount && _request.IsCollection) + QueryLayer secondaryLayer = _queryLayerComposer.ComposeSecondaryLayerForRelationship(_request.SecondaryResourceType); + QueryLayer primaryLayer = _queryLayerComposer.WrapLayerForSecondaryEndpoint(secondaryLayer, _request.PrimaryResourceType, id, _request.Relationship); + int? pageSize = secondaryLayer.Pagination?.PageSize?.Value; + + if (_options.IncludeTotalResourceCount && _request.IsCollection && pageSize != null) { await RetrieveResourceCountForNonPrimaryEndpointAsync(id, (HasManyAttribute)_request.Relationship, cancellationToken); @@ -160,8 +182,6 @@ public virtual async Task GetAsync([DisallowNull] TId id, Cancellatio // the parent resource exists. In case the parent does not exist, an error is produced below. } - QueryLayer secondaryLayer = _queryLayerComposer.ComposeSecondaryLayerForRelationship(_request.SecondaryResourceType!); - QueryLayer primaryLayer = _queryLayerComposer.WrapLayerForSecondaryEndpoint(secondaryLayer, _request.PrimaryResourceType, id, _request.Relationship); IReadOnlyCollection primaryResources = await _repositoryAccessor.GetAsync(primaryLayer, cancellationToken); TResource? primaryResource = primaryResources.SingleOrDefault(); @@ -169,9 +189,18 @@ public virtual async Task GetAsync([DisallowNull] TId id, Cancellatio object? rightValue = _request.Relationship.GetValue(primaryResource); - if (rightValue is ICollection rightResources && secondaryLayer.Pagination?.PageSize?.Value == rightResources.Count) + if (rightValue is IEnumerable rightResources) { - _paginationContext.IsPageFull = true; + int resourceCount = CollectionConverter.Instance.GetCount(rightResources); + + if (pageSize == null) + { + _paginationContext.TotalResourceCount = resourceCount; + } + else if (pageSize == resourceCount) + { + _paginationContext.IsPageFull = true; + } } return rightValue; @@ -677,6 +706,16 @@ private void AssertPrimaryResourceTypeInJsonApiRequestIsNotNull([SysNotNull] Res } } + [AssertionMethod] + private void AssertSecondaryResourceTypeInJsonApiRequestIsNotNull([SysNotNull] ResourceType? resourceType) + { + if (resourceType == null) + { + throw new InvalidOperationException( + $"Expected {nameof(IJsonApiRequest)}.{nameof(IJsonApiRequest.SecondaryResourceType)} not to be null at this point."); + } + } + [AssertionMethod] private void AssertRelationshipInJsonApiRequestIsNotNull([SysNotNull] RelationshipAttribute? relationship) { diff --git a/test/DapperTests/IntegrationTests/DapperTestContext.cs b/test/DapperTests/IntegrationTests/DapperTestContext.cs index 2156902f98..ea59dc895e 100644 --- a/test/DapperTests/IntegrationTests/DapperTestContext.cs +++ b/test/DapperTests/IntegrationTests/DapperTestContext.cs @@ -81,11 +81,7 @@ private WebApplicationFactory CreateFactory() builder.ConfigureServices(services => { services.Replace(ServiceDescriptor.Singleton(new FrozenTimeProvider(FrozenTime))); - - ServiceDescriptor scopedCaptureStore = services.Single(descriptor => descriptor.ImplementationType == typeof(SqlCaptureStore)); - services.Remove(scopedCaptureStore); - - services.AddSingleton(); + services.Replace(ServiceDescriptor.Singleton()); }); }); } diff --git a/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs index c303d70341..6efc9db590 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs @@ -56,22 +56,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "Tags" AS t1 - LEFT JOIN "RgbColors" AS t2 ON t1."Id" = t2."TagId" - WHERE t2."Id" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", 0x00FF00); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."Name" @@ -120,23 +107,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "Tags" AS t1 - LEFT JOIN "RgbColors" AS t2 ON t1."Id" = t2."TagId" - WHERE t2."Id" IN (@p1, @p2) - """)); - - command.Parameters.Should().HaveCount(2); - command.Parameters.Should().Contain("@p1", 0x00FF00); - command.Parameters.Should().Contain("@p2", 0x11EE11); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."Name" @@ -182,23 +155,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id" - LEFT JOIN "People" AS t3 ON t1."AssigneeId" = t3."Id" - WHERE (t2."Id" = @p1) AND (t3."Id" IS NULL) - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", person.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority" @@ -249,22 +208,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id" - WHERE (t2."Id" = @p1) AND (t1."DurationInHours" IS NULL) - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", person.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority" @@ -317,21 +263,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - WHERE t1."Priority" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", todoItems[1].Priority); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -379,23 +313,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id" - WHERE (t2."Id" = @p1) AND (t1."Description" = @p2) - """)); - - command.Parameters.Should().HaveCount(2); - command.Parameters.Should().Contain("@p1", person.Id); - command.Parameters.Should().Contain("@p2", person.AssignedTodoItems.ElementAt(1).Description); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority" @@ -449,21 +369,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id" - WHERE t2."LastName" = t2."FirstName" - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -510,23 +418,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id" - WHERE (t2."Id" = @p1) AND (t1."Priority" = @p2) - """)); - - command.Parameters.Should().HaveCount(2); - command.Parameters.Should().Contain("@p1", person.Id); - command.Parameters.Should().Contain("@p2", TodoItemPriority.Medium); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority" @@ -578,21 +472,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - WHERE t1."Description" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", "X"); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -640,21 +522,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - WHERE (NOT (t1."FirstName" = @p1)) OR (t1."FirstName" IS NULL) - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", "X"); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName" @@ -702,23 +572,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id" - WHERE (NOT ((t2."FirstName" = @p1) AND (t2."LastName" = @p2))) OR (t2."FirstName" IS NULL) OR (t2."LastName" IS NULL) - """)); - - command.Parameters.Should().HaveCount(2); - command.Parameters.Should().Contain("@p1", "X"); - command.Parameters.Should().Contain("@p2", "Y"); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -771,24 +627,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id" - WHERE (t1."Description" LIKE 'T%') AND (NOT (t1."Description" IN (@p1, @p2))) AND (t2."FirstName" = @p3) AND (t1."Description" LIKE '%o%') - """)); - - command.Parameters.Should().HaveCount(3); - command.Parameters.Should().Contain("@p1", "Four"); - command.Parameters.Should().Contain("@p2", "Three"); - command.Parameters.Should().Contain("@p3", "Jack"); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -845,20 +686,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(5); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "Tags" AS t1 - WHERE (t1."Name" LIKE '%A\%%' ESCAPE '\') OR (t1."Name" LIKE '%A\_%' ESCAPE '\') OR (t1."Name" LIKE '%A\\%' ESCAPE '\') OR (t1."Name" LIKE '%A''%') OR (t1."Name" LIKE '%\%\_\\''%' ESCAPE '\') - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."Name" @@ -906,22 +736,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - WHERE (t1."DurationInHours" > @p1) OR (t1."DurationInHours" <= @p2) - """)); - - command.Parameters.Should().HaveCount(2); - command.Parameters.Should().Contain("@p1", 250); - command.Parameters.Should().Contain("@p2", 100); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -970,27 +787,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t4 ON t1."OwnerId" = t4."Id" - WHERE (( - SELECT COUNT(*) - FROM "People" AS t2 - LEFT JOIN "TodoItems" AS t3 ON t2."Id" = t3."AssigneeId" - WHERE t1."OwnerId" = t2."Id" - ) > @p1) AND (NOT (t4."Id" IS NULL)) - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", 1); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -1054,33 +853,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - WHERE EXISTS ( - SELECT 1 - FROM "People" AS t2 - LEFT JOIN "TodoItems" AS t3 ON t2."Id" = t3."AssigneeId" - INNER JOIN "People" AS t5 ON t3."OwnerId" = t5."Id" - WHERE (t1."OwnerId" = t2."Id") AND (EXISTS ( - SELECT 1 - FROM "Tags" AS t4 - WHERE (t3."Id" = t4."TodoItemId") AND (t4."Name" = @p1) - )) AND (t5."LastName" = @p2) AND (t3."Description" = @p3) - ) - """)); - - command.Parameters.Should().HaveCount(3); - command.Parameters.Should().Contain("@p1", "Personal"); - command.Parameters.Should().Contain("@p2", "Smith"); - command.Parameters.Should().Contain("@p3", "Homework"); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -1144,25 +919,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - WHERE EXISTS ( - SELECT 1 - FROM "TodoItems" AS t2 - LEFT JOIN "People" AS t3 ON t2."AssigneeId" = t3."Id" - WHERE (t1."Id" = t2."OwnerId") AND (NOT (t3."Id" IS NULL)) AND (t3."FirstName" IS NULL) - ) - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName" @@ -1232,23 +991,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(3); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - WHERE (t1."Description" = @p1) AND ((t1."Priority" = @p2) OR (t1."DurationInHours" = @p3)) - """)); - - command.Parameters.Should().HaveCount(3); - command.Parameters.Should().Contain("@p1", "1"); - command.Parameters.Should().Contain("@p2", TodoItemPriority.High); - command.Parameters.Should().Contain("@p3", 1); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" diff --git a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs index 0aa63dff83..e0932b3224 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs @@ -144,19 +144,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName", t3."Id", t3."FirstName", t3."LastName", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority", t5."Id", t5."Name" @@ -212,19 +202,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(25); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."Name", t3."Id" diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs index 6a155d1524..2b3aa2d3ae 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs @@ -56,19 +56,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Id.Should().Be(todoItems[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(todoItems[1].StringId); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -124,22 +114,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).Tags.ElementAt(1).StringId); responseDocument.Included[1].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).Tags.ElementAt(0).StringId); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id" - WHERE t2."Id" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", person.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority", t3."Id", t3."Name" @@ -190,19 +167,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Id.Should().Be(todoItems[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(todoItems[1].StringId); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -253,22 +220,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Id.Should().Be(person.OwnedTodoItems.ElementAt(0).StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id" - WHERE t2."Id" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", person.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority" @@ -322,22 +276,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Id.Should().Be(person.OwnedTodoItems.ElementAt(0).StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id" - WHERE t2."Id" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", person.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority", t4."Id", t4."Name" @@ -397,19 +338,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[2].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); responseDocument.Included[3].Id.Should().Be(person.OwnedTodoItems.ElementAt(3).StringId); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority" diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs index a1d4524c92..456f3d4016 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs @@ -84,19 +84,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(todoItem.Assignee.LastName); responseDocument.Included[1].Relationships.Should().BeNull(); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."Description", t1."DurationInHours", t2."Id", t2."LastName", t3."Id", t3."LastName" @@ -193,22 +183,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.Value.Should().BeNull(); }); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "Tags" AS t1 - LEFT JOIN "TodoItems" AS t2 ON t1."TodoItemId" = t2."Id" - WHERE t2."Id" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", todoItem.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t2."Id" diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs index eeb2c3e786..b4abe077b8 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs @@ -146,22 +146,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "Tags" AS t1 - LEFT JOIN "TodoItems" AS t2 ON t1."TodoItemId" = t2."Id" - WHERE t2."Id" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", todoItem.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t2."Id" diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs index 40a3345a96..f548f2b35d 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs @@ -70,19 +70,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority" @@ -224,22 +214,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "Tags" AS t1 - LEFT JOIN "TodoItems" AS t2 ON t1."TodoItemId" = t2."Id" - WHERE t2."Id" = @p1 - """)); - - command.Parameters.Should().HaveCount(1); - command.Parameters.Should().Contain("@p1", todoItem.Id); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t2."Id", t2."Name" diff --git a/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs b/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs index 9b6e62f39b..f2f6694fa6 100644 --- a/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs +++ b/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs @@ -44,19 +44,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."LastUsedAt", t2."UserName" @@ -92,19 +82,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority" @@ -141,19 +121,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority" @@ -190,19 +160,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority" @@ -243,19 +203,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority", t4."Id", t4."Name" @@ -299,19 +249,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "TodoItems" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority", t5."Id", t5."Name", t6."Id", t6."CreatedAt", t6."Description", t6."DurationInHours", t6."LastModifiedAt", t6."Priority", t8."Id", t8."Name" @@ -360,19 +300,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority" @@ -414,19 +344,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority" @@ -471,19 +391,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority" @@ -530,19 +440,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t5."Id", t5."CreatedAt", t5."Description", t5."DurationInHours", t5."LastModifiedAt", t5."Priority", t5.Id0 AS Id, t5."Name" @@ -591,19 +491,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.Should().HaveCount(2); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => - { - command.Statement.Should().Be(_testContext.AdaptSql(""" - SELECT COUNT(*) - FROM "People" AS t1 - """)); - - command.Parameters.Should().BeEmpty(); - }); - - store.SqlCommands[1].With(command => { command.Statement.Should().Be(_testContext.AdaptSql(""" SELECT t1."Id", t1."FirstName", t1."LastName", t7."Id", t7."CreatedAt", t7."Description", t7."DurationInHours", t7."LastModifiedAt", t7."Priority", t7.Id00 AS Id, t7."Name" diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs index c6cc458ce0..f1ebae2653 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs @@ -43,6 +43,43 @@ public ResourceDefinitionReadTests(IntegrationTestContext(); + + Constellation constellation = _fakers.Constellation.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Constellations.Add(constellation); + await dbContext.SaveChangesAsync(); + }); + + const string route = "/constellations?page[size]=0"; + + // Act + (HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync(route); + + // Assert + httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); + + responseDocument.Meta.Should().ContainTotal(1); + + hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] + { + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyPagination), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplySort), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyIncludes), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.GetMeta) + }, options => options.WithStrictOrdering()); + } + [Fact] public async Task Include_from_resource_definition_is_blocked() { @@ -78,7 +115,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -243,7 +279,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -298,7 +333,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -345,8 +379,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), - (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -354,6 +386,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyIncludes), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Planet), ResourceDefinitionExtensibilityPoints.GetMeta), (typeof(Planet), ResourceDefinitionExtensibilityPoints.GetMeta) @@ -396,8 +430,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), - (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -405,7 +437,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyIncludes), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter) + (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter) }, options => options.WithStrictOrdering()); } @@ -442,7 +476,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -450,6 +483,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyIncludes), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Planet), ResourceDefinitionExtensibilityPoints.GetMeta) }, options => options.WithStrictOrdering()); @@ -493,15 +527,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter), - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySort), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyIncludes), (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), - (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter) + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter) }, options => options.WithStrictOrdering()); } @@ -538,7 +572,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -546,6 +579,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplyIncludes), (typeof(Planet), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), + (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter) }, options => options.WithStrictOrdering()); } @@ -588,8 +622,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter), - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -597,7 +629,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyIncludes), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplySparseFieldSet), - (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter) + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Constellation), ResourceDefinitionExtensibilityPoints.OnApplyFilter), + (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter) }, options => options.WithStrictOrdering()); } @@ -640,7 +674,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -692,7 +725,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -732,7 +764,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { - (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Star), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -944,7 +975,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnRegisterQueryableHandlersForQueryStringParameters), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnRegisterQueryableHandlersForQueryStringParameters), - (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplySort), @@ -1001,7 +1031,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnRegisterQueryableHandlersForQueryStringParameters), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnRegisterQueryableHandlersForQueryStringParameters), - (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplyPagination), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplyFilter), (typeof(Moon), ResourceDefinitionExtensibilityPoints.OnApplySort),