From d1c16e972e7eba97dd6a2e62890e1ab23a13b6ad Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sun, 2 Mar 2025 09:21:23 +0100 Subject: [PATCH 1/8] Update Resharper --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 4ae453e0c4..c1d943c0d0 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2024.3.5", + "version": "2024.3.6", "commands": [ "jb" ], From 7a06d60d7f2cad2298c3c3a2509577aeae6c80fc Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:27:19 +0100 Subject: [PATCH 2/8] Update FluentAssertions package --- package-versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-versions.props b/package-versions.props index 2a26bd7b7a..e7c32c98fa 100644 --- a/package-versions.props +++ b/package-versions.props @@ -11,7 +11,7 @@ 4.12.* 6.0.* 2.1.* - 7.0.* + 7.2.* 2.4.* 2.0.* 9.0.* From e3534881ca464a085807e0a36fa867ef256921c4 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:33:03 +0100 Subject: [PATCH 3/8] Remove ShouldHaveCount --- .../AtomicOperations/AtomicOperationsTests.cs | 50 +++---- .../QueryStrings/FilterTests.cs | 134 +++++++++--------- .../QueryStrings/IncludeTests.cs | 16 +-- .../QueryStrings/PaginationTests.cs | 2 +- .../QueryStrings/SortTests.cs | 40 +++--- .../QueryStrings/SparseFieldSets.cs | 52 +++---- .../AddToToManyRelationshipTests.cs | 6 +- .../Relationships/FetchRelationshipTests.cs | 18 +-- .../RemoveFromToManyRelationshipTests.cs | 20 +-- .../ReplaceToManyRelationshipTests.cs | 40 +++--- .../UpdateToOneRelationshipTests.cs | 104 +++++++------- .../Resources/CreateResourceTests.cs | 52 +++---- .../Resources/DeleteResourceTests.cs | 14 +- .../ReadWrite/Resources/FetchResourceTests.cs | 30 ++-- .../Resources/UpdateResourceTests.cs | 30 ++-- .../Sql/SubQueryInJoinTests.cs | 22 +-- .../Archiving/ArchiveTests.cs | 30 ++-- ...tomConstrainedOperationsControllerTests.cs | 8 +- ...ultConstrainedOperationsControllerTests.cs | 4 +- .../Creating/AtomicCreateResourceTests.cs | 42 +++--- ...reateResourceWithClientGeneratedIdTests.cs | 16 +-- ...eateResourceWithToManyRelationshipTests.cs | 30 ++-- ...reateResourceWithToOneRelationshipTests.cs | 28 ++-- .../Deleting/AtomicDeleteResourceTests.cs | 16 +-- .../Links/AtomicAbsoluteLinksTests.cs | 4 +- .../AtomicRelativeLinksWithNamespaceTests.cs | 2 +- .../LocalIds/AtomicLocalIdTests.cs | 78 +++++----- .../Meta/AtomicResourceMetaTests.cs | 10 +- .../Meta/AtomicResponseMetaTests.cs | 8 +- .../Mixed/AtomicLoggingTests.cs | 4 +- .../Mixed/AtomicRequestBodyTests.cs | 14 +- .../Mixed/MaximumOperationsPerRequestTests.cs | 2 +- .../AtomicModelStateValidationTests.cs | 18 +-- .../QueryStrings/AtomicQueryStringTests.cs | 16 +-- ...micSerializationResourceDefinitionTests.cs | 12 +- ...icSparseFieldSetResourceDefinitionTests.cs | 4 +- .../Transactions/AtomicRollbackTests.cs | 4 +- .../AtomicTransactionConsistencyTests.cs | 6 +- .../AtomicAddToToManyRelationshipTests.cs | 44 +++--- ...AtomicRemoveFromToManyRelationshipTests.cs | 46 +++--- .../AtomicReplaceToManyRelationshipTests.cs | 50 +++---- .../AtomicUpdateToOneRelationshipTests.cs | 48 +++---- .../AtomicReplaceToManyRelationshipTests.cs | 32 ++--- .../Resources/AtomicUpdateResourceTests.cs | 56 ++++---- .../AtomicUpdateToOneRelationshipTests.cs | 32 ++--- .../Scopes/ScopeOperationsTests.cs | 18 +-- .../Authorization/Scopes/ScopeReadTests.cs | 26 ++-- .../Authorization/Scopes/ScopeWriteTests.cs | 20 +-- .../CompositeKeys/CompositeKeyTests.cs | 18 +-- .../ContentNegotiation/AcceptHeaderTests.cs | 6 +- .../ContentTypeHeaderTests.cs | 20 +-- .../CustomExtensionsAcceptHeaderTests.cs | 2 +- .../CustomExtensionsContentTypeTests.cs | 4 +- .../ActionResultTests.cs | 10 +- .../ApiControllerAttributeLogTests.cs | 2 +- .../ApiControllerAttributeTests.cs | 4 +- .../CustomRoutes/CustomRouteTests.cs | 2 +- .../EagerLoading/EagerLoadingTests.cs | 16 +-- .../ExceptionHandlerTests.cs | 10 +- .../HostingInIIS/HostingTests.cs | 8 +- .../IdObfuscation/IdObfuscationTests.cs | 24 ++-- .../ModelState/ModelStateValidationTests.cs | 18 +-- .../ModelState/NoModelStateValidationTests.cs | 2 +- .../RequestBody/WorkflowTests.cs | 4 +- .../Links/AbsoluteLinksWithNamespaceTests.cs | 12 +- .../AbsoluteLinksWithoutNamespaceTests.cs | 12 +- .../Links/LinkInclusionIncludeTests.cs | 2 +- .../Links/LinkInclusionTests.cs | 2 +- .../Links/RelativeLinksWithNamespaceTests.cs | 12 +- .../RelativeLinksWithoutNamespaceTests.cs | 12 +- .../Meta/ResourceMetaTests.cs | 4 +- .../FireForgetTests.Group.cs | 18 +-- .../FireForgetTests.User.cs | 22 +-- .../FireAndForgetDelivery/FireForgetTests.cs | 6 +- .../OutboxTests.Group.cs | 18 +-- .../OutboxTests.User.cs | 22 +-- .../TransactionalOutboxPattern/OutboxTests.cs | 2 +- .../MultiTenancy/MultiTenancyTests.cs | 48 +++---- .../NamingConventions/KebabCasingTests.cs | 12 +- .../NamingConventions/PascalCasingTests.cs | 12 +- .../IsUpperCaseFilterParseTests.cs | 2 +- .../IsUpperCase/IsUpperCaseFilterTests.cs | 8 +- .../StringLength/LengthFilterParseTests.cs | 2 +- .../StringLength/LengthFilterTests.cs | 8 +- .../StringLength/LengthSortParseTests.cs | 2 +- .../StringLength/LengthSortTests.cs | 8 +- .../Sum/SumFilterParseTests.cs | 2 +- .../CustomFunctions/Sum/SumFilterTests.cs | 8 +- .../TimeOffset/TimeOffsetTests.cs | 14 +- .../Filtering/FilterDataTypeTests.cs | 24 ++-- .../Filtering/FilterDepthTests.cs | 42 +++--- .../Filtering/FilterOperatorTests.cs | 52 +++---- .../QueryStrings/Filtering/FilterTests.cs | 10 +- .../QueryStrings/Includes/IncludeTests.cs | 62 ++++---- .../PaginationWithTotalCountTests.cs | 40 +++--- .../PaginationWithoutTotalCountTests.cs | 4 +- .../Pagination/RangeValidationTests.cs | 6 +- .../RangeValidationWithMaximumTests.cs | 6 +- .../QueryStrings/QueryStringTests.cs | 4 +- .../SerializerIgnoreConditionTests.cs | 2 +- .../QueryStrings/Sorting/SortTests.cs | 38 ++--- .../SparseFieldSets/SparseFieldSetTests.cs | 100 ++++++------- .../ReadWrite/Creating/CreateResourceTests.cs | 34 ++--- ...reateResourceWithClientGeneratedIdTests.cs | 14 +- ...eateResourceWithToManyRelationshipTests.cs | 44 +++--- ...reateResourceWithToOneRelationshipTests.cs | 30 ++-- .../ReadWrite/Deleting/DeleteResourceTests.cs | 2 +- .../Fetching/FetchRelationshipTests.cs | 10 +- .../ReadWrite/Fetching/FetchResourceTests.cs | 14 +- .../AddToToManyRelationshipTests.cs | 48 +++---- .../RemoveFromToManyRelationshipTests.cs | 60 ++++---- .../ReplaceToManyRelationshipTests.cs | 42 +++--- .../UpdateToOneRelationshipTests.cs | 26 ++-- .../ReplaceToManyRelationshipTests.cs | 46 +++--- .../Updating/Resources/UpdateResourceTests.cs | 60 ++++---- .../Resources/UpdateToOneRelationshipTests.cs | 28 ++-- .../DefaultBehaviorTests.cs | 8 +- .../ResourceInjectionTests.cs | 12 +- .../Reading/ResourceDefinitionReadTests.cs | 30 ++-- .../ResourceDefinitionSerializationTests.cs | 16 +-- .../AtomicOperationTests.cs | 2 +- .../ResourceInheritanceReadTests.cs | 96 ++++++------- .../ResourceInheritanceWriteTests.cs | 92 ++++++------ .../ResourceTypeCaptureStore.cs | 2 +- .../DisableQueryStringTests.cs | 6 +- .../NoRelationshipsControllerTests.cs | 12 +- .../ReadOnlyControllerTests.cs | 12 +- .../WriteOnlyControllerTests.cs | 10 +- .../Serialization/ETagTests.cs | 2 +- .../SoftDeletion/SoftDeletionTests.cs | 50 +++---- .../ZeroKeys/EmptyGuidAsKeyTests.cs | 12 +- .../ZeroKeys/WhiteSpaceAsKeyTests.cs | 12 +- .../ZeroKeys/ZeroAsKeyTests.cs | 12 +- .../ModelStateValidationTests.cs | 4 +- .../QueryStringParameters/FilterParseTests.cs | 4 +- .../IncludeParseTests.cs | 2 +- .../LegacyFilterParseTests.cs | 4 +- .../PaginationParseTests.cs | 4 +- .../QueryStringParameters/SortParseTests.cs | 4 +- .../SparseFieldSetParseTests.cs | 4 +- .../CreateSortExpressionFromLambdaTests.cs | 20 +-- .../ResourceGraph/HasManyAttributeTests.cs | 12 +- .../ResourceGraphBuilderTests.cs | 6 +- .../ResourceObjectConverterTests.cs | 4 +- .../SourcePointerInExceptionTests.cs | 4 +- .../Serialization/InputConversionTests.cs | 2 +- .../Response/ResponseModelAdapterTests.cs | 2 +- test/MultiDbContextTests/ResourceTests.cs | 4 +- test/NoEntityFrameworkTests/PersonTests.cs | 16 +-- test/NoEntityFrameworkTests/TagTests.cs | 16 +-- test/NoEntityFrameworkTests/TodoItemTests.cs | 22 +-- .../NullabilityAssertionExtensions.cs | 6 - 152 files changed, 1573 insertions(+), 1579 deletions(-) diff --git a/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs index bec6919496..dd802fbc0c 100644 --- a/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs +++ b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs @@ -168,7 +168,7 @@ public async Task Can_use_multiple_operations() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(7); + responseDocument.Results.Should().HaveCount(7); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people")); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people")); @@ -206,11 +206,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.Owner.ShouldNotBeNull(); todoItemInDatabase.Owner.Id.Should().Be(newOwnerId); todoItemInDatabase.Assignee.Should().BeNull(); - todoItemInDatabase.Tags.ShouldHaveCount(1); + todoItemInDatabase.Tags.Should().HaveCount(1); todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(newTagId); }); - store.SqlCommands.ShouldHaveCount(15); + store.SqlCommands.Should().HaveCount(15); store.SqlCommands[0].With(command => { @@ -220,7 +220,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", newOwner.FirstName); command.Parameters.Should().Contain("@p2", newOwner.LastName); command.Parameters.Should().Contain("@p3", null); @@ -234,7 +234,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newOwnerId); }); @@ -246,7 +246,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", newAssignee.FirstName); command.Parameters.Should().Contain("@p2", newAssignee.LastName); command.Parameters.Should().Contain("@p3", null); @@ -260,7 +260,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newAssigneeId); }); @@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", newTag.Name); command.Parameters.Should().Contain("@p2", null); }); @@ -285,7 +285,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newTagId); }); @@ -297,7 +297,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(7); + command.Parameters.Should().HaveCount(7); command.Parameters.Should().Contain("@p1", newTodoItem.Description); command.Parameters.Should().Contain("@p2", newTodoItem.Priority); command.Parameters.Should().Contain("@p3", newTodoItem.DurationInHours); @@ -315,7 +315,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newTodoItemId); }); @@ -328,7 +328,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newTodoItemId); }); @@ -340,7 +340,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", newAssigneeId); command.Parameters.Should().Contain("@p2", newTodoItemId); }); @@ -354,7 +354,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newTodoItemId); }); @@ -366,7 +366,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", DapperTestContext.FrozenTime); command.Parameters.Should().Contain("@p2", newTodoItemId); }); @@ -379,7 +379,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", newTodoItemId); command.Parameters.Should().Contain("@p2", newTagId); }); @@ -392,7 +392,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newTodoItemId); }); @@ -403,7 +403,7 @@ DELETE FROM "People" WHERE "Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newAssigneeId); }); } @@ -469,7 +469,7 @@ public async Task Can_rollback_on_error() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -484,7 +484,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => peopleInDatabase.Should().BeEmpty(); }); - store.SqlCommands.ShouldHaveCount(5); + store.SqlCommands.Should().HaveCount(5); store.SqlCommands[0].With(command => { @@ -494,7 +494,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", newPerson.LastName); command.Parameters.Should().Contain("@p3", null); @@ -508,7 +508,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull()); }); @@ -521,7 +521,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull()); }); @@ -533,7 +533,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull()); command.Parameters.Should().Contain("@p2", unknownTodoItemId); }); @@ -546,7 +546,7 @@ SELECT t1."Id" WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", unknownTodoItemId); }); } diff --git a/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs index 03ebd81bd9..f7da3533f9 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs @@ -50,13 +50,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("tags"); responseDocument.Data.ManyValue[0].Id.Should().Be(tags[1].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -67,7 +67,7 @@ SELECT COUNT(*) WHERE t2."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", 0x00FF00); }); @@ -81,7 +81,7 @@ SELECT COUNT(*) ORDER BY t1."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", 0x00FF00); }); } @@ -115,13 +115,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("tags"); responseDocument.Data.ManyValue[0].Id.Should().Be(tags[1].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -132,7 +132,7 @@ SELECT COUNT(*) WHERE t2."Id" IN (@p1, @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", 0x00FF00); command.Parameters.Should().Contain("@p2", 0x11EE11); }); @@ -147,7 +147,7 @@ SELECT COUNT(*) ORDER BY t1."Id" """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", 0x00FF00); command.Parameters.Should().Contain("@p2", 0x11EE11); }); @@ -178,13 +178,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -196,7 +196,7 @@ SELECT COUNT(*) WHERE (t2."Id" = @p1) AND (t3."Id" IS NULL) """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); @@ -215,7 +215,7 @@ WHERE t3."Id" IS NULL ORDER BY t4."Priority", t4."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -245,13 +245,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -262,7 +262,7 @@ SELECT COUNT(*) WHERE (t2."Id" = @p1) AND (t1."DurationInHours" IS NULL) """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); @@ -280,7 +280,7 @@ WHERE t2."DurationInHours" IS NULL ORDER BY t3."Priority", t3."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -313,13 +313,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -329,7 +329,7 @@ SELECT COUNT(*) WHERE t1."Priority" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItems[1].Priority); }); @@ -342,7 +342,7 @@ SELECT COUNT(*) ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItems[1].Priority); }); } @@ -375,13 +375,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(person.AssignedTodoItems.ElementAt(1).StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -392,7 +392,7 @@ SELECT COUNT(*) WHERE (t2."Id" = @p1) AND (t1."Description" = @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", person.Id); command.Parameters.Should().Contain("@p2", person.AssignedTodoItems.ElementAt(1).Description); }); @@ -411,7 +411,7 @@ LEFT JOIN ( ORDER BY t3."Priority", t3."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", person.Id); command.Parameters.Should().Contain("@p2", person.AssignedTodoItems.ElementAt(1).Description); }); @@ -445,13 +445,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -506,13 +506,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -523,7 +523,7 @@ SELECT COUNT(*) WHERE (t2."Id" = @p1) AND (t1."Priority" = @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", person.Id); command.Parameters.Should().Contain("@p2", TodoItemPriority.Medium); }); @@ -542,7 +542,7 @@ LEFT JOIN ( ORDER BY t3."Priority", t3."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", person.Id); command.Parameters.Should().Contain("@p2", TodoItemPriority.Medium); }); @@ -574,13 +574,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -590,7 +590,7 @@ SELECT COUNT(*) WHERE t1."Description" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", "X"); }); @@ -603,7 +603,7 @@ SELECT COUNT(*) ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", "X"); }); } @@ -635,14 +635,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("people")); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == people[1].StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == people[2].StringId); responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -652,7 +652,7 @@ SELECT COUNT(*) WHERE (NOT (t1."FirstName" = @p1)) OR (t1."FirstName" IS NULL) """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", "X"); }); @@ -665,7 +665,7 @@ SELECT COUNT(*) ORDER BY t1."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", "X"); }); } @@ -699,13 +699,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[0].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -716,7 +716,7 @@ SELECT COUNT(*) WHERE (NOT ((t2."FirstName" = @p1) AND (t2."LastName" = @p2))) OR (t2."FirstName" IS NULL) OR (t2."LastName" IS NULL) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", "X"); command.Parameters.Should().Contain("@p2", "Y"); }); @@ -731,7 +731,7 @@ SELECT COUNT(*) ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", "X"); command.Parameters.Should().Contain("@p2", "Y"); }); @@ -768,13 +768,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -785,7 +785,7 @@ SELECT COUNT(*) WHERE (t1."Description" LIKE 'T%') AND (NOT (t1."Description" IN (@p1, @p2))) AND (t2."FirstName" = @p3) AND (t1."Description" LIKE '%o%') """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", "Four"); command.Parameters.Should().Contain("@p2", "Three"); command.Parameters.Should().Contain("@p3", "Jack"); @@ -801,7 +801,7 @@ SELECT COUNT(*) ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", "Four"); command.Parameters.Should().Contain("@p2", "Three"); command.Parameters.Should().Contain("@p3", "Jack"); @@ -838,7 +838,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(5); + responseDocument.Data.ManyValue.Should().HaveCount(5); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == tags[0].StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == tags[1].StringId); @@ -848,7 +848,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(5); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -903,14 +903,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == todoItems[0].StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == todoItems[2].StringId); responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -920,7 +920,7 @@ SELECT COUNT(*) WHERE (t1."DurationInHours" > @p1) OR (t1."DurationInHours" <= @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", 250); command.Parameters.Should().Contain("@p2", 100); }); @@ -934,7 +934,7 @@ SELECT COUNT(*) ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", 250); command.Parameters.Should().Contain("@p2", 100); }); @@ -968,13 +968,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -990,7 +990,7 @@ SELECT COUNT(*) ) > @p1) AND (NOT (t4."Id" IS NULL)) """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", 1); }); @@ -1009,7 +1009,7 @@ SELECT COUNT(*) ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", 1); }); } @@ -1052,13 +1052,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -1078,7 +1078,7 @@ SELECT 1 ) """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", "Personal"); command.Parameters.Should().Contain("@p2", "Smith"); command.Parameters.Should().Contain("@p3", "Homework"); @@ -1103,7 +1103,7 @@ SELECT 1 ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", "Personal"); command.Parameters.Should().Contain("@p2", "Smith"); command.Parameters.Should().Contain("@p3", "Homework"); @@ -1142,13 +1142,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("people"); responseDocument.Data.ManyValue[0].Id.Should().Be(people[2].StringId); responseDocument.Meta.Should().ContainTotal(1); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -1229,7 +1229,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == todoItems[2].StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Id == todoItems[3].StringId); @@ -1237,7 +1237,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(3); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -1247,7 +1247,7 @@ SELECT COUNT(*) WHERE (t1."Description" = @p1) AND ((t1."Priority" = @p2) OR (t1."DurationInHours" = @p3)) """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", "1"); command.Parameters.Should().Contain("@p2", TodoItemPriority.High); command.Parameters.Should().Contain("@p3", 1); @@ -1262,7 +1262,7 @@ SELECT COUNT(*) ORDER BY t1."Priority", t1."LastModifiedAt" DESC """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", "1"); command.Parameters.Should().Contain("@p2", TodoItemPriority.High); command.Parameters.Should().Contain("@p3", 1); @@ -1292,7 +1292,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs index a1f06cd736..bf1815c29c 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs @@ -53,7 +53,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[0].StringId); @@ -77,7 +77,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => relationships.ShouldContainKey("tags").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(2); + value.Data.ManyValue.Should().HaveCount(2); value.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); value.Data.ManyValue[0].Id.Should().Be(todoItems[0].Tags.ElementAt(0).StringId); value.Data.ManyValue[1].Id.Should().Be(todoItems[0].Tags.ElementAt(1).StringId); @@ -107,14 +107,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => relationships.ShouldContainKey("tags").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(2); + value.Data.ManyValue.Should().HaveCount(2); value.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); value.Data.ManyValue[0].Id.Should().Be(todoItems[1].Tags.ElementAt(0).StringId); value.Data.ManyValue[1].Id.Should().Be(todoItems[1].Tags.ElementAt(1).StringId); }); }); - responseDocument.Included.ShouldHaveCount(6); + responseDocument.Included.Should().HaveCount(6); responseDocument.Included[0].Type.Should().Be("people"); responseDocument.Included[0].Id.Should().Be(owner.StringId); @@ -144,7 +144,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -199,7 +199,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(25); + responseDocument.Data.ManyValue.Should().HaveCount(25); responseDocument.Data.ManyValue.ForEach(resource => { @@ -208,11 +208,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); }); - responseDocument.Included.ShouldHaveCount(25 * 15 * 2); + responseDocument.Included.Should().HaveCount(25 * 15 * 2); responseDocument.Meta.Should().ContainTotal(25); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { diff --git a/test/DapperTests/IntegrationTests/QueryStrings/PaginationTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/PaginationTests.cs index e87469cfbf..854fb176db 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/PaginationTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/PaginationTests.cs @@ -41,7 +41,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.InternalServerError); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.InternalServerError); diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs index 6a66d5e7e3..488dda2cc3 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs @@ -50,13 +50,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[2].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItems[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(todoItems[1].StringId); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -113,18 +113,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(2).StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(person.OwnedTodoItems.ElementAt(0).StringId); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); 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.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -135,7 +135,7 @@ SELECT COUNT(*) WHERE t2."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); @@ -150,7 +150,7 @@ SELECT COUNT(*) ORDER BY t2."DurationInHours" DESC, t3."Name" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -184,13 +184,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[2].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItems[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(todoItems[1].StringId); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -247,13 +247,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(2).StringId); 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.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -264,7 +264,7 @@ SELECT COUNT(*) WHERE t2."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); @@ -282,7 +282,7 @@ SELECT COUNT(*) ) DESC, t2."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -316,13 +316,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(2).StringId); 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.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -333,7 +333,7 @@ SELECT COUNT(*) WHERE t2."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); @@ -352,7 +352,7 @@ SELECT COUNT(*) ) DESC, t2."Id", t4."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -386,18 +386,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("people"); responseDocument.Data.ManyValue[0].Id.Should().Be(person.StringId); - responseDocument.Included.ShouldHaveCount(4); + responseDocument.Included.Should().HaveCount(4); responseDocument.Included.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Included[0].Id.Should().Be(person.OwnedTodoItems.ElementAt(2).StringId); responseDocument.Included[1].Id.Should().Be(person.OwnedTodoItems.ElementAt(0).StringId); responseDocument.Included[2].Id.Should().Be(person.OwnedTodoItems.ElementAt(1).StringId); responseDocument.Included[3].Id.Should().Be(person.OwnedTodoItems.ElementAt(3).StringId); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs index af09f014a2..de65f7d918 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs @@ -47,13 +47,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(2); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItem.DurationInHours)); - responseDocument.Data.ManyValue[0].Relationships.ShouldHaveCount(2); + responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("owner").With(value => { @@ -71,20 +71,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(todoItem.Assignee.StringId); }); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().AllSatisfy(resource => resource.Type.Should().Be("people")); responseDocument.Included[0].Id.Should().Be(todoItem.Owner.StringId); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Owner.LastName)); responseDocument.Included[0].Relationships.Should().BeNull(); responseDocument.Included[1].Id.Should().Be(todoItem.Assignee.StringId); - responseDocument.Included[1].Attributes.ShouldHaveCount(1); + responseDocument.Included[1].Attributes.Should().HaveCount(1); responseDocument.Included[1].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Assignee.LastName)); responseDocument.Included[1].Relationships.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -137,11 +137,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -151,7 +151,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -181,11 +181,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("tags"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.Tags.ElementAt(0).StringId); responseDocument.Data.ManyValue[0].Attributes.Should().BeNull(); - responseDocument.Data.ManyValue[0].Relationships.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("color").With(value => { @@ -193,7 +193,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.Value.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -204,7 +204,7 @@ SELECT COUNT(*) WHERE t2."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); @@ -218,7 +218,7 @@ SELECT COUNT(*) ORDER BY t2."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -252,7 +252,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -262,7 +262,7 @@ SELECT t1."Id" WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -296,7 +296,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -306,7 +306,7 @@ SELECT t1."Id" WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -337,11 +337,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(person.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(person.DisplayName)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -351,7 +351,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", person.Id); }); } @@ -384,14 +384,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -403,7 +403,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => ORDER BY t2."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs index 2bf6277f10..6f5a87ea33 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs @@ -73,10 +73,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase = await dbContext.People.Include(person => person.OwnedTodoItems).FirstWithIdAsync(existingPerson.Id); - personInDatabase.OwnedTodoItems.ShouldHaveCount(3); + personInDatabase.OwnedTodoItems.Should().HaveCount(3); }); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -86,7 +86,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" IN (@p2, @p3) """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", existingPerson.Id); command.Parameters.Should().Contain("@p2", existingTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p3", existingTodoItems.ElementAt(1).Id); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs index 949494e5f0..dced9876cd 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs @@ -52,7 +52,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -63,7 +63,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -97,7 +97,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -108,7 +108,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -139,14 +139,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.Tags.ElementAt(0).StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItem.Tags.ElementAt(1).StringId); responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -157,7 +157,7 @@ SELECT COUNT(*) WHERE t2."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); @@ -171,7 +171,7 @@ SELECT COUNT(*) ORDER BY t2."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -189,7 +189,7 @@ public async Task Cannot_get_relationship_for_unknown_primary_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs index 82dace581f..ac6be3134e 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase = await dbContext.People.Include(person => person.AssignedTodoItems).FirstWithIdAsync(existingPerson.Id); - personInDatabase.AssignedTodoItems.ShouldHaveCount(1); + personInDatabase.AssignedTodoItems.Should().HaveCount(1); personInDatabase.AssignedTodoItems.ElementAt(0).Id.Should().Be(existingPerson.AssignedTodoItems.ElementAt(1).Id); List todoItemInDatabases = await dbContext.TodoItems.Where(todoItem => todoItem.Assignee == null).ToListAsync(); @@ -78,7 +78,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabases.Should().HaveCount(2); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -93,7 +93,7 @@ LEFT JOIN ( WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", existingPerson.Id); command.Parameters.Should().Contain("@p2", existingPerson.AssignedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p3", existingPerson.AssignedTodoItems.ElementAt(2).Id); @@ -107,7 +107,7 @@ SELECT t1."Id" WHERE t1."Id" IN (@p1, @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson.AssignedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p2", existingPerson.AssignedTodoItems.ElementAt(2).Id); }); @@ -120,7 +120,7 @@ SELECT t1."Id" WHERE "Id" IN (@p2, @p3) """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingPerson.AssignedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p3", existingPerson.AssignedTodoItems.ElementAt(2).Id); @@ -175,7 +175,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase = await dbContext.People.Include(person => person.OwnedTodoItems).FirstWithIdAsync(existingPerson.Id); - personInDatabase.OwnedTodoItems.ShouldHaveCount(1); + personInDatabase.OwnedTodoItems.Should().HaveCount(1); personInDatabase.OwnedTodoItems.ElementAt(0).Id.Should().Be(existingPerson.OwnedTodoItems.ElementAt(1).Id); List todoItemInDatabases = await dbContext.TodoItems.ToListAsync(); @@ -183,7 +183,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabases.Should().HaveCount(1); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -198,7 +198,7 @@ LEFT JOIN ( WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", existingPerson.Id); command.Parameters.Should().Contain("@p2", existingPerson.OwnedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p3", existingPerson.OwnedTodoItems.ElementAt(2).Id); @@ -212,7 +212,7 @@ SELECT t1."Id" WHERE t1."Id" IN (@p1, @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p2", existingPerson.OwnedTodoItems.ElementAt(2).Id); }); @@ -224,7 +224,7 @@ DELETE FROM "TodoItems" WHERE "Id" IN (@p1, @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p2", existingPerson.OwnedTodoItems.ElementAt(2).Id); }); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs index d2a4d0865a..a46a34678b 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs @@ -59,7 +59,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => personInDatabase.AssignedTodoItems.Should().BeEmpty(); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.Id); }); @@ -82,7 +82,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" IN (@p2, @p3) """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingPerson.AssignedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p3", existingPerson.AssignedTodoItems.ElementAt(1).Id); @@ -127,7 +127,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => personInDatabase.OwnedTodoItems.Should().BeEmpty(); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -138,7 +138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.Id); }); @@ -149,7 +149,7 @@ DELETE FROM "TodoItems" WHERE "Id" IN (@p1, @p2) """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p2", existingPerson.OwnedTodoItems.ElementAt(1).Id); }); @@ -204,12 +204,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase = await dbContext.People.Include(person => person.AssignedTodoItems).FirstWithIdAsync(existingPerson.Id); - personInDatabase.AssignedTodoItems.ShouldHaveCount(2); + personInDatabase.AssignedTodoItems.Should().HaveCount(2); personInDatabase.AssignedTodoItems.ElementAt(0).Id.Should().Be(existingTodoItems.ElementAt(0).Id); personInDatabase.AssignedTodoItems.ElementAt(1).Id.Should().Be(existingTodoItems.ElementAt(1).Id); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -220,7 +220,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.Id); }); @@ -232,7 +232,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" IN (@p2, @p3) """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", existingPerson.Id); command.Parameters.Should().Contain("@p2", existingTodoItems.ElementAt(0).Id); command.Parameters.Should().Contain("@p3", existingTodoItems.ElementAt(1).Id); @@ -284,11 +284,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase = await dbContext.People.Include(person => person.AssignedTodoItems).FirstWithIdAsync(existingPerson.Id); - personInDatabase.AssignedTodoItems.ShouldHaveCount(1); + personInDatabase.AssignedTodoItems.Should().HaveCount(1); personInDatabase.AssignedTodoItems.ElementAt(0).Id.Should().Be(existingTodoItem.Id); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -299,7 +299,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.Id); }); @@ -311,7 +311,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingPerson.AssignedTodoItems.ElementAt(0).Id); }); @@ -324,7 +324,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson.Id); command.Parameters.Should().Contain("@p2", existingTodoItem.Id); }); @@ -375,11 +375,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase = await dbContext.People.Include(person => person.OwnedTodoItems).FirstWithIdAsync(existingPerson.Id); - personInDatabase.OwnedTodoItems.ShouldHaveCount(1); + personInDatabase.OwnedTodoItems.Should().HaveCount(1); personInDatabase.OwnedTodoItems.ElementAt(0).Id.Should().Be(existingTodoItem.Id); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -390,7 +390,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.Id); }); @@ -401,7 +401,7 @@ DELETE FROM "TodoItems" WHERE "Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id); }); @@ -413,7 +413,7 @@ DELETE FROM "TodoItems" WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson.Id); command.Parameters.Should().Contain("@p2", existingTodoItem.Id); }); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs index 5f3b2ad0fb..a6320bcc6a 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs @@ -65,7 +65,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => loginAccountInDatabase.Person.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -76,7 +76,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.Id); }); @@ -88,7 +88,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingPerson.Id); }); @@ -137,7 +137,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => personInDatabase.Account.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -148,7 +148,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingLoginAccount.Id); }); @@ -160,7 +160,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingLoginAccount.Person.Id); }); @@ -196,7 +196,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Should().BeEmpty(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingLoginAccount.Id); }); } @@ -240,7 +240,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -248,7 +248,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'recovery' on resource type 'loginAccounts' cannot be cleared because it is a required relationship."); error.Source.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -259,7 +259,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingLoginAccount.Id); }); } @@ -292,7 +292,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -300,7 +300,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'account' on resource type 'accountRecoveries' cannot be cleared because it is a required relationship."); error.Source.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -311,7 +311,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingAccountRecovery.Id); }); } @@ -354,7 +354,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.Assignee.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -365,7 +365,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); @@ -377,7 +377,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingTodoItem.Id); }); @@ -411,7 +411,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -419,7 +419,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'owner' on resource type 'todoItems' cannot be cleared because it is a required relationship."); error.Source.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -430,7 +430,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); } @@ -479,7 +479,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => personInDatabase.Account.Id.Should().Be(existingLoginAccount.Id); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -490,7 +490,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson.Id); }); @@ -502,7 +502,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "AccountId" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingLoginAccount.Id); }); @@ -515,7 +515,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingLoginAccount.Id); command.Parameters.Should().Contain("@p2", existingPerson.Id); }); @@ -566,7 +566,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => loginAccountInDatabase.Person.Id.Should().Be(existingPerson.Id); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -577,7 +577,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingLoginAccount.Id); }); @@ -589,7 +589,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingLoginAccount.Id); command.Parameters.Should().Contain("@p2", existingPerson.Id); }); @@ -639,7 +639,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.Assignee.Id.Should().Be(existingPerson.Id); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -650,7 +650,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); @@ -662,7 +662,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson.Id); command.Parameters.Should().Contain("@p2", existingTodoItem.Id); }); @@ -719,7 +719,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => personInDatabase2.Account.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -730,7 +730,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingPerson1.Id); }); @@ -742,7 +742,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "AccountId" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingPerson2.Account.Id); }); @@ -755,7 +755,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingPerson2.Account.Id); command.Parameters.Should().Contain("@p2", existingPerson1.Id); }); @@ -814,7 +814,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => loginAccountInDatabase2.Person.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -825,7 +825,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingLoginAccount1.Id); }); @@ -837,7 +837,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingLoginAccount1.Person.Id); }); @@ -850,7 +850,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingLoginAccount1.Id); command.Parameters.Should().Contain("@p2", existingLoginAccount2.Person.Id); }); @@ -907,7 +907,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => loginAccountInDatabase2.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -918,7 +918,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingLoginAccount1.Id); }); @@ -929,7 +929,7 @@ DELETE FROM "LoginAccounts" WHERE "RecoveryId" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingLoginAccount2.Recovery.Id); }); @@ -941,7 +941,7 @@ DELETE FROM "LoginAccounts" WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingLoginAccount2.Recovery.Id); command.Parameters.Should().Contain("@p2", existingLoginAccount1.Id); }); @@ -998,7 +998,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => accountRecoveryInDatabase2.Account.Should().BeNull(); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -1009,7 +1009,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingAccountRecovery1.Id); }); @@ -1020,7 +1020,7 @@ DELETE FROM "LoginAccounts" WHERE "Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingAccountRecovery1.Account.Id); }); @@ -1032,7 +1032,7 @@ DELETE FROM "LoginAccounts" WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingAccountRecovery1.Id); command.Parameters.Should().Contain("@p2", existingAccountRecovery2.Account.Id); }); @@ -1085,7 +1085,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase1.Assignee.Id.Should().Be(existingTodoItem2.Assignee.Id); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -1096,7 +1096,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem1.Id); }); @@ -1108,7 +1108,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingTodoItem2.Assignee.Id); command.Parameters.Should().Contain("@p2", existingTodoItem1.Id); }); @@ -1159,7 +1159,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase1.Owner.Id.Should().Be(existingTodoItem2.Owner.Id); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -1170,7 +1170,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem1.Id); }); @@ -1182,7 +1182,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingTodoItem2.Owner.Id); command.Parameters.Should().Contain("@p2", existingTodoItem1.Id); }); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs index 1f3a540315..c631144ef8 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs @@ -129,11 +129,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.Owner.Id.Should().Be(existingPerson.Id); todoItemInDatabase.Assignee.ShouldNotBeNull(); todoItemInDatabase.Assignee.Id.Should().Be(existingPerson.Id); - todoItemInDatabase.Tags.ShouldHaveCount(1); + todoItemInDatabase.Tags.Should().HaveCount(1); todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(existingTag.Id); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -143,7 +143,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(7); + command.Parameters.Should().HaveCount(7); command.Parameters.Should().Contain("@p1", newTodoItem.Description); command.Parameters.Should().Contain("@p2", newTodoItem.Priority); command.Parameters.Should().Contain("@p3", newTodoItem.DurationInHours); @@ -161,7 +161,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", newTodoItemId); command.Parameters.Should().Contain("@p2", existingTag.Id); }); @@ -174,7 +174,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newTodoItemId); }); } @@ -265,7 +265,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.Tags.Should().BeEmpty(); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -275,7 +275,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(7); + command.Parameters.Should().HaveCount(7); command.Parameters.Should().Contain("@p1", newTodoItem.Description); command.Parameters.Should().Contain("@p2", newTodoItem.Priority); command.Parameters.Should().Contain("@p3", null); @@ -293,7 +293,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newTodoItemId); }); } @@ -324,7 +324,7 @@ public async Task Cannot_create_resource_without_required_fields() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(3); + responseDocument.Errors.Should().HaveCount(3); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -437,7 +437,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => loginAccountInDatabase.Person.Id.Should().Be(existingPerson.Id); }); - store.SqlCommands.ShouldHaveCount(4); + store.SqlCommands.Should().HaveCount(4); store.SqlCommands[0].With(command => { @@ -446,7 +446,7 @@ DELETE FROM "LoginAccounts" WHERE "RecoveryId" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingAccountRecovery.Id); }); @@ -458,7 +458,7 @@ DELETE FROM "LoginAccounts" RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", newUserName); command.Parameters.Should().Contain("@p2", null); command.Parameters.Should().Contain("@p3", existingAccountRecovery.Id); @@ -472,7 +472,7 @@ DELETE FROM "LoginAccounts" WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", newLoginAccountId); command.Parameters.Should().Contain("@p2", existingPerson.Id); }); @@ -485,7 +485,7 @@ DELETE FROM "LoginAccounts" WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newLoginAccountId); }); } @@ -538,7 +538,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => personInDatabase.DisplayName.Should().Be(newPerson.DisplayName); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -548,7 +548,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RETURNING "Id" """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", newPerson.FirstName); command.Parameters.Should().Contain("@p2", newPerson.LastName); command.Parameters.Should().Contain("@p3", null); @@ -562,7 +562,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newPersonId); }); } @@ -627,7 +627,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => colorInDatabase.Tag.Id.Should().Be(existingTag.Id); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -636,7 +636,7 @@ DELETE FROM "RgbColors" WHERE "TagId" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTag.Id); }); @@ -648,7 +648,7 @@ DELETE FROM "RgbColors" RETURNING "Id" """, true)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", newColor.Id); command.Parameters.Should().Contain("@p2", existingTag.Id); }); @@ -661,7 +661,7 @@ SELECT t1."Id" WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", newColor.Id); }); } @@ -713,7 +713,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -721,7 +721,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Another resource of type 'rgbColors' with ID '{existingColor.StringId}' already exists."); error.Source.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -730,7 +730,7 @@ DELETE FROM "RgbColors" WHERE "TagId" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTag.Id); }); @@ -742,7 +742,7 @@ DELETE FROM "RgbColors" RETURNING "Id" """, true)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingColor.Id); command.Parameters.Should().Contain("@p2", existingTag.Id); }); @@ -755,7 +755,7 @@ SELECT t1."Id" WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingColor.Id); }); } diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs index 842f736ee9..566c546c73 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs @@ -59,10 +59,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => List tags = await dbContext.Tags.Where(tag => tag.TodoItem == null).ToListAsync(); - tags.ShouldHaveCount(1); + tags.Should().HaveCount(1); }); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -71,7 +71,7 @@ DELETE FROM "TodoItems" WHERE "Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); } @@ -93,7 +93,7 @@ public async Task Cannot_delete_unknown_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -101,7 +101,7 @@ public async Task Cannot_delete_unknown_resource() error.Detail.Should().Be($"Resource of type 'todoItems' with ID '{unknownTodoItemId}' does not exist."); error.Source.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -110,7 +110,7 @@ DELETE FROM "TodoItems" WHERE "Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", unknownTodoItemId); }); @@ -122,7 +122,7 @@ SELECT t1."Id" WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", unknownTodoItemId); }); } diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs index 20d08e1b9f..672504de22 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs @@ -49,7 +49,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -130,7 +130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -140,7 +140,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -162,7 +162,7 @@ public async Task Cannot_get_unknown_primary_resource_by_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -170,7 +170,7 @@ public async Task Cannot_get_unknown_primary_resource_by_ID() error.Detail.Should().Be($"Resource of type 'todoItems' with ID '{unknownTodoItemId}' does not exist."); error.Source.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -180,7 +180,7 @@ public async Task Cannot_get_unknown_primary_resource_by_ID() WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", unknownTodoItemId); }); } @@ -211,7 +211,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.Tags.ElementAt(0).StringId); @@ -224,7 +224,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().ContainTotal(2); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -235,7 +235,7 @@ SELECT COUNT(*) WHERE t2."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); @@ -249,7 +249,7 @@ SELECT COUNT(*) ORDER BY t2."Id" """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -288,7 +288,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -299,7 +299,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } @@ -332,7 +332,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().BeNull(); - store.SqlCommands.ShouldHaveCount(1); + store.SqlCommands.Should().HaveCount(1); store.SqlCommands[0].With(command => { @@ -343,7 +343,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", todoItem.Id); }); } diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs index b248db2e02..0de6c93264 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs @@ -73,7 +73,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => tagInDatabase.Color.Id.Should().Be(existingTag.Color.Id); }); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -83,7 +83,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTag.Id); }); @@ -95,7 +95,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTag.Id); }); } @@ -177,11 +177,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.Owner.Id.Should().Be(existingTodoItem.Owner.Id); todoItemInDatabase.Assignee.ShouldNotBeNull(); todoItemInDatabase.Assignee.Id.Should().Be(existingTodoItem.Assignee.Id); - todoItemInDatabase.Tags.ShouldHaveCount(1); + todoItemInDatabase.Tags.Should().HaveCount(1); todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(existingTodoItem.Tags.ElementAt(0).Id); }); - store.SqlCommands.ShouldHaveCount(3); + store.SqlCommands.Should().HaveCount(3); store.SqlCommands[0].With(command => { @@ -191,7 +191,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); @@ -203,7 +203,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p4 """)); - command.Parameters.ShouldHaveCount(4); + command.Parameters.Should().HaveCount(4); command.Parameters.Should().Contain("@p1", newDescription); command.Parameters.Should().Contain("@p2", newDurationInHours); command.Parameters.Should().Contain("@p3", DapperTestContext.FrozenTime); @@ -218,7 +218,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); } @@ -334,11 +334,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.Owner.Id.Should().Be(existingPerson1.Id); todoItemInDatabase.Assignee.ShouldNotBeNull(); todoItemInDatabase.Assignee.Id.Should().Be(existingPerson2.Id); - todoItemInDatabase.Tags.ShouldHaveCount(1); + todoItemInDatabase.Tags.Should().HaveCount(1); todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(existingTag.Id); }); - store.SqlCommands.ShouldHaveCount(5); + store.SqlCommands.Should().HaveCount(5); store.SqlCommands[0].With(command => { @@ -351,7 +351,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); @@ -363,7 +363,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p7 """)); - command.Parameters.ShouldHaveCount(7); + command.Parameters.Should().HaveCount(7); command.Parameters.Should().Contain("@p1", newTodoItem.Description); command.Parameters.Should().Contain("@p2", newTodoItem.Priority); command.Parameters.Should().Contain("@p3", newTodoItem.DurationInHours); @@ -381,7 +381,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" IN (@p2, @p3) """)); - command.Parameters.ShouldHaveCount(3); + command.Parameters.Should().HaveCount(3); command.Parameters.Should().Contain("@p1", null); command.Parameters.Should().Contain("@p2", existingTodoItem.Tags.ElementAt(0).Id); command.Parameters.Should().Contain("@p3", existingTodoItem.Tags.ElementAt(1).Id); @@ -395,7 +395,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE "Id" = @p2 """)); - command.Parameters.ShouldHaveCount(2); + command.Parameters.Should().HaveCount(2); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); command.Parameters.Should().Contain("@p2", existingTag.Id); }); @@ -408,7 +408,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WHERE t1."Id" = @p1 """)); - command.Parameters.ShouldHaveCount(1); + command.Parameters.Should().HaveCount(1); command.Parameters.Should().Contain("@p1", existingTodoItem.Id); }); } diff --git a/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs b/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs index e9b2b001a5..8b7d18d2d2 100644 --- a/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs +++ b/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs @@ -44,7 +44,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -93,7 +93,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -142,7 +142,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -191,7 +191,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -244,7 +244,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -300,7 +300,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -361,7 +361,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -415,7 +415,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -472,7 +472,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -531,7 +531,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { @@ -592,7 +592,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - store.SqlCommands.ShouldHaveCount(2); + store.SqlCommands.Should().HaveCount(2); store.SqlCommands[0].With(command => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs index b80d7c3e3c..159c837b82 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs @@ -97,7 +97,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(broadcasts[1].StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); } @@ -124,7 +124,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(broadcasts[0].StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(broadcasts[0].ArchivedAt)); @@ -157,7 +157,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(station.StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); } @@ -187,7 +187,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(station.StringId); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(station.Broadcasts.ElementAt(0).StringId); responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(station.Broadcasts.ElementAt(0).ArchivedAt)); responseDocument.Included[1].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); @@ -242,7 +242,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); } @@ -271,7 +271,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => DateTimeOffset archivedAt0 = station.Broadcasts.ElementAt(0).ArchivedAt!.Value; - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(0).StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(archivedAt0)); @@ -302,10 +302,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(network.Stations.ElementAt(0).StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(1).StringId); responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); } @@ -335,10 +335,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => DateTimeOffset archivedAt0 = network.Stations.ElementAt(0).Broadcasts.ElementAt(0).ArchivedAt!.Value; - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(network.Stations.ElementAt(0).StringId); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(0).StringId); responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(archivedAt0)); responseDocument.Included[1].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(1).StringId); @@ -367,7 +367,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); } @@ -393,7 +393,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(0).StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); } @@ -459,7 +459,7 @@ public async Task Cannot_create_archived_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -591,7 +591,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -650,7 +650,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs index 3cdf4f20c0..b7bf3cf9cd 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs @@ -65,7 +65,7 @@ public async Task Can_create_resources_for_matching_resource_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); } [Fact] @@ -98,7 +98,7 @@ public async Task Cannot_create_resource_for_inaccessible_operation() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -147,7 +147,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -203,7 +203,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs index 0b60bfe782..a6bc81eeb6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs @@ -55,7 +55,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -147,7 +147,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(3); + responseDocument.Errors.Should().HaveCount(3); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.Forbidden); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs index 2438aca27a..a9a30ff9ea 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs @@ -65,7 +65,7 @@ public async Task Can_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -128,7 +128,7 @@ public async Task Can_create_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(elementCount); + responseDocument.Results.Should().HaveCount(elementCount); for (int index = 0; index < elementCount; index++) { @@ -154,7 +154,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { List tracksInDatabase = await dbContext.MusicTracks.Where(musicTrack => newTrackIds.Contains(musicTrack.Id)).ToListAsync(); - tracksInDatabase.ShouldHaveCount(elementCount); + tracksInDatabase.Should().HaveCount(elementCount); for (int index = 0; index < elementCount; index++) { @@ -201,7 +201,7 @@ public async Task Can_create_resource_without_attributes_or_relationships() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -256,7 +256,7 @@ public async Task Cannot_create_resource_with_unknown_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -304,7 +304,7 @@ public async Task Can_create_resource_with_unknown_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -361,7 +361,7 @@ public async Task Cannot_create_resource_with_unknown_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -419,7 +419,7 @@ public async Task Can_create_resource_with_unknown_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -473,7 +473,7 @@ public async Task Cannot_create_resource_with_client_generated_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -508,7 +508,7 @@ public async Task Cannot_create_resource_for_href_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -546,7 +546,7 @@ public async Task Cannot_create_resource_for_ref_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -580,7 +580,7 @@ public async Task Cannot_create_resource_for_missing_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -615,7 +615,7 @@ public async Task Cannot_create_resource_for_null_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -662,7 +662,7 @@ public async Task Cannot_create_resource_for_array_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -702,7 +702,7 @@ public async Task Cannot_create_resource_for_missing_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -740,7 +740,7 @@ public async Task Cannot_create_resource_for_unknown_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -785,7 +785,7 @@ public async Task Cannot_create_resource_with_readonly_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -827,7 +827,7 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -911,7 +911,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -944,7 +944,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.OwnedBy.ShouldNotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(existingPerformer.Id); }); } @@ -980,7 +980,7 @@ public async Task Cannot_assign_attribute_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs index e20d8d45ff..e0372af39e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs @@ -73,7 +73,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ string isoCode = $"{newLanguage.IsoCode}{ImplicitlyChangingTextLanguageDefinition.Suffix}"; - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -183,7 +183,7 @@ public async Task Can_create_resource_for_missing_client_generated_ID_having_sid string isoCode = $"{newIsoCode}{ImplicitlyChangingTextLanguageDefinition.Suffix}"; - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -239,7 +239,7 @@ public async Task Cannot_create_resource_for_missing_client_generated_ID(ClientI // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -299,7 +299,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -348,7 +348,7 @@ public async Task Cannot_create_resource_for_incompatible_ID(ClientIdGenerationM // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -397,7 +397,7 @@ public async Task Can_create_resource_with_local_ID(ClientIdGenerationMode mode) // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -448,7 +448,7 @@ public async Task Cannot_create_resource_with_local_ID(ClientIdGenerationMode mo // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -493,7 +493,7 @@ public async Task Cannot_create_resource_for_ID_and_local_ID(ClientIdGenerationM // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs index 0d4d367c12..0c338989f7 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs @@ -83,7 +83,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -98,7 +98,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(newTrackId); - trackInDatabase.Performers.ShouldHaveCount(2); + trackInDatabase.Performers.Should().HaveCount(2); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[0].Id); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[1].Id); }); @@ -168,7 +168,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -183,7 +183,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(newPlaylistId); - playlistInDatabase.Tracks.ShouldHaveCount(3); + playlistInDatabase.Tracks.Should().HaveCount(3); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[0].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[1].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[2].Id); @@ -230,7 +230,7 @@ public async Task Cannot_create_for_missing_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -282,7 +282,7 @@ public async Task Cannot_create_for_unknown_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -333,7 +333,7 @@ public async Task Cannot_create_for_missing_relationship_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -399,7 +399,7 @@ public async Task Cannot_create_for_unknown_relationship_IDs() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -459,7 +459,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -529,7 +529,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -544,7 +544,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(newTrackId); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(existingPerformer.Id); }); } @@ -582,7 +582,7 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -627,7 +627,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -674,7 +674,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -726,7 +726,7 @@ public async Task Cannot_assign_relationship_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs index a522105806..2b5fc0b62e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs @@ -77,7 +77,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -148,7 +148,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(elementCount); + responseDocument.Results.Should().HaveCount(elementCount); for (int index = 0; index < elementCount; index++) { @@ -251,7 +251,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - tracksInDatabase.ShouldHaveCount(elementCount); + tracksInDatabase.Should().HaveCount(elementCount); for (int index = 0; index < elementCount; index++) { @@ -296,7 +296,7 @@ public async Task Cannot_create_for_null_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -340,7 +340,7 @@ public async Task Cannot_create_for_missing_data_in_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -392,7 +392,7 @@ public async Task Cannot_create_for_array_data_in_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -440,7 +440,7 @@ public async Task Cannot_create_for_missing_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -489,7 +489,7 @@ public async Task Cannot_create_for_unknown_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -537,7 +537,7 @@ public async Task Cannot_create_for_missing_relationship_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -594,7 +594,7 @@ public async Task Cannot_create_with_unknown_relationship_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -643,7 +643,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -715,7 +715,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -773,7 +773,7 @@ public async Task Cannot_assign_relationship_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs index cbc3280aed..9331040392 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs @@ -347,7 +347,7 @@ public async Task Cannot_delete_resource_for_href_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -381,7 +381,7 @@ public async Task Cannot_delete_resource_for_missing_ref_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -419,7 +419,7 @@ public async Task Cannot_delete_resource_for_missing_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -458,7 +458,7 @@ public async Task Cannot_delete_resource_for_unknown_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -496,7 +496,7 @@ public async Task Cannot_delete_resource_for_missing_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -537,7 +537,7 @@ public async Task Cannot_delete_resource_for_unknown_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -578,7 +578,7 @@ public async Task Cannot_delete_resource_for_incompatible_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -618,7 +618,7 @@ public async Task Cannot_delete_resource_for_ID_and_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs index 4686e55244..3702697d01 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs @@ -80,7 +80,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -156,7 +156,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs index 86b8ad9846..76a8fe7799 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs @@ -73,7 +73,7 @@ public async Task Create_resource_with_side_effects_returns_relative_links() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs index e65b218764..d6aa71181d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs @@ -80,7 +80,7 @@ public async Task Can_create_resource_with_ManyToOne_relationship_using_local_ID // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -177,7 +177,7 @@ public async Task Can_create_resource_with_OneToMany_relationship_using_local_ID // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -203,7 +203,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(newPerformerId); trackInDatabase.Performers[0].ArtistName.Should().Be(newPerformer.ArtistName); trackInDatabase.Performers[0].BornAt.Should().Be(newPerformer.BornAt); @@ -273,7 +273,7 @@ public async Task Can_create_resource_with_ManyToMany_relationship_using_local_I // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -298,7 +298,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => playlistInDatabase.Name.Should().Be(newPlaylistName); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(newTrackId); playlistInDatabase.Tracks[0].Title.Should().Be(newTrackTitle); }); @@ -360,7 +360,7 @@ public async Task Cannot_consume_local_ID_that_is_assigned_in_same_operation() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -427,7 +427,7 @@ public async Task Cannot_reassign_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -487,7 +487,7 @@ public async Task Can_update_resource_using_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -607,7 +607,7 @@ public async Task Can_update_resource_with_relationships_using_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(4); + responseDocument.Results.Should().HaveCount(4); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -654,7 +654,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.OwnedBy.ShouldNotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(newCompanyId); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(newPerformerId); trackInDatabase.Performers[0].ArtistName.Should().Be(newArtistName); }); @@ -726,7 +726,7 @@ public async Task Can_create_ManyToOne_relationship_using_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(3); + responseDocument.Results.Should().HaveCount(3); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -828,7 +828,7 @@ public async Task Can_create_OneToMany_relationship_using_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(3); + responseDocument.Results.Should().HaveCount(3); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -855,7 +855,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(newPerformerId); trackInDatabase.Performers[0].ArtistName.Should().Be(newArtistName); }); @@ -930,7 +930,7 @@ public async Task Can_create_ManyToMany_relationship_using_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(3); + responseDocument.Results.Should().HaveCount(3); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -957,7 +957,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => playlistInDatabase.Name.Should().Be(newPlaylistName); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(newTrackId); playlistInDatabase.Tracks[0].Title.Should().Be(newTrackTitle); }); @@ -1054,7 +1054,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(3); + responseDocument.Results.Should().HaveCount(3); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -1081,7 +1081,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(newPerformerId); trackInDatabase.Performers[0].ArtistName.Should().Be(newArtistName); }); @@ -1178,7 +1178,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(3); + responseDocument.Results.Should().HaveCount(3); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -1205,7 +1205,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => playlistInDatabase.Name.Should().Be(newPlaylistName); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(newTrackId); playlistInDatabase.Tracks[0].Title.Should().Be(newTrackTitle); }); @@ -1302,7 +1302,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(3); + responseDocument.Results.Should().HaveCount(3); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -1329,7 +1329,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.Performers.ShouldHaveCount(2); + trackInDatabase.Performers.Should().HaveCount(2); trackInDatabase.Performers[0].Id.Should().Be(existingPerformer.Id); trackInDatabase.Performers[0].ArtistName.Should().Be(existingPerformer.ArtistName); @@ -1448,7 +1448,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(4); + responseDocument.Results.Should().HaveCount(4); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -1477,7 +1477,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => playlistInDatabase.Name.Should().Be(newPlaylistName); - playlistInDatabase.Tracks.ShouldHaveCount(3); + playlistInDatabase.Tracks.Should().HaveCount(3); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[0].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[1].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == newTrackId); @@ -1605,7 +1605,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(4); + responseDocument.Results.Should().HaveCount(4); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -1638,7 +1638,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(existingPerformer.Id); trackInDatabase.Performers[0].ArtistName.Should().Be(existingPerformer.ArtistName); }); @@ -1743,7 +1743,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(4); + responseDocument.Results.Should().HaveCount(4); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -1762,7 +1762,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(existingPlaylist.Id); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(existingPlaylist.Tracks[0].Id); }); } @@ -1812,7 +1812,7 @@ public async Task Can_delete_resource_using_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -1870,7 +1870,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -1920,7 +1920,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_data_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -1984,7 +1984,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2047,7 +2047,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_relationship_data_elemen // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2113,7 +2113,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_relationship_data_array( // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2178,7 +2178,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_same_operation() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2242,7 +2242,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2303,7 +2303,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_data_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2384,7 +2384,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2463,7 +2463,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_relationship_data // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2539,7 +2539,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_relationship_data // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs index 4d4982f732..0eb283dbf8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs @@ -83,11 +83,11 @@ public async Task Returns_resource_meta_in_create_resource_with_side_effects() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Meta.ShouldHaveCount(1); + resource.Meta.Should().HaveCount(1); resource.Meta.ShouldContainKey("copyright").With(value => { @@ -98,7 +98,7 @@ public async Task Returns_resource_meta_in_create_resource_with_side_effects() responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Meta.ShouldHaveCount(1); + resource.Meta.Should().HaveCount(1); resource.Meta.ShouldContainKey("copyright").With(value => { @@ -155,11 +155,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Meta.ShouldHaveCount(1); + resource.Meta.Should().HaveCount(1); resource.Meta.ShouldContainKey("notice").With(value => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs index 88e7115f66..92262234b2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs @@ -60,7 +60,7 @@ public async Task Returns_top_level_meta_in_create_resource_with_side_effects() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Meta.ShouldHaveCount(3); + responseDocument.Meta.Should().HaveCount(3); responseDocument.Meta.ShouldContainKey("license").With(value => { @@ -79,7 +79,7 @@ public async Task Returns_top_level_meta_in_create_resource_with_side_effects() JsonElement element = value.Should().BeOfType().Subject; string?[] versionArray = element.EnumerateArray().Select(arrayItem => arrayItem.GetString()).ToArray(); - versionArray.ShouldHaveCount(4); + versionArray.Should().HaveCount(4); versionArray.Should().Contain("v4.0.0"); versionArray.Should().Contain("v3.1.0"); versionArray.Should().Contain("v2.5.2"); @@ -126,7 +126,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Meta.ShouldHaveCount(3); + responseDocument.Meta.Should().HaveCount(3); responseDocument.Meta.ShouldContainKey("license").With(value => { @@ -145,7 +145,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => JsonElement element = value.Should().BeOfType().Subject; string?[] versionArray = element.EnumerateArray().Select(arrayItem => arrayItem.GetString()).ToArray(); - versionArray.ShouldHaveCount(4); + versionArray.Should().HaveCount(4); versionArray.Should().Contain("v4.0.0"); versionArray.Should().Contain("v3.1.0"); versionArray.Should().Contain("v2.5.2"); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs index 34618f95f8..0ea4fb0b65 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs @@ -67,7 +67,7 @@ public async Task Logs_unhandled_exception_at_Error_level() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.InternalServerError); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.InternalServerError); @@ -111,7 +111,7 @@ public async Task Logs_invalid_request_body_error_at_Information_level() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); IReadOnlyList logMessages = loggerProvider.GetMessages(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs index bedb5d7da2..138fc349c1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs @@ -33,7 +33,7 @@ public async Task Cannot_process_for_missing_request_body() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.AtomicOperations.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -57,7 +57,7 @@ public async Task Cannot_process_for_null_request_body() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -81,7 +81,7 @@ public async Task Cannot_process_for_broken_JSON_request_body() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -110,7 +110,7 @@ public async Task Cannot_process_for_missing_operations_array() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -137,7 +137,7 @@ public async Task Cannot_process_empty_operations_array() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -167,7 +167,7 @@ public async Task Cannot_process_null_operation() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -208,7 +208,7 @@ public async Task Cannot_process_for_unknown_operation_code() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs index f24e25a216..0ad82fbb2b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs @@ -65,7 +65,7 @@ public async Task Cannot_process_more_operations_than_maximum() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs index 09596c2f00..237716e238 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs @@ -51,7 +51,7 @@ public async Task Cannot_create_resource_with_multiple_violations() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -104,7 +104,7 @@ public async Task Cannot_create_resource_when_violation_from_custom_ValidationAt // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -168,7 +168,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().Id.ShouldNotBeNull()); @@ -176,7 +176,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(newPlaylistId); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(existingTrack.Id); }); } @@ -222,7 +222,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -348,7 +348,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(existingPlaylist.Id); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(existingTrack.Id); }); } @@ -459,7 +459,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(existingPlaylist.Id); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(existingTrack.Id); }); } @@ -509,7 +509,7 @@ public async Task Validates_all_operations_before_execution_starts() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -593,7 +593,7 @@ public async Task Does_not_exceed_MaxModelValidationErrors() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(3); + responseDocument.Errors.Should().HaveCount(3); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs index e979e164c9..cbda80ebb2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs @@ -53,7 +53,7 @@ public async Task Cannot_include_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -93,7 +93,7 @@ public async Task Cannot_filter_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -133,7 +133,7 @@ public async Task Cannot_sort_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -173,7 +173,7 @@ public async Task Cannot_use_pagination_number_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -213,7 +213,7 @@ public async Task Cannot_use_pagination_size_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -253,7 +253,7 @@ public async Task Cannot_use_sparse_fieldset_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -290,7 +290,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(musicTracks[2].StringId); } @@ -327,7 +327,7 @@ public async Task Cannot_use_Queryable_handler_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs index 8e3c2ac7f9..f398f4a813 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs @@ -88,7 +88,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -109,7 +109,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); - companiesInDatabase.ShouldHaveCount(2); + companiesInDatabase.Should().HaveCount(2); companiesInDatabase[0].Name.Should().Be(newCompanies[0].Name.ToUpperInvariant()); companiesInDatabase[0].CountryOfResidence.Should().Be(newCompanies[0].CountryOfResidence); @@ -181,7 +181,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); hitCounter.HitExtensibilityPoints.Should().BeEmpty(); } @@ -240,7 +240,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -261,7 +261,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); - companiesInDatabase.ShouldHaveCount(2); + companiesInDatabase.Should().HaveCount(2); companiesInDatabase[0].Name.Should().Be(existingCompanies[0].Name); companiesInDatabase[0].CountryOfResidence.Should().Be(existingCompanies[0].CountryOfResidence); @@ -332,7 +332,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); hitCounter.HitExtensibilityPoints.Should().BeEmpty(); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs index 983a9c5213..9409013f29 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs @@ -86,7 +86,7 @@ public async Task Hides_text_in_create_resource_with_side_effects() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -165,7 +165,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(2); + responseDocument.Results.Should().HaveCount(2); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs index b4f393d901..f4030857f3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs @@ -88,7 +88,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -168,7 +168,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs index 4b5a6afc1b..e4feb21a18 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs @@ -64,7 +64,7 @@ public async Task Cannot_use_non_transactional_repository() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -107,7 +107,7 @@ public async Task Cannot_use_transactional_repository_without_active_transaction // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -150,7 +150,7 @@ public async Task Cannot_use_distributed_transaction() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs index e59b9d24d5..d4bfc2479b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs @@ -62,7 +62,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -146,7 +146,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Performers.ShouldHaveCount(3); + trackInDatabase.Performers.Should().HaveCount(3); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingTrack.Performers[0].Id); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[0].Id); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[1].Id); @@ -226,7 +226,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(existingPlaylist.Id); - playlistInDatabase.Tracks.ShouldHaveCount(3); + playlistInDatabase.Tracks.Should().HaveCount(3); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingPlaylist.Tracks[0].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[0].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[1].Id); @@ -257,7 +257,7 @@ public async Task Cannot_add_for_href_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -296,7 +296,7 @@ public async Task Cannot_add_for_missing_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -336,7 +336,7 @@ public async Task Cannot_add_for_unknown_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -375,7 +375,7 @@ public async Task Cannot_add_for_missing_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -433,7 +433,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -474,7 +474,7 @@ public async Task Cannot_add_for_ID_and_local_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -513,7 +513,7 @@ public async Task Cannot_add_for_missing_relationship_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -553,7 +553,7 @@ public async Task Cannot_add_for_unknown_relationship_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -601,7 +601,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -650,7 +650,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -701,7 +701,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -748,7 +748,7 @@ public async Task Cannot_add_for_missing_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -796,7 +796,7 @@ public async Task Cannot_add_for_unknown_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -843,7 +843,7 @@ public async Task Cannot_add_for_missing_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -892,7 +892,7 @@ public async Task Cannot_add_for_ID_and_local_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -959,7 +959,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1021,7 +1021,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1077,7 +1077,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(existingTrack.Performers[0].Id); }); } @@ -1124,7 +1124,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs index f7bf47e989..b3bced11d2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs @@ -62,7 +62,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -144,11 +144,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(existingTrack.Performers[1].Id); List performersInDatabase = await dbContext.Performers.ToListAsync(); - performersInDatabase.ShouldHaveCount(3); + performersInDatabase.Should().HaveCount(3); }); } @@ -223,12 +223,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(existingPlaylist.Id); - playlistInDatabase.Tracks.ShouldHaveCount(1); + playlistInDatabase.Tracks.Should().HaveCount(1); playlistInDatabase.Tracks[0].Id.Should().Be(existingPlaylist.Tracks[1].Id); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(3); + tracksInDatabase.Should().HaveCount(3); }); } @@ -256,7 +256,7 @@ public async Task Cannot_remove_for_href_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -295,7 +295,7 @@ public async Task Cannot_remove_for_missing_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -335,7 +335,7 @@ public async Task Cannot_remove_for_unknown_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -374,7 +374,7 @@ public async Task Cannot_remove_for_missing_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -432,7 +432,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -473,7 +473,7 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -513,7 +513,7 @@ public async Task Cannot_remove_for_unknown_relationship_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -561,7 +561,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -610,7 +610,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -661,7 +661,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -708,7 +708,7 @@ public async Task Cannot_remove_for_missing_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -756,7 +756,7 @@ public async Task Cannot_remove_for_unknown_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -803,7 +803,7 @@ public async Task Cannot_remove_for_missing_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -852,7 +852,7 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -919,7 +919,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -981,7 +981,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1038,7 +1038,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(existingTrack.Performers[0].Id); }); } @@ -1085,7 +1085,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs index c8e093f9ff..4c4e75ca11 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs @@ -68,7 +68,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Performers.Should().BeEmpty(); List performersInDatabase = await dbContext.Performers.ToListAsync(); - performersInDatabase.ShouldHaveCount(2); + performersInDatabase.Should().HaveCount(2); }); } @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(2); + tracksInDatabase.Should().HaveCount(2); }); } @@ -187,12 +187,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Performers.ShouldHaveCount(2); + trackInDatabase.Performers.Should().HaveCount(2); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[0].Id); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[1].Id); List performersInDatabase = await dbContext.Performers.ToListAsync(); - performersInDatabase.ShouldHaveCount(3); + performersInDatabase.Should().HaveCount(3); }); } @@ -257,13 +257,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(existingPlaylist.Id); - playlistInDatabase.Tracks.ShouldHaveCount(2); + playlistInDatabase.Tracks.Should().HaveCount(2); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[0].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[1].Id); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(3); + tracksInDatabase.Should().HaveCount(3); }); } @@ -291,7 +291,7 @@ public async Task Cannot_replace_for_href_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -330,7 +330,7 @@ public async Task Cannot_replace_for_missing_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -370,7 +370,7 @@ public async Task Cannot_replace_for_unknown_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -409,7 +409,7 @@ public async Task Cannot_replace_for_missing_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -467,7 +467,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -525,7 +525,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -566,7 +566,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -606,7 +606,7 @@ public async Task Cannot_replace_for_unknown_relationship_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -654,7 +654,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -703,7 +703,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -754,7 +754,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -801,7 +801,7 @@ public async Task Cannot_replace_for_missing_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -849,7 +849,7 @@ public async Task Cannot_replace_for_unknown_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -896,7 +896,7 @@ public async Task Cannot_replace_for_missing_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -945,7 +945,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1012,7 +1012,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1074,7 +1074,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1130,7 +1130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1183,7 +1183,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs index e9f99c6171..504196b009 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs @@ -68,7 +68,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => lyricInDatabase.Track.Should().BeNull(); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(1); + tracksInDatabase.Should().HaveCount(1); }); } @@ -121,7 +121,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Lyric.Should().BeNull(); List lyricsInDatabase = await dbContext.Lyrics.ToListAsync(); - lyricsInDatabase.ShouldHaveCount(1); + lyricsInDatabase.Should().HaveCount(1); }); } @@ -174,7 +174,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.OwnedBy.Should().BeNull(); List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); - companiesInDatabase.ShouldHaveCount(1); + companiesInDatabase.Should().HaveCount(1); }); } @@ -396,7 +396,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(2); + tracksInDatabase.Should().HaveCount(2); }); } @@ -456,7 +456,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); List lyricsInDatabase = await dbContext.Lyrics.ToListAsync(); - lyricsInDatabase.ShouldHaveCount(2); + lyricsInDatabase.Should().HaveCount(2); }); } @@ -516,7 +516,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); - companiesInDatabase.ShouldHaveCount(2); + companiesInDatabase.Should().HaveCount(2); }); } @@ -544,7 +544,7 @@ public async Task Cannot_create_for_href_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -583,7 +583,7 @@ public async Task Cannot_create_for_missing_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -623,7 +623,7 @@ public async Task Cannot_create_for_unknown_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -662,7 +662,7 @@ public async Task Cannot_create_for_missing_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -717,7 +717,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -770,7 +770,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -811,7 +811,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -851,7 +851,7 @@ public async Task Cannot_create_for_unknown_relationship_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -899,7 +899,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -955,7 +955,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -999,7 +999,7 @@ public async Task Cannot_create_for_missing_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1044,7 +1044,7 @@ public async Task Cannot_create_for_unknown_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1088,7 +1088,7 @@ public async Task Cannot_create_for_missing_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1134,7 +1134,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1189,7 +1189,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1242,7 +1242,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1295,7 +1295,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1348,7 +1348,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs index 17778fc0a6..521c482707 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs @@ -73,7 +73,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Performers.Should().BeEmpty(); List performersInDatabase = await dbContext.Performers.ToListAsync(); - performersInDatabase.ShouldHaveCount(2); + performersInDatabase.Should().HaveCount(2); }); } @@ -132,7 +132,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(2); + tracksInDatabase.Should().HaveCount(2); }); } @@ -202,12 +202,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Performers).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Performers.ShouldHaveCount(2); + trackInDatabase.Performers.Should().HaveCount(2); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[0].Id); trackInDatabase.Performers.Should().ContainSingle(performer => performer.Id == existingPerformers[1].Id); List performersInDatabase = await dbContext.Performers.ToListAsync(); - performersInDatabase.ShouldHaveCount(3); + performersInDatabase.Should().HaveCount(3); }); } @@ -277,13 +277,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Playlist playlistInDatabase = await dbContext.Playlists.Include(playlist => playlist.Tracks).FirstWithIdAsync(existingPlaylist.Id); - playlistInDatabase.Tracks.ShouldHaveCount(2); + playlistInDatabase.Tracks.Should().HaveCount(2); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[0].Id); playlistInDatabase.Tracks.Should().ContainSingle(musicTrack => musicTrack.Id == existingTracks[1].Id); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(3); + tracksInDatabase.Should().HaveCount(3); }); } @@ -329,7 +329,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -383,7 +383,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -491,7 +491,7 @@ public async Task Cannot_replace_for_missing_type_in_relationship_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -544,7 +544,7 @@ public async Task Cannot_replace_for_unknown_type_in_relationship_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -596,7 +596,7 @@ public async Task Cannot_replace_for_missing_ID_in_relationship_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -650,7 +650,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_relationship_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -722,7 +722,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -789,7 +789,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -850,7 +850,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs index 29a3e10fd5..d06b9713c5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs @@ -89,7 +89,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(elementCount); + tracksInDatabase.Should().HaveCount(elementCount); for (int index = 0; index < elementCount; index++) { @@ -200,7 +200,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -313,7 +313,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -542,7 +542,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); string isoCode = $"{newIsoCode}{ImplicitlyChangingTextLanguageDefinition.Suffix}"; @@ -598,7 +598,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { @@ -631,7 +631,7 @@ public async Task Cannot_update_resource_for_href_element() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -737,7 +737,7 @@ public async Task Cannot_update_resource_for_missing_type_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -786,7 +786,7 @@ public async Task Cannot_update_resource_for_missing_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -837,7 +837,7 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_ref() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -871,7 +871,7 @@ public async Task Cannot_update_resource_for_missing_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -906,7 +906,7 @@ public async Task Cannot_update_resource_for_null_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -960,7 +960,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1004,7 +1004,7 @@ public async Task Cannot_update_resource_for_missing_type_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1048,7 +1048,7 @@ public async Task Cannot_update_resource_for_missing_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1094,7 +1094,7 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1144,7 +1144,7 @@ public async Task Cannot_update_on_resource_type_mismatch_between_ref_and_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1197,7 +1197,7 @@ public async Task Cannot_update_on_resource_ID_mismatch_between_ref_and_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1247,7 +1247,7 @@ public async Task Cannot_update_on_resource_local_ID_mismatch_between_ref_and_da // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1299,7 +1299,7 @@ public async Task Cannot_update_on_mixture_of_ID_and_local_ID_between_ref_and_da // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1351,7 +1351,7 @@ public async Task Cannot_update_on_mixture_of_local_ID_and_ID_between_ref_and_da // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1396,7 +1396,7 @@ public async Task Cannot_update_resource_for_unknown_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1443,7 +1443,7 @@ public async Task Cannot_update_resource_for_unknown_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1492,7 +1492,7 @@ public async Task Cannot_update_resource_for_incompatible_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1543,7 +1543,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1594,7 +1594,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1645,7 +1645,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1760,7 +1760,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.OwnedBy.ShouldNotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); - trackInDatabase.Performers.ShouldHaveCount(1); + trackInDatabase.Performers.Should().HaveCount(1); trackInDatabase.Performers[0].Id.Should().Be(existingPerformer.Id); }); } @@ -1805,7 +1805,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs index 0206ef1e9c..05ba62e66e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs @@ -73,7 +73,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => lyricInDatabase.Track.Should().BeNull(); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(1); + tracksInDatabase.Should().HaveCount(1); }); } @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Lyric.Should().BeNull(); List lyricsInDatabase = await dbContext.Lyrics.ToListAsync(); - lyricsInDatabase.ShouldHaveCount(1); + lyricsInDatabase.Should().HaveCount(1); }); } @@ -189,7 +189,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.OwnedBy.Should().BeNull(); List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); - companiesInDatabase.ShouldHaveCount(1); + companiesInDatabase.Should().HaveCount(1); }); } @@ -431,7 +431,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); - tracksInDatabase.ShouldHaveCount(2); + tracksInDatabase.Should().HaveCount(2); }); } @@ -496,7 +496,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); List lyricsInDatabase = await dbContext.Lyrics.ToListAsync(); - lyricsInDatabase.ShouldHaveCount(2); + lyricsInDatabase.Should().HaveCount(2); }); } @@ -561,7 +561,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); - companiesInDatabase.ShouldHaveCount(2); + companiesInDatabase.Should().HaveCount(2); }); } @@ -605,7 +605,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -658,7 +658,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -719,7 +719,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -768,7 +768,7 @@ public async Task Cannot_create_for_missing_type_in_relationship_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -818,7 +818,7 @@ public async Task Cannot_create_for_unknown_type_in_relationship_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -867,7 +867,7 @@ public async Task Cannot_create_for_missing_ID_in_relationship_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -918,7 +918,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_relationship_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -978,7 +978,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1036,7 +1036,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1094,7 +1094,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs index 330ea277df..8a8c5d39ce 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs @@ -86,7 +86,7 @@ public async Task Cannot_create_resources_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -137,7 +137,7 @@ public async Task Cannot_create_resource_with_read_scope() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -195,7 +195,7 @@ public async Task Cannot_update_resources_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -253,7 +253,7 @@ public async Task Cannot_update_resource_with_relationships_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -300,7 +300,7 @@ public async Task Cannot_delete_resources_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -340,7 +340,7 @@ public async Task Cannot_update_ToOne_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -380,7 +380,7 @@ public async Task Cannot_update_ToMany_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -420,7 +420,7 @@ public async Task Cannot_add_to_ToMany_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -460,7 +460,7 @@ public async Task Cannot_remove_from_ToMany_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs index c1004c3e21..f2cfbf5f5e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs @@ -34,7 +34,7 @@ public async Task Cannot_get_primary_resources_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -58,7 +58,7 @@ public async Task Cannot_get_primary_resources_with_incorrect_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -92,7 +92,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("movies"); responseDocument.Data.ManyValue[0].Id.Should().Be(movie.StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldNotBeEmpty(); @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("genres"); responseDocument.Data.ManyValue[0].Id.Should().Be(genre.StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldNotBeEmpty(); @@ -152,7 +152,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("actors"); responseDocument.Data.ManyValue[0].Id.Should().Be(actor.StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldNotBeEmpty(); @@ -171,7 +171,7 @@ public async Task Cannot_get_primary_resource_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -193,7 +193,7 @@ public async Task Cannot_get_secondary_resource_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -215,7 +215,7 @@ public async Task Cannot_get_secondary_resources_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -237,7 +237,7 @@ public async Task Cannot_get_ToOne_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -259,7 +259,7 @@ public async Task Cannot_get_ToMany_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -283,7 +283,7 @@ public async Task Cannot_include_with_insufficient_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -307,7 +307,7 @@ public async Task Cannot_filter_with_insufficient_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -331,7 +331,7 @@ public async Task Cannot_sort_with_insufficient_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs index 1db9a7cf36..914a0605b7 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs @@ -48,7 +48,7 @@ public async Task Cannot_create_resource_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -108,7 +108,7 @@ public async Task Cannot_create_resource_with_relationships_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -171,7 +171,7 @@ public async Task Cannot_create_resource_with_relationships_with_read_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -208,7 +208,7 @@ public async Task Cannot_update_resource_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -267,7 +267,7 @@ public async Task Cannot_update_resource_with_relationships_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -289,7 +289,7 @@ public async Task Cannot_delete_resource_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -320,7 +320,7 @@ public async Task Cannot_update_ToOne_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -354,7 +354,7 @@ public async Task Cannot_update_ToMany_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -388,7 +388,7 @@ public async Task Cannot_add_to_ToMany_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); @@ -422,7 +422,7 @@ public async Task Cannot_remove_from_ToMany_relationship_without_scopes() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Unauthorized); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs index 01e8b18fb7..51e3beee7a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs @@ -49,7 +49,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(car.StringId); } @@ -99,7 +99,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(car.StringId); } @@ -124,7 +124,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(car.StringId); } @@ -327,7 +327,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Dealership dealershipInDatabase = await dbContext.Dealerships.Include(dealership => dealership.Inventory).FirstWithIdAsync(existingDealership.Id); - dealershipInDatabase.Inventory.ShouldHaveCount(1); + dealershipInDatabase.Inventory.Should().HaveCount(1); dealershipInDatabase.Inventory.Should().ContainSingle(car => car.Id == existingDealership.Inventory.ElementAt(1).Id); }); } @@ -372,7 +372,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Dealership dealershipInDatabase = await dbContext.Dealerships.Include(dealership => dealership.Inventory).FirstWithIdAsync(existingDealership.Id); - dealershipInDatabase.Inventory.ShouldHaveCount(1); + dealershipInDatabase.Inventory.Should().HaveCount(1); dealershipInDatabase.Inventory.Should().ContainSingle(car => car.Id == existingCar.Id); }); } @@ -424,7 +424,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Dealership dealershipInDatabase = await dbContext.Dealerships.Include(dealership => dealership.Inventory).FirstWithIdAsync(existingDealership.Id); - dealershipInDatabase.Inventory.ShouldHaveCount(2); + dealershipInDatabase.Inventory.Should().HaveCount(2); dealershipInDatabase.Inventory.Should().ContainSingle(car => car.Id == existingCar.Id); dealershipInDatabase.Inventory.Should().ContainSingle(car => car.Id == existingDealership.Inventory.ElementAt(0).Id); }); @@ -465,7 +465,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -545,11 +545,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Dealership dealershipInDatabase = await dbContext.Dealerships.Include(dealership => dealership.SoldCars).FirstWithIdAsync(existingDealership.Id); - dealershipInDatabase.SoldCars.ShouldHaveCount(1); + dealershipInDatabase.SoldCars.Should().HaveCount(1); dealershipInDatabase.SoldCars.Single().Id.Should().Be(existingDealership.SoldCars.ElementAt(0).Id); List carsInDatabase = await dbContext.Cars.ToListAsync(); - carsInDatabase.ShouldHaveCount(2); + carsInDatabase.Should().HaveCount(2); }); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs index 6927e811c9..0a7cdcb61a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs @@ -202,7 +202,7 @@ public async Task Denies_JsonApi_with_parameters_in_Accept_headers() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotAcceptable); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotAcceptable); @@ -249,7 +249,7 @@ public async Task Denies_no_Accept_headers_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotAcceptable); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotAcceptable); @@ -295,7 +295,7 @@ public async Task Denies_JsonApi_in_Accept_headers_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotAcceptable); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotAcceptable); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs index 19948c0092..1fa82874b1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs @@ -138,7 +138,7 @@ public async Task Denies_unknown_ContentType_header() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); @@ -183,7 +183,7 @@ public async Task Denies_unknown_ContentType_header_at_operations_endpoint() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); string detail = $"Use '{JsonApiMediaType.AtomicOperations}' or '{JsonApiMediaType.RelaxedAtomicOperations}' instead of 'text/html' for the Content-Type header value."; @@ -324,7 +324,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); string detail = $"Use '{JsonApiMediaType.AtomicOperations}' or '{JsonApiMediaType.RelaxedAtomicOperations}' instead of '{contentType}' for the Content-Type header value."; @@ -404,7 +404,7 @@ public async Task Denies_JsonApi_ContentType_header_with_unknown_extension() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); @@ -442,7 +442,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); @@ -480,7 +480,7 @@ public async Task Denies_JsonApi_ContentType_header_with_relaxed_AtomicOperation httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); @@ -518,7 +518,7 @@ public async Task Denies_JsonApi_ContentType_header_with_profile() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); @@ -556,7 +556,7 @@ public async Task Denies_JsonApi_ContentType_header_with_CharSet() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); @@ -594,7 +594,7 @@ public async Task Denies_JsonApi_ContentType_header_with_unknown_parameter() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); @@ -639,7 +639,7 @@ public async Task Denies_JsonApi_ContentType_header_at_operations_endpoint() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); string detail = $"Use '{JsonApiMediaType.AtomicOperations}' or '{JsonApiMediaType.RelaxedAtomicOperations}' instead of '{contentType}' for the Content-Type header value."; diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs index b5f6367b73..7e78ddbdc6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs @@ -141,7 +141,7 @@ public async Task Denies_extensions_mismatch_between_ContentType_and_Accept_head // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotAcceptable); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); string detail = $"Include '{JsonApiMediaType.AtomicOperations}' or '{ServerTimeMediaTypes.AtomicOperationsWithServerTime}' or " + $"'{JsonApiMediaType.RelaxedAtomicOperations}' or '{ServerTimeMediaTypes.RelaxedAtomicOperationsWithRelaxedServerTime}' in the Accept header values."; diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs index 3a991dc13d..54222aab8e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs @@ -270,7 +270,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); string detail = $"Use '{JsonApiMediaType.Default}' or '{ServerTimeMediaTypes.ServerTime}' or " + $"'{ServerTimeMediaTypes.RelaxedServerTime}' instead of '{contentType}' for the Content-Type header value."; @@ -318,7 +318,7 @@ public async Task Denies_JsonApi_ContentType_header_with_relaxed_ServerTime_at_o httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); string detail = $"Use '{JsonApiMediaType.AtomicOperations}' or '{ServerTimeMediaTypes.AtomicOperationsWithServerTime}' or " + $"'{JsonApiMediaType.RelaxedAtomicOperations}' or '{ServerTimeMediaTypes.RelaxedAtomicOperationsWithRelaxedServerTime}' " + diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs index b11c31623c..3686eaa63a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs @@ -53,7 +53,7 @@ public async Task Converts_empty_ActionResult_to_error_collection() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -73,7 +73,7 @@ public async Task Converts_ActionResult_with_error_object_to_error_collection() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -93,7 +93,7 @@ public async Task Cannot_convert_ActionResult_with_string_parameter_to_error_col // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.InternalServerError); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.InternalServerError); @@ -113,7 +113,7 @@ public async Task Converts_ObjectResult_with_error_object_to_error_collection() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadGateway); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadGateway); @@ -133,7 +133,7 @@ public async Task Converts_ObjectResult_with_error_objects_to_error_collection() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(3); + responseDocument.Errors.Should().HaveCount(3); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.PreconditionFailed); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeLogTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeLogTests.cs index 69c71e5d82..132fa446b1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeLogTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeLogTests.cs @@ -35,7 +35,7 @@ public void Logs_warning_at_startup_when_ApiControllerAttribute_found() // Assert IReadOnlyList logLines = _loggerProvider.GetLines(); - logLines.ShouldHaveCount(1); + logLines.Should().HaveCount(1); logLines[0].Should().Be( $"[WARNING] Found JSON:API controller '{typeof(CiviliansController)}' with [ApiController]. Please remove this attribute for optimal JSON:API compliance."); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs index a27ef77329..8fd2509f78 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs @@ -29,7 +29,7 @@ public async Task ApiController_attribute_transforms_NotFound_action_result_with // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.Links.ShouldNotBeNull(); @@ -61,7 +61,7 @@ public async Task ProblemDetails_from_invalid_ModelState_is_translated_into_erro // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs index 92ba48b2f9..c3c88c8bed 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs @@ -84,7 +84,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(5); + responseDocument.Data.ManyValue.Should().HaveCount(5); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "towns"); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.ShouldNotBeNull().Count > 0); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldNotBeNull().Count > 0); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs index 353417d1ba..e07dbb78f8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs @@ -120,7 +120,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(street.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("windowTotalCount").With(value => value.Should().Be(3)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -154,7 +154,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(state.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(state.Name)); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("cities"); responseDocument.Included[0].Id.Should().Be(state.Cities[0].StringId); @@ -193,16 +193,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(state.Cities[0].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(state.Cities[0].Name)); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("streets"); responseDocument.Included[0].Id.Should().Be(state.Cities[0].Streets[0].StringId); - responseDocument.Included[0].Attributes.ShouldHaveCount(2); + responseDocument.Included[0].Attributes.Should().HaveCount(2); responseDocument.Included[0].Attributes.ShouldContainKey("doorTotalCount").With(value => value.Should().Be(2)); responseDocument.Included[0].Attributes.ShouldContainKey("windowTotalCount").With(value => value.Should().Be(1)); responseDocument.Included[0].Relationships.Should().BeNull(); @@ -326,7 +326,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => buildingInDatabase.PrimaryDoor.ShouldNotBeNull(); buildingInDatabase.PrimaryDoor.Color.Should().Be(newPrimaryDoorColor); buildingInDatabase.SecondaryDoor.ShouldNotBeNull(); - buildingInDatabase.Windows.ShouldHaveCount(2); + buildingInDatabase.Windows.Should().HaveCount(2); }); } @@ -364,7 +364,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs index 66096c667e..ba4ba08ee1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs @@ -64,7 +64,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Gone); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Gone); @@ -80,7 +80,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().BeNull(); IReadOnlyList logMessages = loggerProvider.GetMessages(); - logMessages.ShouldHaveCount(1); + logMessages.Should().HaveCount(1); logMessages[0].LogLevel.Should().Be(LogLevel.Warning); logMessages[0].Text.Should().Contain("Article with code 'X123' is no longer available."); @@ -103,7 +103,7 @@ public async Task Logs_and_produces_error_response_on_deserialization_failure() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -151,7 +151,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.InternalServerError); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.InternalServerError); @@ -169,7 +169,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().BeNull(); IReadOnlyList logMessages = loggerProvider.GetMessages(); - logMessages.ShouldHaveCount(1); + logMessages.Should().HaveCount(1); logMessages[0].LogLevel.Should().Be(LogLevel.Error); logMessages[0].Text.Should().Contain("Exception has been thrown by the target of an invocation."); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs index 397da59595..816f349354 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Prev.Should().BeNull(); responseDocument.Links.Next.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -71,7 +71,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string paintingLink = $"{HostPrefix}/iis-application-virtual-directory/custom/path/to/paintings-of-the-world/{gallery.Paintings.ElementAt(0).StringId}"; - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -118,7 +118,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Prev.Should().BeNull(); responseDocument.Links.Next.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -136,7 +136,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs index 02b0001268..c557f566a3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs @@ -41,7 +41,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(accounts[1].StringId); } @@ -58,7 +58,7 @@ public async Task Cannot_filter_equality_for_invalid_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -90,7 +90,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(accounts[1].StringId); } @@ -106,7 +106,7 @@ public async Task Cannot_get_primary_resource_for_invalid_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -160,7 +160,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(account.Cards[0].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(account.Cards[1].StringId); } @@ -189,9 +189,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(account.Cards[0].StringId); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Relationships.Should().BeNull(); } @@ -216,7 +216,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(account.Cards[0].StringId); } @@ -346,7 +346,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => accountInDatabase.Iban.Should().Be(newIban); - accountInDatabase.Cards.ShouldHaveCount(1); + accountInDatabase.Cards.Should().HaveCount(1); accountInDatabase.Cards[0].Id.Should().Be(existingCard.Id); accountInDatabase.Cards[0].StringId.Should().Be(existingCard.StringId); }); @@ -394,7 +394,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { BankAccount accountInDatabase = await dbContext.BankAccounts.Include(account => account.Cards).FirstWithIdAsync(existingAccount.Id); - accountInDatabase.Cards.ShouldHaveCount(2); + accountInDatabase.Cards.Should().HaveCount(2); }); } @@ -437,7 +437,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { BankAccount accountInDatabase = await dbContext.BankAccounts.Include(account => account.Cards).FirstWithIdAsync(existingAccount.Id); - accountInDatabase.Cards.ShouldHaveCount(1); + accountInDatabase.Cards.Should().HaveCount(1); }); } @@ -487,7 +487,7 @@ public async Task Cannot_delete_unknown_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs index 68e7207e4a..49c659c79d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs @@ -43,7 +43,7 @@ public async Task Cannot_create_resource_with_omitted_required_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -78,7 +78,7 @@ public async Task Cannot_create_resource_with_null_for_required_attribute_value( // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -113,7 +113,7 @@ public async Task Cannot_create_resource_with_invalid_attribute_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -153,7 +153,7 @@ public async Task Cannot_create_resource_with_invalid_DateOnly_TimeOnly_attribut // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -225,7 +225,7 @@ public async Task Cannot_create_resource_with_multiple_violations() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -265,7 +265,7 @@ public async Task Does_not_exceed_MaxModelValidationErrors() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(3); + responseDocument.Errors.Should().HaveCount(3); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -472,7 +472,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -522,7 +522,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -567,7 +567,7 @@ public async Task Cannot_update_resource_with_invalid_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs index 41133fd27f..3658ab8ad5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs @@ -123,7 +123,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs index 290a168fb1..c8c13bb65c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs @@ -71,7 +71,7 @@ public async Task Cannot_create_in_invalid_stage() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -117,7 +117,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs index a58f68219f..503937e430 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs @@ -104,7 +104,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -216,7 +216,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -300,7 +300,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Links.Should().BeNull(); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); } @@ -377,7 +377,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{albumLink}/photos"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -462,7 +462,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{photoLink}/album"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs index aaa62c1338..72d45b9cab 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs @@ -104,7 +104,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -216,7 +216,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -300,7 +300,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Links.Should().BeNull(); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); } @@ -377,7 +377,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{albumLink}/photos"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -462,7 +462,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{photoLink}/album"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs index a7a033d17d..a7b69ba196 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs @@ -48,7 +48,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.ShouldNotBeNull(); }); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().ContainSingle(resource => resource.Type == "photos").Subject.With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs index 50920697f0..7dc8c5687e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs @@ -61,7 +61,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Should().BeNull(); }); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs index 27a432f261..0aab640ccf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs @@ -104,7 +104,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -216,7 +216,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -300,7 +300,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Links.Should().BeNull(); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); } @@ -377,7 +377,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{albumLink}/photos"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -462,7 +462,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{photoLink}/album"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs index 37f24c4ceb..afc98e58b2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs @@ -104,7 +104,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -216,7 +216,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -300,7 +300,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Links.Should().BeNull(); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); } @@ -377,7 +377,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{albumLink}/photos"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -462,7 +462,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.Should().Be($"{photoLink}/album"); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs index 6913e57761..95e53fc2f7 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs @@ -56,7 +56,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Meta.ShouldContainKey("hasHighPriority"); responseDocument.Data.ManyValue[1].Meta.Should().BeNull(); responseDocument.Data.ManyValue[2].Meta.ShouldContainKey("hasHighPriority"); @@ -95,7 +95,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Meta.ShouldContainKey("hasHighPriority"); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs index c37f65b9eb..218da5b454 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs @@ -49,7 +49,7 @@ public async Task Create_group_sends_messages() (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -128,7 +128,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(3); + messageBroker.SentMessages.Should().HaveCount(3); Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -193,7 +193,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); var content = messageBroker.SentMessages[0].GetContentAs(); content.GroupId.Should().Be(existingGroup.StringId); @@ -278,7 +278,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(3); + messageBroker.SentMessages.Should().HaveCount(3); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUserWithoutGroup.Id); @@ -325,7 +325,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); var content = messageBroker.SentMessages[0].GetContentAs(); content.GroupId.Should().Be(existingGroup.StringId); @@ -363,7 +363,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingGroup.Users.ElementAt(0).Id); @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(3); + messageBroker.SentMessages.Should().HaveCount(3); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUserWithoutGroup.Id); @@ -512,7 +512,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUserWithoutGroup.Id); @@ -575,7 +575,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); var content = messageBroker.SentMessages[0].GetContentAs(); content.UserId.Should().Be(existingUserWithSameGroup2.Id); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs index 0f8c75e7a1..f24f660d7e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs @@ -52,7 +52,7 @@ public async Task Create_user_sends_messages() (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -185,7 +185,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -254,7 +254,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -326,7 +326,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -400,7 +400,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -444,7 +444,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); var content = messageBroker.SentMessages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); @@ -482,7 +482,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(2); + messageBroker.SentMessages.Should().HaveCount(2); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -531,7 +531,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); var content = messageBroker.SentMessages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); @@ -581,7 +581,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); var content = messageBroker.SentMessages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); @@ -633,7 +633,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); var content = messageBroker.SentMessages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.cs index e025b7caad..b9ed0b5df4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.cs @@ -53,7 +53,7 @@ public async Task Does_not_send_message_on_write_error() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -94,7 +94,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.ServiceUnavailable); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.ServiceUnavailable); @@ -107,7 +107,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - messageBroker.SentMessages.ShouldHaveCount(1); + messageBroker.SentMessages.Should().HaveCount(1); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs index 86c01c83b1..631aaf075c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs @@ -59,7 +59,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.GroupId.Should().Be(newGroupId); @@ -142,7 +142,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(3); + messages.Should().HaveCount(3); var content1 = messages[0].GetContentAs(); content1.GroupId.Should().Be(newGroupId); @@ -209,7 +209,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.GroupId.Should().Be(existingGroup.StringId); @@ -298,7 +298,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(3); + messages.Should().HaveCount(3); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUserWithoutGroup.Id); @@ -349,7 +349,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.GroupId.Should().Be(existingGroup.StringId); @@ -391,7 +391,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingGroup.Users.ElementAt(0).Id); @@ -471,7 +471,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(3); + messages.Should().HaveCount(3); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUserWithoutGroup.Id); @@ -548,7 +548,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUserWithoutGroup.Id); @@ -615,7 +615,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.UserId.Should().Be(existingUserWithSameGroup2.Id); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs index d4c64ab622..9312aee66e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs @@ -62,7 +62,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.UserId.Should().Be(newUserId); @@ -136,7 +136,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(newUserId); @@ -201,7 +201,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -274,7 +274,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -350,7 +350,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -428,7 +428,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -476,7 +476,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); @@ -518,7 +518,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(2); + messages.Should().HaveCount(2); var content1 = messages[0].GetContentAs(); content1.UserId.Should().Be(existingUser.Id); @@ -571,7 +571,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); @@ -625,7 +625,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); @@ -681,7 +681,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => await _testContext.RunOnDatabaseAsync(async dbContext => { List messages = await dbContext.OutboxMessages.OrderBy(message => message.Id).ToListAsync(); - messages.ShouldHaveCount(1); + messages.Should().HaveCount(1); var content = messages[0].GetContentAs(); content.UserId.Should().Be(existingUser.Id); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.cs index c0d43533f3..7f4b1f072c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.cs @@ -79,7 +79,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs index 530186d540..f70f276e2f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs @@ -62,7 +62,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(shops[1].StringId); } @@ -92,7 +92,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(shops[1].StringId); } @@ -122,11 +122,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("webShops"); responseDocument.Data.ManyValue[0].Id.Should().Be(shops[1].StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webProducts"); responseDocument.Included[0].Id.Should().Be(shops[1].Products[0].StringId); } @@ -152,7 +152,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -182,7 +182,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -212,7 +212,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -242,7 +242,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -371,7 +371,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -425,7 +425,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -518,7 +518,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -574,7 +574,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -627,7 +627,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -662,7 +662,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -707,7 +707,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -742,7 +742,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -784,7 +784,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -829,7 +829,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -873,7 +873,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -915,7 +915,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -977,7 +977,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1016,7 +1016,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Prev.Should().BeNull(); responseDocument.Links.Next.Should().BeNull(); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].With(resource => { @@ -1034,7 +1034,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs index c3e6c30fe4..0935400343 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs @@ -41,7 +41,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "swimming-pools"); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.ShouldContainKey("is-indoor") != null); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldContainKey("water-slides") != null); @@ -49,7 +49,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => decimal height = pools[1].DivingBoards[0].HeightInMeters; - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("diving-boards"); responseDocument.Included[0].Id.Should().Be(pools[1].DivingBoards[0].StringId); responseDocument.Included[0].Attributes.ShouldContainKey("height-in-meters").With(value => value.As().Should().BeApproximately(height)); @@ -83,10 +83,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("water-slides"); responseDocument.Data.ManyValue[0].Id.Should().Be(pool.WaterSlides[1].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); } [Fact] @@ -160,7 +160,7 @@ public async Task Applies_casing_convention_on_error_stack_trace() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -201,7 +201,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs index 22ed5abc87..22d6712926 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs @@ -42,7 +42,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "SwimmingPools"); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.ShouldContainKey("IsIndoor") != null); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldContainKey("WaterSlides") != null); @@ -50,7 +50,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => decimal height = pools[1].DivingBoards[0].HeightInMeters; - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("DivingBoards"); responseDocument.Included[0].Id.Should().Be(pools[1].DivingBoards[0].StringId); responseDocument.Included[0].Attributes.ShouldContainKey("HeightInMeters").With(value => value.As().Should().BeApproximately(height)); @@ -87,10 +87,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("WaterSlides"); responseDocument.Data.ManyValue[0].Id.Should().Be(pool.WaterSlides[1].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); } [Fact] @@ -164,7 +164,7 @@ public async Task Applies_casing_convention_on_error_stack_trace() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -205,7 +205,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs index 864b599a37..062517f564 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs @@ -51,7 +51,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterTests.cs index 024930c98b..fa991e7544 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); } @@ -86,7 +86,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[1].StringId); } @@ -118,11 +118,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blogs[1].Posts[1].StringId); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs index dfecb680db..7000ae1da8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs @@ -51,7 +51,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterTests.cs index dcd6b493ea..da5091eed5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); } @@ -86,7 +86,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[1].StringId); } @@ -118,11 +118,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blogs[1].Posts[1].StringId); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs index e7e16196e4..58257e837c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs @@ -47,7 +47,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortTests.cs index 1ac9b05824..078d48029a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); @@ -90,7 +90,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[2].StringId); @@ -129,7 +129,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); @@ -137,7 +137,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[1].Id.Should().Be(blogs[0].StringId); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blogs[1].Posts[1].StringId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs index d8ad2f04c3..0b82a4a6b9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs @@ -58,7 +58,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterTests.cs index d866964b82..0f25661029 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterTests.cs @@ -57,7 +57,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); } @@ -95,7 +95,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); } @@ -130,11 +130,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("blogs"); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[1].StringId); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs index 3cee32fe8b..c05707f627 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs @@ -72,7 +72,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); int[] matchingRowIndices = matchingRowsExpected.Split(',').Select(int.Parse).ToArray(); - responseDocument.Data.ManyValue.ShouldHaveCount(matchingRowIndices.Length); + responseDocument.Data.ManyValue.Should().HaveCount(matchingRowIndices.Length); foreach (int rowIndex in matchingRowIndices) { @@ -93,7 +93,7 @@ public async Task Cannot_filter_comparison_on_missing_relative_time() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -116,7 +116,7 @@ public async Task Cannot_filter_comparison_on_invalid_relative_time() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -139,7 +139,7 @@ public async Task Cannot_filter_comparison_on_relative_time_at_left_side() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -162,7 +162,7 @@ public async Task Cannot_filter_any_on_relative_time() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -185,7 +185,7 @@ public async Task Cannot_filter_text_match_on_relative_time() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(calendar.Appointments.ElementAt(1).StringId); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs index 9bacb8097e..4cc6a7b880 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs @@ -71,7 +71,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey(attributeName).With(value => value.Should().Be(value)); } @@ -99,7 +99,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDecimal").With(value => value.Should().Be(resource.SomeDecimal)); } @@ -127,7 +127,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someGuid").With(value => value.Should().Be(resource.SomeGuid)); } @@ -155,7 +155,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInLocalZone") .With(value => value.Should().Be(resource.SomeDateTimeInLocalZone)); @@ -185,7 +185,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInUtcZone") .With(value => value.Should().Be(resource.SomeDateTimeInUtcZone)); @@ -215,7 +215,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeOffset").With(value => value.Should().Be(resource.SomeDateTimeOffset)); } @@ -243,7 +243,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeSpan").With(value => value.Should().Be(resource.SomeTimeSpan)); } @@ -271,7 +271,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateOnly").With(value => value.Should().Be(resource.SomeDateOnly)); } @@ -299,7 +299,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeOnly").With(value => value.Should().Be(resource.SomeTimeOnly)); } @@ -328,7 +328,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -392,7 +392,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey(attributeName).With(value => value.Should().BeNull()); } @@ -446,7 +446,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey(attributeName).With(value => value.Should().NotBeNull()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs index 6b9f74be19..84d972efd1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs @@ -50,7 +50,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); } @@ -74,7 +74,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -107,7 +107,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[1].StringId); } @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -166,11 +166,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().ContainSingle(post => post.Id == posts[1].StringId); responseDocument.Data.ManyValue.Should().ContainSingle(post => post.Id == posts[2].StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(posts[1].Author!.StringId); } @@ -196,7 +196,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); } @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); } @@ -251,7 +251,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); } @@ -282,7 +282,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); } @@ -310,9 +310,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(blog.Posts[1].StringId); } @@ -342,7 +342,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(blog.Owner.Posts[1].StringId); } @@ -373,9 +373,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(posts[1].Labels.First().StringId); } @@ -404,9 +404,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blog.Owner.StringId); @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[0].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(posts[2].StringId); } @@ -480,7 +480,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[0].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(posts[1].StringId); } @@ -522,10 +522,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); - responseDocument.Included.ShouldHaveCount(3); + responseDocument.Included.Should().HaveCount(3); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blogs[1].Owner!.StringId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs index 222ce40af4..99a34f087a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs @@ -83,7 +83,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someString").With(value => value.Should().Be(resource.SomeString)); responseDocument.Links.ShouldNotBeNull(); @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("otherInt32").With(value => value.Should().Be(resource.OtherInt32)); } @@ -158,7 +158,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someNullableInt32").With(value => value.Should().Be(resource.SomeNullableInt32)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("otherNullableInt32").With(value => value.Should().Be(resource.OtherNullableInt32)); } @@ -194,7 +194,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someNullableInt32").With(value => value.Should().Be(resource.SomeNullableInt32)); } @@ -230,7 +230,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someNullableInt32").With(value => value.Should().Be(resource.SomeNullableInt32)); } @@ -266,7 +266,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someUnsignedInt64").With(value => value.Should().Be(resource.SomeUnsignedInt64)); } @@ -283,7 +283,7 @@ public async Task Cannot_filter_equality_on_two_attributes_of_incompatible_types // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -330,7 +330,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); } @@ -372,7 +372,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDouble").With(value => value.Should().Be(resource.SomeDouble)); } @@ -422,7 +422,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInLocalZone") .With(value => value.Should().Be(resource.SomeDateTimeInLocalZone)); @@ -474,7 +474,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInUtcZone") .With(value => value.Should().Be(resource.SomeDateTimeInUtcZone)); @@ -526,7 +526,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeOffset").With(value => value.Should().Be(resource.SomeDateTimeOffset)); } @@ -568,7 +568,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeSpan").With(value => value.Should().Be(resource.SomeTimeSpan)); } @@ -617,7 +617,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateOnly").With(value => value.Should().Be(resource.SomeDateOnly)); } @@ -658,7 +658,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeOnly").With(value => value.Should().Be(resource.SomeTimeOnly)); } @@ -696,7 +696,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someString").With(value => value.Should().Be(resource.SomeString)); } @@ -713,7 +713,7 @@ public async Task Cannot_filter_text_match_on_non_string_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -736,7 +736,7 @@ public async Task Cannot_filter_text_match_on_nested_non_string_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -778,7 +778,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someString").With(value => value.Should().Be(resource.SomeString)); } @@ -809,7 +809,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(resource.StringId); } @@ -856,7 +856,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(resources[1].StringId); } @@ -888,7 +888,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(resource.StringId); } @@ -925,7 +925,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(resource.Children.ElementAt(0).StringId); } @@ -942,7 +942,7 @@ public async Task Cannot_filter_on_count_with_incompatible_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -989,7 +989,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(resource1.StringId); } @@ -1029,7 +1029,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(resource1.StringId); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs index 5f5c0cbeef..bacd2f353d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs @@ -37,7 +37,7 @@ public async Task Cannot_filter_in_unknown_scope() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -60,7 +60,7 @@ public async Task Cannot_filter_in_unknown_nested_scope() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -83,7 +83,7 @@ public async Task Cannot_filter_on_attribute_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -106,7 +106,7 @@ public async Task Cannot_filter_on_ToMany_relationship_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -137,7 +137,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(accounts[0].StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(accounts[0].UserName)); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs index 6030600791..7d37d180c5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs @@ -49,11 +49,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(post.Author.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(post.Author.DisplayName)); @@ -84,7 +84,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(post.Author.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(post.Author.DisplayName)); @@ -116,7 +116,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Owner.DisplayName)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Owner.Posts[0].StringId); responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Owner.Posts[0].Caption)); @@ -144,11 +144,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Posts[0].Caption)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].Author!.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Posts[0].Author!.DisplayName)); @@ -180,7 +180,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Text)); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(comment.Author.StringId); @@ -218,7 +218,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => DateTime createdAt = post.Comments.Single().CreatedAt; - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("comments"); responseDocument.Included[0].Id.Should().Be(post.Comments.Single().StringId); responseDocument.Included[0].Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(createdAt)); @@ -249,7 +249,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("labels"); responseDocument.Included[0].Id.Should().Be(post.Labels.Single().StringId); responseDocument.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(post.Labels.Single().Name)); @@ -276,12 +276,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("labels"); responseDocument.Data.ManyValue[0].Id.Should().Be(post.Labels.ElementAt(0).StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(post.Labels.Single().Name)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(post.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); @@ -314,7 +314,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Text)); - responseDocument.Included.ShouldHaveCount(3); + responseDocument.Included.Should().HaveCount(3); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(comment.Parent.StringId); @@ -357,7 +357,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(blog.Title)); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].StringId); @@ -398,7 +398,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Text)); - responseDocument.Included.ShouldHaveCount(4); + responseDocument.Included.Should().HaveCount(4); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(comment.Parent.StringId); @@ -456,7 +456,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); }); - responseDocument.Included.ShouldHaveCount(7); + responseDocument.Included.Should().HaveCount(7); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].StringId); @@ -588,7 +588,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[0].Id.Should().Be(post1.StringId); @@ -628,7 +628,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(person.StringId); }); - responseDocument.Included.ShouldHaveCount(7); + responseDocument.Included.Should().HaveCount(7); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(author.StringId); @@ -732,7 +732,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); }); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].StringId); @@ -785,7 +785,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(account.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(account.UserName)); @@ -816,9 +816,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(account.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(account.UserName)); @@ -862,7 +862,7 @@ public async Task Cannot_include_unknown_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -885,7 +885,7 @@ public async Task Cannot_include_unknown_nested_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -908,7 +908,7 @@ public async Task Cannot_include_relationship_when_inclusion_blocked() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -931,7 +931,7 @@ public async Task Cannot_include_relationship_when_nested_inclusion_blocked() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -1015,7 +1015,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().NotContainKey("appointments"); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("appointments"); responseDocument.Included[0].Id.Should().Be(calendar.MostRecentAppointment.StringId); } @@ -1042,23 +1042,23 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.ShouldContainKey("reviewer") != null); ResourceObject[] postWithReviewer = responseDocument.Data.ManyValue .Where(resource => resource.Relationships!.First(pair => pair.Key == "reviewer").Value!.Data.SingleValue != null).ToArray(); - postWithReviewer.ShouldHaveCount(1); + postWithReviewer.Should().HaveCount(1); postWithReviewer[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(posts[0].Caption)); ResourceObject[] postWithoutReviewer = responseDocument.Data.ManyValue .Where(resource => resource.Relationships!.First(pair => pair.Key == "reviewer").Value!.Data.SingleValue == null).ToArray(); - postWithoutReviewer.ShouldHaveCount(1); + postWithoutReviewer.Should().HaveCount(1); postWithoutReviewer[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(posts[1].Caption)); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(posts[0].Reviewer!.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(posts[0].Reviewer!.UserName)); @@ -1104,7 +1104,7 @@ public async Task Cannot_exceed_configured_maximum_inclusion_depth() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs index 6cb1b9f851..c80c2e260e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs @@ -54,7 +54,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); responseDocument.Links.ShouldNotBeNull(); @@ -85,7 +85,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -119,7 +119,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[2].StringId); responseDocument.Links.ShouldNotBeNull(); @@ -151,7 +151,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(account.LoginAttempts[1].StringId); responseDocument.Links.ShouldNotBeNull(); @@ -182,7 +182,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -215,8 +215,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(blogs[0].Posts[1].StringId); responseDocument.Included[1].Id.Should().Be(blogs[1].Posts[1].StringId); @@ -252,7 +252,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(blog.Owner.Posts[1].StringId); responseDocument.Links.ShouldNotBeNull(); @@ -284,7 +284,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[1].StringId); responseDocument.Links.ShouldNotBeNull(); @@ -316,7 +316,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(account.LoginAttempts[1].StringId); string basePath = $"{HostPrefix}/webAccounts/{account.StringId}/relationships/loginAttempts"; @@ -352,8 +352,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(posts[0].Labels.ElementAt(1).StringId); responseDocument.Included[1].Id.Should().Be(posts[1].Labels.ElementAt(1).StringId); @@ -388,7 +388,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.Labels.ElementAt(1).StringId); responseDocument.Links.ShouldNotBeNull(); @@ -424,10 +424,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); - responseDocument.Included.ShouldHaveCount(3); + responseDocument.Included.Should().HaveCount(3); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blogs[1].Owner!.StringId); @@ -461,7 +461,7 @@ public async Task Cannot_paginate_in_unknown_scope() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -484,7 +484,7 @@ public async Task Cannot_paginate_in_unknown_nested_scope() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -519,11 +519,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(blog.Posts[1].StringId); - responseDocument.Included.ShouldHaveCount(4); + responseDocument.Included.Should().HaveCount(4); responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); @@ -557,7 +557,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(25); + responseDocument.Data.ManyValue.Should().HaveCount(25); responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs index 29d9aa146a..57bd6e508b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs @@ -159,7 +159,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(DefaultPageSize); + responseDocument.Data.ManyValue.Should().HaveCount(DefaultPageSize); responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); @@ -190,7 +190,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(DefaultPageSize); + responseDocument.Data.ManyValue.Should().HaveCount(DefaultPageSize); responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs index f551f4b108..f921ac29b1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs @@ -39,7 +39,7 @@ public async Task Cannot_use_negative_page_number() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -62,7 +62,7 @@ public async Task Cannot_use_zero_page_number() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -122,7 +122,7 @@ public async Task Cannot_use_negative_page_size() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs index 5a8d375543..5ed5105ba1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs @@ -68,7 +68,7 @@ public async Task Cannot_use_page_number_over_maximum() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -91,7 +91,7 @@ public async Task Cannot_use_zero_page_size() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -143,7 +143,7 @@ public async Task Cannot_use_page_size_over_maximum() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs index 4f6ee95ad2..a0044f6b3a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs @@ -34,7 +34,7 @@ public async Task Cannot_use_unknown_query_string_parameter() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -100,7 +100,7 @@ public async Task Cannot_use_empty_query_string_parameter_value(string parameter // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs index 89db819a2c..2ad12e79cf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs @@ -54,7 +54,7 @@ await RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); if (expectNullValueInDocument) { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs index 0afda4b48e..9041fbaaa2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs @@ -47,7 +47,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(posts[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(posts[2].StringId); @@ -73,7 +73,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -107,7 +107,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(blog.Posts[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(blog.Posts[2].StringId); @@ -133,7 +133,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -166,7 +166,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(blogs[0].StringId); } @@ -194,7 +194,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(posts[0].StringId); } @@ -226,7 +226,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); - responseDocument.Included.ShouldHaveCount(3); + responseDocument.Included.Should().HaveCount(3); responseDocument.Included[0].Id.Should().Be(account.Posts[1].StringId); responseDocument.Included[1].Id.Should().Be(account.Posts[0].StringId); responseDocument.Included[2].Id.Should().Be(account.Posts[2].StringId); @@ -260,7 +260,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); - responseDocument.Included.ShouldHaveCount(3); + responseDocument.Included.Should().HaveCount(3); responseDocument.Included[0].Id.Should().Be(blog.Owner.Posts[1].StringId); responseDocument.Included[1].Id.Should().Be(blog.Owner.Posts[0].StringId); responseDocument.Included[2].Id.Should().Be(blog.Owner.Posts[2].StringId); @@ -293,7 +293,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Included.ShouldHaveCount(3); + responseDocument.Included.Should().HaveCount(3); responseDocument.Included[0].Id.Should().Be(post.Labels.ElementAt(1).StringId); responseDocument.Included[1].Id.Should().Be(post.Labels.ElementAt(0).StringId); responseDocument.Included[2].Id.Should().Be(post.Labels.ElementAt(2).StringId); @@ -337,11 +337,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(blogs[0].StringId); - responseDocument.Included.ShouldHaveCount(7); + responseDocument.Included.Should().HaveCount(7); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blogs[0].Posts[2].StringId); @@ -391,7 +391,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(posts[0].StringId); } @@ -428,11 +428,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(blogs[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(blogs[0].StringId); - responseDocument.Included.ShouldHaveCount(5); + responseDocument.Included.Should().HaveCount(5); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blogs[1].Owner!.StringId); @@ -463,7 +463,7 @@ public async Task Cannot_sort_in_unknown_scope() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -486,7 +486,7 @@ public async Task Cannot_sort_in_unknown_nested_scope() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -509,7 +509,7 @@ public async Task Cannot_sort_on_attribute_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -547,7 +547,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Id.Should().Be(accounts[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(accounts[2].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(accounts[0].StringId); @@ -578,7 +578,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue[0].Id.Should().Be(accounts[2].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(accounts[1].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(accounts[0].StringId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs index 1c7477d22d..6627bae4f2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs @@ -56,11 +56,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); - responseDocument.Data.ManyValue[0].Relationships.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("author").With(value => { @@ -100,9 +100,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); @@ -135,10 +135,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); responseDocument.Data.ManyValue[0].Attributes.Should().BeNull(); - responseDocument.Data.ManyValue[0].Relationships.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("author").With(value => { @@ -178,11 +178,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Posts[0].Caption)); - responseDocument.Data.ManyValue[0].Relationships.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("labels").With(value => { @@ -197,7 +197,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => blogCaptured.Id.Should().Be(blog.Id); blogCaptured.Title.Should().BeNull(); - blogCaptured.Posts.ShouldHaveCount(1); + blogCaptured.Posts.Should().HaveCount(1); blogCaptured.Posts[0].Caption.Should().Be(blog.Posts[0].Caption); blogCaptured.Posts[0].Url.Should().BeNull(); } @@ -227,9 +227,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("url").With(value => value.Should().Be(post.Url)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("author").With(value => { @@ -284,11 +284,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.ShouldNotBeNull(); }); - responseDocument.Included.ShouldHaveCount(1); - responseDocument.Included[0].Attributes.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(2); responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(post.Author.DisplayName)); responseDocument.Included[0].Attributes.ShouldContainKey("emailAddress").With(value => value.Should().Be(post.Author.EmailAddress)); - responseDocument.Included[0].Relationships.ShouldHaveCount(1); + responseDocument.Included[0].Relationships.Should().HaveCount(1); responseDocument.Included[0].Relationships.ShouldContainKey("preferences").With(value => { @@ -340,17 +340,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(1); + value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(account.Posts[0].StringId); value.Links.ShouldNotBeNull(); value.Links.Self.ShouldNotBeNull(); value.Links.Related.ShouldNotBeNull(); }); - responseDocument.Included.ShouldHaveCount(1); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(account.Posts[0].Caption)); - responseDocument.Included[0].Relationships.ShouldHaveCount(1); + responseDocument.Included[0].Relationships.Should().HaveCount(1); responseDocument.Included[0].Relationships.ShouldContainKey("labels").With(value => { @@ -365,7 +365,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => accountCaptured.Id.Should().Be(account.Id); accountCaptured.DisplayName.Should().Be(account.DisplayName); - accountCaptured.Posts.ShouldHaveCount(1); + accountCaptured.Posts.Should().HaveCount(1); accountCaptured.Posts[0].Caption.Should().Be(account.Posts[0].Caption); accountCaptured.Posts[0].Url.Should().BeNull(); } @@ -402,17 +402,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(1); + value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(blog.Owner.Posts[0].StringId); value.Links.ShouldNotBeNull(); value.Links.Self.ShouldNotBeNull(); value.Links.Related.ShouldNotBeNull(); }); - responseDocument.Included.ShouldHaveCount(1); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Owner.Posts[0].Caption)); - responseDocument.Included[0].Relationships.ShouldHaveCount(1); + responseDocument.Included[0].Relationships.Should().HaveCount(1); responseDocument.Included[0].Relationships.ShouldContainKey("comments").With(value => { @@ -428,7 +428,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => blogCaptured.Owner.ShouldNotBeNull(); blogCaptured.Owner.DisplayName.Should().Be(blog.Owner.DisplayName); - blogCaptured.Owner.Posts.ShouldHaveCount(1); + blogCaptured.Owner.Posts.Should().HaveCount(1); blogCaptured.Owner.Posts[0].Caption.Should().Be(blog.Owner.Posts[0].Caption); blogCaptured.Owner.Posts[0].Url.Should().BeNull(); } @@ -464,15 +464,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.ShouldContainKey("labels").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(1); + value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(post.Labels.ElementAt(0).StringId); value.Links.ShouldNotBeNull(); value.Links.Self.ShouldNotBeNull(); value.Links.Related.ShouldNotBeNull(); }); - responseDocument.Included.ShouldHaveCount(1); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("color").With(value => value.Should().Be(post.Labels.Single().Color)); responseDocument.Included[0].Relationships.Should().BeNull(); @@ -480,7 +480,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => postCaptured.Id.Should().Be(post.Id); postCaptured.Caption.Should().Be(post.Caption); - postCaptured.Labels.ShouldHaveCount(1); + postCaptured.Labels.Should().HaveCount(1); postCaptured.Labels.Single().Color.Should().Be(post.Labels.Single().Color); postCaptured.Labels.Single().Name.Should().BeNull(); } @@ -513,22 +513,22 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(blog.Title)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blog.Owner.StringId); - responseDocument.Included[0].Attributes.ShouldHaveCount(2); + responseDocument.Included[0].Attributes.Should().HaveCount(2); responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(blog.Owner.UserName)); responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Owner.DisplayName)); responseDocument.Included[0].Relationships.Should().BeNull(); responseDocument.Included[1].Type.Should().Be("blogPosts"); responseDocument.Included[1].Id.Should().Be(blog.Owner.Posts[0].StringId); - responseDocument.Included[1].Attributes.ShouldHaveCount(1); + responseDocument.Included[1].Attributes.Should().HaveCount(1); responseDocument.Included[1].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Owner.Posts[0].Caption)); responseDocument.Included[1].Relationships.Should().BeNull(); @@ -541,7 +541,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => blogCaptured.Owner.DisplayName.Should().Be(blog.Owner.DisplayName); blogCaptured.Owner.DateOfBirth.Should().BeNull(); - blogCaptured.Owner.Posts.ShouldHaveCount(1); + blogCaptured.Owner.Posts.Should().HaveCount(1); blogCaptured.Owner.Posts[0].Caption.Should().Be(blog.Owner.Posts[0].Caption); blogCaptured.Owner.Posts[0].Url.Should().BeNull(); } @@ -574,9 +574,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(blog.Title)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("owner").With(value => { @@ -588,7 +588,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.ShouldNotBeNull(); }); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blog.Owner.StringId); @@ -599,7 +599,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.ShouldContainKey("posts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(1); + value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(blog.Owner.Posts[0].StringId); value.Links.ShouldNotBeNull(); value.Links.Self.ShouldNotBeNull(); @@ -650,9 +650,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldHaveCount(1); + responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); @@ -686,7 +686,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); responseDocument.Data.ManyValue[0].Attributes.Should().BeNull(); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); @@ -709,7 +709,7 @@ public async Task Cannot_select_on_unknown_resource_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -734,7 +734,7 @@ public async Task Cannot_select_attribute_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -759,7 +759,7 @@ public async Task Cannot_select_ToOne_relationship_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -784,7 +784,7 @@ public async Task Cannot_select_ToMany_relationship_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -820,7 +820,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("showAdvertisements").With(value => value.Should().Be(blog.ShowAdvertisements)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); @@ -855,10 +855,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(2); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("url").With(value => value.Should().Be(post.Url)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("author").With(value => { @@ -900,7 +900,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().OnlyContain(resourceObject => resourceObject.Type == "blogPosts"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs index f3aa021389..5e9983bd2d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs @@ -280,7 +280,7 @@ public async Task Cannot_create_resource_with_unknown_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -367,7 +367,7 @@ public async Task Cannot_create_resource_with_unknown_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -452,7 +452,7 @@ public async Task Cannot_create_resource_with_client_generated_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -480,7 +480,7 @@ public async Task Cannot_create_resource_for_missing_request_body() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -504,7 +504,7 @@ public async Task Cannot_create_resource_for_null_request_body() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -534,7 +534,7 @@ public async Task Cannot_create_resource_for_missing_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -561,7 +561,7 @@ public async Task Cannot_create_resource_for_null_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -595,7 +595,7 @@ public async Task Cannot_create_resource_for_array_data() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -628,7 +628,7 @@ public async Task Cannot_create_resource_for_missing_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -662,7 +662,7 @@ public async Task Cannot_create_resource_for_unknown_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -720,7 +720,7 @@ public async Task Cannot_create_on_resource_type_mismatch_between_url_and_body() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -755,7 +755,7 @@ public async Task Cannot_create_resource_with_readonly_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -780,7 +780,7 @@ public async Task Cannot_create_resource_for_broken_JSON_request_body() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -814,7 +814,7 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -919,10 +919,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => workItemInDatabase.Assignee.ShouldNotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccounts[0].Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingUserAccounts[1].Id); - workItemInDatabase.Tags.ShouldHaveCount(1); + workItemInDatabase.Tags.Should().HaveCount(1); workItemInDatabase.Tags.Single().Id.Should().Be(existingTag.Id); }); } @@ -951,7 +951,7 @@ public async Task Cannot_assign_attribute_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs index d4cd2afa1d..4fec0164ad 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs @@ -121,7 +121,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(newGroup.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(groupName)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); @@ -330,7 +330,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -373,7 +373,7 @@ public async Task Cannot_create_resource_with_client_generated_zero_guid_ID(Clie // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -416,7 +416,7 @@ public async Task Cannot_create_resource_with_client_generated_empty_guid_ID(Cli // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -511,7 +511,7 @@ public async Task Cannot_create_resource_with_client_generated_zero_long_ID(Clie // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -555,7 +555,7 @@ public async Task Cannot_create_resource_with_client_generated_empty_long_ID(Cli // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -608,7 +608,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs index 8a83a14884..acf706a202 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs @@ -79,7 +79,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Subscribers.ShouldHaveCount(2); + workItemInDatabase.Subscribers.Should().HaveCount(2); workItemInDatabase.Subscribers.Should().ContainSingle(subscriber => subscriber.Id == existingUserAccounts[0].Id); workItemInDatabase.Subscribers.Should().ContainSingle(subscriber => subscriber.Id == existingUserAccounts[1].Id); }); @@ -136,7 +136,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().OnlyContain(resource => resource.Type == "userAccounts"); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[1].StringId); @@ -150,7 +150,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Subscribers.ShouldHaveCount(2); + workItemInDatabase.Subscribers.Should().HaveCount(2); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingUserAccounts[0].Id); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingUserAccounts[1].Id); }); @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().OnlyContain(resource => resource.Type == "userAccounts"); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[1].StringId); @@ -221,7 +221,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Subscribers.ShouldHaveCount(2); + workItemInDatabase.Subscribers.Should().HaveCount(2); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingUserAccounts[0].Id); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingUserAccounts[1].Id); }); @@ -286,20 +286,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(newWorkItem.Priority)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("tags").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(3); + value.Data.ManyValue.Should().HaveCount(3); value.Data.ManyValue[0].Id.Should().Be(existingTags[0].StringId); value.Data.ManyValue[1].Id.Should().Be(existingTags[1].StringId); value.Data.ManyValue[2].Id.Should().Be(existingTags[2].StringId); }); - responseDocument.Included.ShouldHaveCount(3); + responseDocument.Included.Should().HaveCount(3); responseDocument.Included.Should().OnlyContain(resource => resource.Type == "workTags"); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingTags[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingTags[1].StringId); @@ -314,7 +314,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Tags).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Tags.ShouldHaveCount(3); + workItemInDatabase.Tags.Should().HaveCount(3); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingTags[0].Id); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingTags[1].Id); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingTags[2].Id); @@ -354,7 +354,7 @@ public async Task Cannot_create_for_missing_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -399,7 +399,7 @@ public async Task Cannot_create_for_unknown_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -443,7 +443,7 @@ public async Task Cannot_create_for_missing_relationship_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -503,7 +503,7 @@ public async Task Cannot_create_for_unknown_relationship_IDs() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -552,7 +552,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -614,7 +614,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); @@ -624,7 +624,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingUserAccount.Id); }); } @@ -655,7 +655,7 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -693,7 +693,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -733,7 +733,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -781,7 +781,7 @@ public async Task Cannot_create_resource_with_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -826,7 +826,7 @@ public async Task Cannot_assign_relationship_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs index 88989016b1..a2650e1c50 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs @@ -202,7 +202,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); @@ -266,9 +266,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newWorkItem.Description)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("assignee").With(value => { @@ -277,7 +277,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(existingUserAccount.StringId); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); @@ -329,7 +329,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -374,7 +374,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -427,7 +427,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -468,7 +468,7 @@ public async Task Cannot_create_for_missing_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -510,7 +510,7 @@ public async Task Cannot_create_for_unknown_relationship_type() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -551,7 +551,7 @@ public async Task Cannot_create_for_missing_relationship_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -595,7 +595,7 @@ public async Task Cannot_create_with_unknown_relationship_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -636,7 +636,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -700,7 +700,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccounts[1].StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccounts[1].FirstName)); @@ -752,7 +752,7 @@ public async Task Cannot_create_resource_with_local_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -794,7 +794,7 @@ public async Task Cannot_assign_relationship_with_blocked_capability() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs index de1d1c3ca8..5b942c1904 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs @@ -65,7 +65,7 @@ public async Task Cannot_delete_unknown_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs index 711e08d004..9f6ae8fe94 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs @@ -89,7 +89,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == userAccount.AssignedItems.ElementAt(0).StringId); item1.Type.Should().Be("workItems"); @@ -146,7 +146,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItem.Tags.ElementAt(0).StringId); item1.Type.Should().Be("workTags"); @@ -209,7 +209,7 @@ public async Task Cannot_get_relationship_for_unknown_primary_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -236,7 +236,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -263,7 +263,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs index 9aeeb8eb29..92ae3370c5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs @@ -41,7 +41,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItems[0].StringId); item1.Type.Should().Be("workItems"); @@ -131,7 +131,7 @@ public async Task Cannot_get_primary_resource_for_unknown_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -212,7 +212,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == userAccount.AssignedItems.ElementAt(0).StringId); item1.Type.Should().Be("workItems"); @@ -273,7 +273,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItem.Tags.ElementAt(0).StringId); item1.Type.Should().Be("workTags"); @@ -340,7 +340,7 @@ public async Task Cannot_get_secondary_resource_for_unknown_primary_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -369,7 +369,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -397,7 +397,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs index 250729c31d..0b59670d08 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -107,7 +107,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(3); + workItemInDatabase.Subscribers.Should().HaveCount(3); workItemInDatabase.Subscribers.Should().ContainSingle(subscriber => subscriber.Id == existingWorkItem.Subscribers.ElementAt(0).Id); workItemInDatabase.Subscribers.Should().ContainSingle(subscriber => subscriber.Id == existingWorkItem.Subscribers.ElementAt(1).Id); workItemInDatabase.Subscribers.Should().ContainSingle(subscriber => subscriber.Id == existingSubscriber.Id); @@ -164,13 +164,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => int tagId1 = existingWorkItems[0].Tags.ElementAt(0).Id; int tagId2 = existingWorkItems[1].Tags.ElementAt(0).Id; - workItemInDatabase1.Tags.ShouldHaveCount(2); + workItemInDatabase1.Tags.Should().HaveCount(2); workItemInDatabase1.Tags.Should().ContainSingle(workTag => workTag.Id == tagId1); workItemInDatabase1.Tags.Should().ContainSingle(workTag => workTag.Id == tagId2); WorkItem workItemInDatabase2 = workItemsInDatabase.Single(workItem => workItem.Id == existingWorkItems[1].Id); - workItemInDatabase2.Tags.ShouldHaveCount(1); + workItemInDatabase2.Tags.Should().HaveCount(1); workItemInDatabase2.Tags.ElementAt(0).Id.Should().Be(tagId2); }); } @@ -200,7 +200,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -232,7 +232,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -273,7 +273,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -316,7 +316,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -358,7 +358,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -409,7 +409,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -464,7 +464,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -549,7 +549,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -591,7 +591,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -633,7 +633,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -676,7 +676,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -731,7 +731,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingSubscriber.Id); }); } @@ -767,7 +767,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(0); + workItemInDatabase.Subscribers.Should().HaveCount(0); }); } @@ -795,7 +795,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -830,7 +830,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -868,7 +868,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -918,7 +918,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Children).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Children.ShouldHaveCount(2); + workItemInDatabase.Children.Should().HaveCount(2); workItemInDatabase.Children.Should().ContainSingle(workItem => workItem.Id == existingWorkItem.Children[0].Id); workItemInDatabase.Children.Should().ContainSingle(workItem => workItem.Id == existingWorkItem.Id); }); @@ -972,10 +972,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - workItemInDatabase.RelatedFrom.ShouldHaveCount(1); + workItemInDatabase.RelatedFrom.Should().HaveCount(1); workItemInDatabase.RelatedFrom.Should().OnlyContain(workItem => workItem.Id == existingWorkItem.Id); - workItemInDatabase.RelatedTo.ShouldHaveCount(2); + workItemInDatabase.RelatedTo.Should().HaveCount(2); workItemInDatabase.RelatedTo.Should().ContainSingle(workItem => workItem.Id == existingWorkItem.Id); workItemInDatabase.RelatedTo.Should().ContainSingle(workItem => workItem.Id == existingWorkItem.RelatedTo[0].Id); }); @@ -1013,7 +1013,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs index 612e9df143..ac6165df8e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs @@ -62,7 +62,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -118,11 +118,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingWorkItem.Subscribers.ElementAt(1).Id); List userAccountsInDatabase = await dbContext.UserAccounts.ToListAsync(); - userAccountsInDatabase.ShouldHaveCount(3); + userAccountsInDatabase.Should().HaveCount(3); }); } @@ -165,17 +165,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Should().BeEmpty(); - workItemDefinition.PreloadedSubscribers.ShouldHaveCount(1); + workItemDefinition.PreloadedSubscribers.Should().HaveCount(1); await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingWorkItem.Subscribers.ElementAt(1).Id); List userAccountsInDatabase = await dbContext.UserAccounts.ToListAsync(); - userAccountsInDatabase.ShouldHaveCount(3); + userAccountsInDatabase.Should().HaveCount(3); }); } @@ -226,11 +226,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Tags).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Tags.ShouldHaveCount(1); + workItemInDatabase.Tags.Should().HaveCount(1); workItemInDatabase.Tags.Single().Id.Should().Be(existingWorkItem.Tags.ElementAt(0).Id); List tagsInDatabase = await dbContext.WorkTags.ToListAsync(); - tagsInDatabase.ShouldHaveCount(3); + tagsInDatabase.Should().HaveCount(3); }); } @@ -273,17 +273,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Should().BeEmpty(); - workItemDefinition.PreloadedTags.ShouldHaveCount(1); + workItemDefinition.PreloadedTags.Should().HaveCount(1); await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Tags).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Tags.ShouldHaveCount(1); + workItemInDatabase.Tags.Should().HaveCount(1); workItemInDatabase.Tags.Single().Id.Should().Be(existingWorkItem.Tags.ElementAt(0).Id); List tagsInDatabase = await dbContext.WorkTags.ToListAsync(); - tagsInDatabase.ShouldHaveCount(3); + tagsInDatabase.Should().HaveCount(3); }); } @@ -312,7 +312,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -344,7 +344,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -386,7 +386,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -429,7 +429,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -471,7 +471,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -522,7 +522,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -577,7 +577,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -662,7 +662,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -704,7 +704,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -746,7 +746,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -789,7 +789,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -844,7 +844,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingWorkItem.Subscribers.ElementAt(1).Id); }); } @@ -881,7 +881,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingWorkItem.Subscribers.ElementAt(0).Id); }); } @@ -910,7 +910,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -945,7 +945,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -983,7 +983,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1036,7 +1036,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Children).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Children.ShouldHaveCount(1); + workItemInDatabase.Children.Should().HaveCount(1); workItemInDatabase.Children[0].Id.Should().Be(existingWorkItem.Children[0].Id); }); } @@ -1092,7 +1092,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - workItemInDatabase.RelatedFrom.ShouldHaveCount(1); + workItemInDatabase.RelatedFrom.Should().HaveCount(1); workItemInDatabase.RelatedFrom[0].Id.Should().Be(existingWorkItem.RelatedFrom[0].Id); workItemInDatabase.RelatedTo.Should().BeEmpty(); @@ -1131,7 +1131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs index 3e998a12e8..2bbc825cca 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs @@ -139,7 +139,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(2); + workItemInDatabase.Subscribers.Should().HaveCount(2); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingWorkItem.Subscribers.ElementAt(1).Id); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingSubscriber.Id); }); @@ -197,7 +197,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Tags).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Tags.ShouldHaveCount(3); + workItemInDatabase.Tags.Should().HaveCount(3); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingWorkItem.Tags.ElementAt(0).Id); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingTags[0].Id); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingTags[1].Id); @@ -229,7 +229,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -261,7 +261,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -302,7 +302,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -345,7 +345,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -387,7 +387,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -438,7 +438,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -495,7 +495,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -575,7 +575,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -617,7 +617,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -659,7 +659,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -702,7 +702,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -759,7 +759,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingSubscriber.Id); }); } @@ -788,7 +788,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -823,7 +823,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -861,7 +861,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1000,7 +1000,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Children).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Children.ShouldHaveCount(1); + workItemInDatabase.Children.Should().HaveCount(1); workItemInDatabase.Children[0].Id.Should().Be(existingWorkItem.Id); }); } @@ -1052,10 +1052,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - workItemInDatabase.RelatedFrom.ShouldHaveCount(1); + workItemInDatabase.RelatedFrom.Should().HaveCount(1); workItemInDatabase.RelatedFrom[0].Id.Should().Be(existingWorkItem.Id); - workItemInDatabase.RelatedTo.ShouldHaveCount(1); + workItemInDatabase.RelatedTo.Should().HaveCount(1); workItemInDatabase.RelatedTo[0].Id.Should().Be(existingWorkItem.Id); }); } @@ -1092,7 +1092,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs index 573489425e..7e9d8cd139 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs @@ -265,7 +265,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -297,7 +297,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -332,7 +332,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -375,7 +375,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -414,7 +414,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -454,7 +454,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -493,7 +493,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -535,7 +535,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -609,7 +609,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -648,7 +648,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -687,7 +687,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -727,7 +727,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -846,7 +846,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs index d982f48482..fe8a15d7f9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs @@ -175,7 +175,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(2); + workItemInDatabase.Subscribers.Should().HaveCount(2); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingWorkItem.Subscribers.ElementAt(1).Id); workItemInDatabase.Subscribers.Should().ContainSingle(userAccount => userAccount.Id == existingSubscriber.Id); }); @@ -244,7 +244,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Tags).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Tags.ShouldHaveCount(3); + workItemInDatabase.Tags.Should().HaveCount(3); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingWorkItem.Tags.ElementAt(0).Id); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingTags[0].Id); workItemInDatabase.Tags.Should().ContainSingle(workTag => workTag.Id == existingTags[1].Id); @@ -301,7 +301,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); @@ -312,7 +312,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingUserAccount.Id); }); } @@ -364,21 +364,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("tags").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(1); + value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(existingTag.StringId); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("workTags"); responseDocument.Included[0].Id.Should().Be(existingTag.StringId); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("text").With(value => value.Should().Be(existingTag.Text)); responseDocument.Included[0].Relationships.Should().BeNull(); @@ -388,7 +388,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Tags).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Tags.ShouldHaveCount(1); + workItemInDatabase.Tags.Should().HaveCount(1); workItemInDatabase.Tags.Single().Id.Should().Be(existingTag.Id); }); } @@ -435,7 +435,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -489,7 +489,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -542,7 +542,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -623,7 +623,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(4); + responseDocument.Errors.Should().HaveCount(4); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -689,7 +689,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -757,7 +757,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Subscribers).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingSubscriber.Id); }); } @@ -797,7 +797,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -844,7 +844,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -893,7 +893,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1061,7 +1061,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Children).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Children.ShouldHaveCount(1); + workItemInDatabase.Children.Should().HaveCount(1); workItemInDatabase.Children[0].Id.Should().Be(existingWorkItem.Id); }); } @@ -1124,10 +1124,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - workItemInDatabase.RelatedFrom.ShouldHaveCount(1); + workItemInDatabase.RelatedFrom.Should().HaveCount(1); workItemInDatabase.RelatedFrom[0].Id.Should().Be(existingWorkItem.Id); - workItemInDatabase.RelatedTo.ShouldHaveCount(1); + workItemInDatabase.RelatedTo.Should().HaveCount(1); workItemInDatabase.RelatedTo[0].Id.Should().Be(existingWorkItem.Id); }); } @@ -1175,7 +1175,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs index efd498c53c..2b9eb3d936 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs @@ -117,7 +117,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -217,7 +217,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -520,7 +520,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(2); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(itemDescription)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); @@ -577,22 +577,22 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(2); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(itemDescription)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("tags").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldHaveCount(1); + value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(existingWorkItem.Tags.Single().StringId); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("workTags"); responseDocument.Included[0].Id.Should().Be(existingWorkItem.Tags.Single().StringId); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("text").With(value => value.Should().Be(existingWorkItem.Tags.Single().Text)); responseDocument.Included[0].Relationships.Should().BeNull(); @@ -667,7 +667,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -699,7 +699,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -737,7 +737,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -772,7 +772,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -815,7 +815,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -854,7 +854,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -894,7 +894,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -933,7 +933,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -999,7 +999,7 @@ public async Task Cannot_update_resource_on_unknown_resource_ID_in_url() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1038,7 +1038,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1078,7 +1078,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1122,7 +1122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1155,7 +1155,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1198,7 +1198,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1241,7 +1241,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1288,7 +1288,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1399,10 +1399,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => workItemInDatabase.Assignee.ShouldNotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccounts[0].Id); - workItemInDatabase.Subscribers.ShouldHaveCount(1); + workItemInDatabase.Subscribers.Should().HaveCount(1); workItemInDatabase.Subscribers.Single().Id.Should().Be(existingUserAccounts[1].Id); - workItemInDatabase.Tags.ShouldHaveCount(1); + workItemInDatabase.Tags.Should().HaveCount(1); workItemInDatabase.Tags.Single().Id.Should().Be(existingTag.Id); }); } @@ -1492,13 +1492,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => workItemInDatabase.Parent.ShouldNotBeNull(); workItemInDatabase.Parent.Id.Should().Be(existingWorkItem.Id); - workItemInDatabase.Children.ShouldHaveCount(1); + workItemInDatabase.Children.Should().HaveCount(1); workItemInDatabase.Children.Single().Id.Should().Be(existingWorkItem.Id); - workItemInDatabase.RelatedFrom.ShouldHaveCount(1); + workItemInDatabase.RelatedFrom.Should().HaveCount(1); workItemInDatabase.RelatedFrom.Single().Id.Should().Be(existingWorkItem.Id); - workItemInDatabase.RelatedTo.ShouldHaveCount(1); + workItemInDatabase.RelatedTo.Should().HaveCount(1); workItemInDatabase.RelatedTo.Single().Id.Should().Be(existingWorkItem.Id); }); } @@ -1536,7 +1536,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs index f290d4b1bd..746e7d5bd0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs @@ -347,7 +347,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(description)); responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); @@ -411,9 +411,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(description)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("assignee").With(value => { @@ -422,10 +422,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(existingUserAccount.StringId); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); - responseDocument.Included[0].Attributes.ShouldHaveCount(1); + responseDocument.Included[0].Attributes.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); responseDocument.Included[0].Relationships.Should().BeNull(); @@ -472,7 +472,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -519,7 +519,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -574,7 +574,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -624,7 +624,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -675,7 +675,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -725,7 +725,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -778,7 +778,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -828,7 +828,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -979,7 +979,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs index 0e3ac0eecf..8eb4d23b0e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs @@ -53,7 +53,7 @@ public async Task Cannot_create_dependent_side_of_required_ManyToOne_relationshi // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(2); + responseDocument.Errors.Should().HaveCount(2); ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -96,7 +96,7 @@ public async Task Cannot_create_dependent_side_of_required_OneToOne_relationship // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -214,7 +214,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -251,7 +251,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs index 4163a0bade..b17ff01082 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs @@ -85,7 +85,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(postOffices[1].StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("address").With(value => value.Should().Be(postOffices[1].Address)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("isOpen").With(value => value.Should().Be(true)); @@ -117,7 +117,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(certificate.Issuer.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isOpen").With(value => value.Should().Be(true)); } @@ -180,7 +180,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(existingOffice.StringId); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].With(resource => { @@ -264,7 +264,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => officeInDatabase.Address.Should().Be(newAddress); - officeInDatabase.GiftCertificates.ShouldHaveCount(1); + officeInDatabase.GiftCertificates.Should().HaveCount(1); officeInDatabase.GiftCertificates[0].Id.Should().Be(existingOffice.GiftCertificates[0].Id); }); } @@ -313,7 +313,7 @@ public async Task Cannot_delete_unknown_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -362,7 +362,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { PostOffice officeInDatabase = await dbContext.PostOffices.Include(postOffice => postOffice.GiftCertificates).FirstWithIdAsync(existingOffice.Id); - officeInDatabase.GiftCertificates.ShouldHaveCount(2); + officeInDatabase.GiftCertificates.Should().HaveCount(2); }); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs index a7ff2a2f51..9ed6264857 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs @@ -67,7 +67,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(moon.IsGivenLightBy.StringId); }); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("stars"); responseDocument.Included[0].Id.Should().Be(moon.IsGivenLightBy.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(moon.IsGivenLightBy.Name)); @@ -172,7 +172,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("moons"); responseDocument.Included[0].Id.Should().Be(planet.Moons.ElementAt(0).StringId); @@ -233,7 +233,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(planets[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(planets[3].StringId); @@ -289,7 +289,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(planets[3].StringId); responseDocument.Meta.Should().ContainTotal(1); @@ -336,7 +336,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(star.Planets.ElementAt(1).StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(star.Planets.ElementAt(3).StringId); @@ -388,7 +388,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(star.Planets.ElementAt(1).StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(star.Planets.ElementAt(3).StringId); @@ -441,7 +441,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Id.Should().Be(stars[1].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(stars[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(stars[2].StringId); @@ -493,7 +493,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Id.Should().Be(stars[2].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(stars[0].StringId); responseDocument.Data.ManyValue[2].Id.Should().Be(stars[1].StringId); @@ -536,7 +536,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(5); + responseDocument.Data.ManyValue.Should().HaveCount(5); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -619,7 +619,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(2); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(star.Name)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("solarRadius").With(value => value.Should().Be(star.SolarRadius)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); @@ -700,7 +700,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(star.Name)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); @@ -745,7 +745,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(moons[1].StringId); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] @@ -802,7 +802,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(moons[2].StringId); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] @@ -843,7 +843,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs index adb00dbfbf..8a1e20e6b8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs @@ -59,7 +59,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => { @@ -110,9 +110,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Included.ShouldHaveCount(4); + responseDocument.Included.Should().HaveCount(4); responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => { @@ -218,7 +218,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => { @@ -309,7 +309,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => { @@ -434,7 +434,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => { @@ -572,7 +572,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Included.ShouldHaveCount(2); + responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => { @@ -649,7 +649,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(scholarship.Participants[0].StringId); responseDocument.Data.ManyValue[1].Id.Should().Be(scholarship.Participants[1].StringId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs index 9ce92fbd6f..552d76fa93 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs @@ -55,7 +55,7 @@ public async Task When_operation_is_enabled_on_base_type_it_is_implicitly_enable // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Results.ShouldHaveCount(1); + responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs index ec541d443d..cd39784fcf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs @@ -76,7 +76,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { @@ -85,7 +85,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/bikes/{bike.StringId}"); - resource.Attributes.ShouldHaveCount(3); + resource.Attributes.Should().HaveCount(3); resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(bike.Weight)); resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(bike.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(bike.GearCount)); @@ -108,7 +108,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); - resource.Attributes.ShouldHaveCount(4); + resource.Attributes.Should().HaveCount(4); resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(tandem.Weight)); resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(tandem.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); @@ -132,7 +132,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/cars/{car.StringId}"); - resource.Attributes.ShouldHaveCount(4); + resource.Attributes.Should().HaveCount(4); resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(car.Weight)); resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(car.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("licensePlate").With(value => value.Should().Be(car.LicensePlate)); @@ -156,7 +156,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/trucks/{truck.StringId}"); - resource.Attributes.ShouldHaveCount(4); + resource.Attributes.Should().HaveCount(4); resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(truck.Weight)); resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(truck.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("licensePlate").With(value => value.Should().Be(truck.LicensePlate)); @@ -199,7 +199,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { @@ -208,7 +208,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/bikes/{bike.StringId}"); - resource.Attributes.ShouldHaveCount(3); + resource.Attributes.Should().HaveCount(3); resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(bike.Weight)); resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(bike.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(bike.GearCount)); @@ -231,7 +231,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); - resource.Attributes.ShouldHaveCount(4); + resource.Attributes.Should().HaveCount(4); resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(tandem.Weight)); resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(tandem.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); @@ -274,7 +274,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "tandems").Subject.With(resource => { @@ -283,7 +283,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); - resource.Attributes.ShouldHaveCount(4); + resource.Attributes.Should().HaveCount(4); resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(tandem.Weight)); resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(tandem.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); @@ -460,13 +460,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}"); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(4); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(4); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isHydrocarbonBased").With(value => value.Should().Be(car.Engine.IsHydrocarbonBased)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("capacity").With(value => value.Should().Be(car.Engine.Capacity)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("serialCode").With(value => value.Should().Be(((GasolineEngine)car.Engine).SerialCode)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("volatility").With(value => value.Should().Be(((GasolineEngine)car.Engine).Volatility)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("cylinders").With(value => { @@ -507,7 +507,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Should().BeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(3); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(3); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("width").With(value => value.Should().Be(tandem.CargoBox.Width)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("height").With(value => value.Should().Be(tandem.CargoBox.Height)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("depth").With(value => value.Should().Be(tandem.CargoBox.Depth)); @@ -546,13 +546,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}"); - responseDocument.Data.SingleValue.Attributes.ShouldHaveCount(4); + responseDocument.Data.SingleValue.Attributes.Should().HaveCount(4); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isHydrocarbonBased").With(value => value.Should().Be(car.Engine.IsHydrocarbonBased)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("capacity").With(value => value.Should().Be(car.Engine.Capacity)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("serialCode").With(value => value.Should().Be(((GasolineEngine)car.Engine).SerialCode)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("volatility").With(value => value.Should().Be(((GasolineEngine)car.Engine).Volatility)); - responseDocument.Data.SingleValue.Relationships.ShouldHaveCount(1); + responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.ShouldContainKey("cylinders").With(value => { @@ -584,7 +584,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -614,7 +614,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -648,7 +648,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(0).StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(1).StringId); @@ -673,7 +673,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue) { - resource.Relationships.ShouldHaveCount(1); + resource.Relationships.Should().HaveCount(1); resource.Relationships.ShouldContainKey("vehicle").With(value => { @@ -709,7 +709,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should() .ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == tandem.Wheels.ElementAt(0).StringId); @@ -741,7 +741,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue) { - resource.Relationships.ShouldHaveCount(1); + resource.Relationships.Should().HaveCount(1); resource.Relationships.ShouldContainKey("vehicle").With(value => { @@ -778,7 +778,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(0).StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(1).StringId); @@ -803,7 +803,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue) { - resource.Relationships.ShouldHaveCount(1); + resource.Relationships.Should().HaveCount(1); resource.Relationships.ShouldContainKey("vehicle").With(value => { @@ -837,7 +837,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -867,7 +867,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -990,7 +990,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1025,7 +1025,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/vehicles/{car.StringId}/wheels"); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(0).StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(1).StringId); @@ -1063,7 +1063,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/bikes/{tandem.StringId}/wheels"); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should() .ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == tandem.Wheels.ElementAt(0).StringId); @@ -1109,7 +1109,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/cars/{car.StringId}/wheels"); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(0).StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "chromeWheels" && resource.Id == car.Wheels.ElementAt(1).StringId); @@ -1144,7 +1144,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1174,7 +1174,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1217,7 +1217,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { @@ -1280,7 +1280,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { @@ -1336,7 +1336,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { @@ -1379,7 +1379,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { @@ -2142,7 +2142,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes" && resource.Id == bike.StringId); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "tandems" && resource.Id == tandem.StringId); @@ -2177,7 +2177,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "trucks" && resource.Id == truck.StringId); } @@ -2209,7 +2209,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "trucks" && resource.Id == truck.StringId); } @@ -2244,7 +2244,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "trucks" && resource.Id == truck2.StringId); } @@ -2275,7 +2275,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "tandems" && resource.Id == tandem2.StringId); } @@ -2312,7 +2312,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "cars" && resource.Id == car3.StringId); } @@ -2348,7 +2348,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue[0].Type.Should().Be("bikes"); responseDocument.Data.ManyValue[0].Id.Should().Be(bike2.StringId); @@ -2390,7 +2390,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Type.Should().Be("bikes"); responseDocument.Data.ManyValue[0].Id.Should().Be(bike.StringId); @@ -2432,7 +2432,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Type.Should().Be("cars"); responseDocument.Data.ManyValue[0].Id.Should().Be(car3.StringId); @@ -2457,7 +2457,7 @@ public async Task Cannot_sort_on_ambiguous_derived_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2480,7 +2480,7 @@ public async Task Cannot_sort_on_ambiguous_derived_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -2530,7 +2530,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(5); + responseDocument.Data.ManyValue.Should().HaveCount(5); responseDocument.Data.ManyValue[0].Type.Should().Be("chromeWheels"); responseDocument.Data.ManyValue[0].Id.Should().Be(chromeWheel3.StringId); @@ -2588,7 +2588,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(5); + responseDocument.Data.ManyValue.Should().HaveCount(5); responseDocument.Data.ManyValue[0].Type.Should().Be("chromeWheels"); responseDocument.Data.ManyValue[0].Id.Should().Be(chromeWheel3.StringId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs index c0620b12e0..4ab232092c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs @@ -97,7 +97,7 @@ public async Task Cannot_create_abstract_resource_at_abstract_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -222,14 +222,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => bikeInDatabase.Manufacturer.ShouldNotBeNull(); bikeInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); - bikeInDatabase.Wheels.ShouldHaveCount(1); + bikeInDatabase.Wheels.Should().HaveCount(1); bikeInDatabase.Wheels.ElementAt(0).Should().BeOfType(); bikeInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); bikeInDatabase.CargoBox.ShouldNotBeNull(); bikeInDatabase.CargoBox.Id.Should().Be(existingBox.Id); - bikeInDatabase.Lights.ShouldHaveCount(1); + bikeInDatabase.Lights.Should().HaveCount(1); bikeInDatabase.Lights.ElementAt(0).Id.Should().Be(existingLight.Id); }); @@ -365,7 +365,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => carInDatabase.Manufacturer.ShouldNotBeNull(); carInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); - carInDatabase.Wheels.ShouldHaveCount(1); + carInDatabase.Wheels.Should().HaveCount(1); carInDatabase.Wheels.ElementAt(0).Should().BeOfType(); carInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingCarbonWheel.Id); @@ -376,7 +376,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => carInDatabase.NavigationSystem.ShouldNotBeNull(); carInDatabase.NavigationSystem.Id.Should().Be(existingNavigationSystem.Id); - carInDatabase.Features.ShouldHaveCount(1); + carInDatabase.Features.Should().HaveCount(1); carInDatabase.Features.ElementAt(0).Id.Should().Be(existingFeature.Id); }); @@ -515,17 +515,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => tandemInDatabase.Manufacturer.ShouldNotBeNull(); tandemInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); - tandemInDatabase.Wheels.ShouldHaveCount(1); + tandemInDatabase.Wheels.Should().HaveCount(1); tandemInDatabase.Wheels.ElementAt(0).Should().BeOfType(); tandemInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); tandemInDatabase.CargoBox.ShouldNotBeNull(); tandemInDatabase.CargoBox.Id.Should().Be(existingBox.Id); - tandemInDatabase.Lights.ShouldHaveCount(1); + tandemInDatabase.Lights.Should().HaveCount(1); tandemInDatabase.Lights.ElementAt(0).Id.Should().Be(existingLight.Id); - tandemInDatabase.Features.ShouldHaveCount(1); + tandemInDatabase.Features.Should().HaveCount(1); tandemInDatabase.Features.ElementAt(0).Id.Should().Be(existingFeature.Id); }); @@ -561,7 +561,7 @@ public async Task Cannot_create_concrete_base_resource_at_concrete_derived_endpo // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -610,7 +610,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -738,7 +738,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => VehicleManufacturer manufacturerInDatabase = await dbContext.VehicleManufacturers.Include(manufacturer => manufacturer.Vehicles) .FirstWithIdAsync(newManufacturerId); - manufacturerInDatabase.Vehicles.ShouldHaveCount(1); + manufacturerInDatabase.Vehicles.Should().HaveCount(1); manufacturerInDatabase.Vehicles.ElementAt(0).Should().BeOfType(); manufacturerInDatabase.Vehicles.ElementAt(0).Id.Should().Be(existingTandem.Id); }); @@ -786,7 +786,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -838,7 +838,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -880,7 +880,7 @@ public async Task Cannot_create_resource_with_unknown_resource_in_ToOne_relation // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -925,7 +925,7 @@ public async Task Cannot_create_resource_with_unknown_resources_in_ToMany_relati // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -969,7 +969,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1093,14 +1093,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => bikeInDatabase.Manufacturer.ShouldNotBeNull(); bikeInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); - bikeInDatabase.Wheels.ShouldHaveCount(1); + bikeInDatabase.Wheels.Should().HaveCount(1); bikeInDatabase.Wheels.ElementAt(0).Should().BeOfType(); bikeInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); bikeInDatabase.CargoBox.ShouldNotBeNull(); bikeInDatabase.CargoBox.Id.Should().Be(existingBox.Id); - bikeInDatabase.Lights.ShouldHaveCount(1); + bikeInDatabase.Lights.Should().HaveCount(1); bikeInDatabase.Lights.ElementAt(0).Id.Should().Be(existingLight.Id); }); @@ -1222,14 +1222,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => tandemInDatabase.Manufacturer.ShouldNotBeNull(); tandemInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); - tandemInDatabase.Wheels.ShouldHaveCount(1); + tandemInDatabase.Wheels.Should().HaveCount(1); tandemInDatabase.Wheels.ElementAt(0).Should().BeOfType(); tandemInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); tandemInDatabase.CargoBox.ShouldNotBeNull(); tandemInDatabase.CargoBox.Id.Should().Be(existingBox.Id); - tandemInDatabase.Lights.ShouldHaveCount(1); + tandemInDatabase.Lights.Should().HaveCount(1); tandemInDatabase.Lights.ElementAt(0).Id.Should().Be(existingLight.Id); }); @@ -1272,7 +1272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Conflict); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Conflict); @@ -1326,7 +1326,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnprocessableEntity); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -1452,7 +1452,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => VehicleManufacturer manufacturerInDatabase = await dbContext.VehicleManufacturers.Include(manufacturer => manufacturer.Vehicles) .FirstWithIdAsync(existingManufacturer.Id); - manufacturerInDatabase.Vehicles.ShouldHaveCount(1); + manufacturerInDatabase.Vehicles.Should().HaveCount(1); manufacturerInDatabase.Vehicles.ElementAt(0).Should().BeOfType(); manufacturerInDatabase.Vehicles.ElementAt(0).Id.Should().Be(existingTandem.Id); }); @@ -1504,7 +1504,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1560,7 +1560,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1611,7 +1611,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1665,7 +1665,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1729,7 +1729,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1834,7 +1834,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => vehicleInDatabase.Should().BeOfType(); - vehicleInDatabase.Wheels.ShouldHaveCount(1); + vehicleInDatabase.Wheels.Should().HaveCount(1); vehicleInDatabase.Wheels.ElementAt(0).Should().BeOfType(); vehicleInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); }); @@ -1938,7 +1938,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => VehicleManufacturer manufacturerInDatabase = await dbContext.VehicleManufacturers.Include(manufacturer => manufacturer.Vehicles) .FirstWithIdAsync(existingManufacturer.Id); - manufacturerInDatabase.Vehicles.ShouldHaveCount(1); + manufacturerInDatabase.Vehicles.Should().HaveCount(1); manufacturerInDatabase.Vehicles.ElementAt(0).Should().BeOfType(); manufacturerInDatabase.Vehicles.ElementAt(0).Id.Should().Be(existingTandem.Id); }); @@ -1979,7 +1979,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2024,7 +2024,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2067,7 +2067,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2101,7 +2101,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2156,7 +2156,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => vehicleInDatabase.Should().BeOfType(); - vehicleInDatabase.Wheels.ShouldHaveCount(2); + vehicleInDatabase.Wheels.Should().HaveCount(2); vehicleInDatabase.Wheels.ElementAt(0).Should().BeOfType(); vehicleInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingTandem.Wheels.ElementAt(0).Id); vehicleInDatabase.Wheels.ElementAt(1).Should().BeOfType(); @@ -2213,7 +2213,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => vehicleInDatabase.Should().BeOfType(); - vehicleInDatabase.Wheels.ShouldHaveCount(2); + vehicleInDatabase.Wheels.Should().HaveCount(2); vehicleInDatabase.Wheels.ElementAt(0).Should().BeOfType(); vehicleInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingTandem.Wheels.ElementAt(0).Id); vehicleInDatabase.Wheels.ElementAt(1).Should().BeOfType(); @@ -2277,7 +2277,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - manufacturerInDatabase.Vehicles.ShouldHaveCount(2); + manufacturerInDatabase.Vehicles.Should().HaveCount(2); manufacturerInDatabase.Vehicles.ElementAt(0).Should().BeOfType(); manufacturerInDatabase.Vehicles.ElementAt(0).Id.Should().Be(existingManufacturer.Vehicles.ElementAt(0).Id); manufacturerInDatabase.Vehicles.ElementAt(1).Should().BeOfType(); @@ -2323,7 +2323,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2366,7 +2366,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2400,7 +2400,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2452,7 +2452,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => vehicleInDatabase.Should().BeOfType(); - vehicleInDatabase.Wheels.ShouldHaveCount(1); + vehicleInDatabase.Wheels.Should().HaveCount(1); vehicleInDatabase.Wheels.ElementAt(0).Should().BeOfType(); vehicleInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingTandem.Wheels.ElementAt(1).Id); }); @@ -2504,7 +2504,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => vehicleInDatabase.Should().BeOfType(); - vehicleInDatabase.Wheels.ShouldHaveCount(1); + vehicleInDatabase.Wheels.Should().HaveCount(1); vehicleInDatabase.Wheels.ElementAt(0).Should().BeOfType(); vehicleInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingTandem.Wheels.ElementAt(1).Id); }); @@ -2556,7 +2556,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => VehicleManufacturer manufacturerInDatabase = await dbContext.VehicleManufacturers.Include(manufacturer => manufacturer.Vehicles) .FirstWithIdAsync(existingManufacturer.Id); - manufacturerInDatabase.Vehicles.ShouldHaveCount(1); + manufacturerInDatabase.Vehicles.Should().HaveCount(1); manufacturerInDatabase.Vehicles.ElementAt(0).Should().BeOfType(); manufacturerInDatabase.Vehicles.ElementAt(0).Id.Should().Be(existingManufacturer.Vehicles.ElementAt(1).Id); }); @@ -2598,7 +2598,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); string? chromeWheelId = existingBike.Wheels.ElementAt(0).StringId; @@ -2643,7 +2643,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -2677,7 +2677,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs index d3eeaedb61..1ffba671a6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs @@ -34,7 +34,7 @@ internal void AssertLeftType() internal void AssertRightTypes(params Type[] types) { - RightTypeNames.ShouldHaveCount(types.Length); + RightTypeNames.Should().HaveCount(types.Length); foreach (Type type in types) { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs index 22044421e2..8b756a673f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs @@ -38,7 +38,7 @@ public async Task Cannot_sort_if_query_string_parameter_is_blocked_by_controller // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -60,7 +60,7 @@ public async Task Cannot_paginate_if_query_string_parameter_is_blocked_by_contro // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -97,7 +97,7 @@ public async Task Cannot_use_custom_query_string_parameter_if_blocked_by_control // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/NoRelationshipsControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/NoRelationshipsControllerTests.cs index 0581b527e1..b5453c6112 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/NoRelationshipsControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/NoRelationshipsControllerTests.cs @@ -72,7 +72,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -100,7 +100,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -128,7 +128,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -239,7 +239,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -305,7 +305,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/ReadOnlyControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/ReadOnlyControllerTests.cs index 40c07d57bf..bacdab9e6f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/ReadOnlyControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/ReadOnlyControllerTests.cs @@ -138,7 +138,7 @@ public async Task Cannot_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -178,7 +178,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -206,7 +206,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -239,7 +239,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -305,7 +305,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/WriteOnlyControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/WriteOnlyControllerTests.cs index 35e15b402c..a9c35de96f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/WriteOnlyControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/WriteOnlyControllerTests.cs @@ -30,7 +30,7 @@ public async Task Cannot_get_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -58,7 +58,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -86,7 +86,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -114,7 +114,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); @@ -142,7 +142,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Forbidden); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.Forbidden); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs index 326fecad7f..ef54a50766 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs @@ -163,7 +163,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.PreconditionFailed); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.PreconditionFailed); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs index d8c10f2d1e..a2eb7e390e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs @@ -60,7 +60,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(departments[1].StringId); } @@ -92,7 +92,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(departments[0].StringId); } @@ -123,11 +123,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("companies"); responseDocument.Data.ManyValue[0].Id.Should().Be(companies[1].StringId); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("departments"); responseDocument.Included[0].Id.Should().Be(companies[1].Departments.ElementAt(0).StringId); } @@ -153,7 +153,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -183,7 +183,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -213,7 +213,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(company.Departments.ElementAt(1).StringId); } @@ -239,7 +239,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -294,7 +294,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -324,7 +324,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(company.Departments.ElementAt(1).StringId); } @@ -350,7 +350,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -432,7 +432,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -488,7 +488,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -532,7 +532,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -586,7 +586,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -639,7 +639,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -674,7 +674,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -717,7 +717,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -753,7 +753,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -793,7 +793,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -836,7 +836,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -879,7 +879,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -923,7 +923,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -965,7 +965,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -1027,7 +1027,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs index 1fa313fa71..a9c6a7ea04 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs @@ -48,7 +48,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be("00000000-0000-0000-0000-000000000000"); responseDocument.Data.ManyValue[0].With(resource => @@ -87,7 +87,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be("/maps/00000000-0000-0000-0000-000000000000"); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be("0"); } @@ -396,7 +396,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.Maps.ShouldHaveCount(1); + gameInDatabase.Maps.Should().HaveCount(1); gameInDatabase.Maps.ElementAt(0).Id.Should().Be(Guid.Empty); }); } @@ -445,7 +445,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.Maps.ShouldHaveCount(1); + gameInDatabase.Maps.Should().HaveCount(1); gameInDatabase.Maps.ElementAt(0).Id.Should().Be(Guid.Empty); }); } @@ -494,7 +494,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.Maps.ShouldHaveCount(2); + gameInDatabase.Maps.Should().HaveCount(2); gameInDatabase.Maps.Should().ContainSingle(map => map.Id == Guid.Empty); }); } @@ -541,7 +541,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.Maps.ShouldHaveCount(1); + gameInDatabase.Maps.Should().HaveCount(1); gameInDatabase.Maps.Should().ContainSingle(map => map.Id != Guid.Empty); }); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs index 249026e82d..5532bf9032 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs @@ -67,7 +67,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(SingleSpace); responseDocument.Data.ManyValue[0].With(resource => @@ -106,7 +106,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be("/players/%20"); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be("0"); } @@ -415,7 +415,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.ActivePlayers.ShouldHaveCount(1); + gameInDatabase.ActivePlayers.Should().HaveCount(1); gameInDatabase.ActivePlayers.ElementAt(0).Id.Should().Be(SingleSpace); }); } @@ -464,7 +464,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.ActivePlayers.ShouldHaveCount(1); + gameInDatabase.ActivePlayers.Should().HaveCount(1); gameInDatabase.ActivePlayers.ElementAt(0).Id.Should().Be(SingleSpace); }); } @@ -513,7 +513,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.ActivePlayers.ShouldHaveCount(2); + gameInDatabase.ActivePlayers.Should().HaveCount(2); gameInDatabase.ActivePlayers.Should().ContainSingle(player => player.Id == SingleSpace); }); } @@ -560,7 +560,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); gameInDatabase.ShouldNotBeNull(); - gameInDatabase.ActivePlayers.ShouldHaveCount(1); + gameInDatabase.ActivePlayers.Should().HaveCount(1); gameInDatabase.ActivePlayers.Should().ContainSingle(player => player.Id != SingleSpace); }); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs index a0ca13c4fa..f163b5ee11 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs @@ -48,7 +48,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be("0"); responseDocument.Data.ManyValue[0].With(resource => @@ -86,7 +86,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be("/games/0"); - responseDocument.Included.ShouldHaveCount(1); + responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(game.ActivePlayers.ElementAt(0).StringId); } @@ -398,7 +398,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); playerInDatabase.ShouldNotBeNull(); - playerInDatabase.RecentlyPlayed.ShouldHaveCount(1); + playerInDatabase.RecentlyPlayed.Should().HaveCount(1); playerInDatabase.RecentlyPlayed.ElementAt(0).Id.Should().Be(0); }); } @@ -447,7 +447,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); playerInDatabase.ShouldNotBeNull(); - playerInDatabase.RecentlyPlayed.ShouldHaveCount(1); + playerInDatabase.RecentlyPlayed.Should().HaveCount(1); playerInDatabase.RecentlyPlayed.ElementAt(0).Id.Should().Be(0); }); } @@ -496,7 +496,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); playerInDatabase.ShouldNotBeNull(); - playerInDatabase.RecentlyPlayed.ShouldHaveCount(2); + playerInDatabase.RecentlyPlayed.Should().HaveCount(2); playerInDatabase.RecentlyPlayed.Should().ContainSingle(game => game.Id == 0); }); } @@ -543,7 +543,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); playerInDatabase.ShouldNotBeNull(); - playerInDatabase.RecentlyPlayed.ShouldHaveCount(1); + playerInDatabase.RecentlyPlayed.Should().HaveCount(1); playerInDatabase.RecentlyPlayed.Should().ContainSingle(game => game.Id != 0); }); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs index 34bbc16d17..defca993be 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs @@ -46,7 +46,7 @@ public void Renders_JSON_path_for_ModelState_key_in_resource_request(string mode var exception = new InvalidModelStateException(modelState, typeof(Parent), false, resourceGraph); // Assert - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); if (expectedJsonPath == null) { @@ -94,7 +94,7 @@ public void Renders_JSON_path_for_ModelState_key_in_operations_request(string mo var exception = new InvalidModelStateException(modelState, typeof(IList), false, resourceGraph, getOperationTypeCallback); // Assert - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); if (expectedJsonPath == null) { diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs index 1b45cc577f..6fab4fbd36 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs @@ -82,7 +82,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterNameSource.Text); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -159,7 +159,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs index fc3431da31..efbbe056c0 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs @@ -74,7 +74,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs index 5cbbcc1936..9570feb346 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs @@ -49,7 +49,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -78,7 +78,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs index f6efc0e597..929e90e6b2 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs @@ -89,7 +89,7 @@ public void Reader_Read_Page_Number_Fails(string parameterValue, string errorMes InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be("page[number]"); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -134,7 +134,7 @@ public void Reader_Read_Page_Size_Fails(string parameterValue, string errorMessa InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be("page[size]"); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs index 77c52b3828..c6034378de 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs @@ -74,7 +74,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterNameSource.Text); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -126,7 +126,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs index 51906bb613..ba22b0a101 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs @@ -73,7 +73,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterNameSource.Text); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -103,7 +103,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame InvalidQueryStringParameterException exception = action.Should().ThrowExactly().And; exception.ParameterName.Should().Be(parameterName); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs index 607073d7e2..20b2f32c30 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs @@ -120,7 +120,7 @@ public void Cannot_convert_unexposed_attribute() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().StartWith("The lambda expression 'file => Convert(file.IsCompressed, Object)' is invalid. "); @@ -142,7 +142,7 @@ public void Cannot_convert_unexposed_ToMany_relationship() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().StartWith("The lambda expression 'file => Convert(file.Content.Length, Object)' is invalid. "); @@ -164,7 +164,7 @@ public void Cannot_convert_unexposed_ToOne_relationship() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().StartWith("The lambda expression 'file => file.ParentDirectory.Name' is invalid. "); @@ -186,7 +186,7 @@ public void Cannot_convert_unexposed_resource_type() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().StartWith("The lambda expression 'entry => Convert(entry, FileEntry).Content' is invalid. "); @@ -208,7 +208,7 @@ public void Cannot_convert_count_with_predicate() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().StartWith("The lambda expression 'directory => Convert(directory.Files.Count(_ => True), Object)' is invalid. "); @@ -230,7 +230,7 @@ public void Cannot_convert_null_selector() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().Be("The lambda expression '_ => null' is invalid. Unsupported expression body 'null'."); @@ -251,7 +251,7 @@ public void Cannot_convert_self_selector() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().Be("The lambda expression 'entry => entry' is invalid. Unsupported expression body 'entry'."); @@ -273,7 +273,7 @@ public void Cannot_convert_conditional_operator() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().Match("The lambda expression '*' is invalid. Unsupported expression body '*'."); @@ -294,7 +294,7 @@ public void Cannot_convert_concatenation_operator() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().Match("The lambda expression '*' is invalid. Unsupported expression body '*'."); @@ -321,7 +321,7 @@ public void Cannot_convert_projection_into_anonymous_type() // Assert JsonApiException exception = action.Should().ThrowExactly().Which; - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); exception.Errors[0].StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.Errors[0].Title.Should().StartWith("Invalid lambda expression for sorting from resource definition. It should "); exception.Errors[0].Detail.Should().Match("The lambda expression '*' is invalid. Unsupported expression body '*'."); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs index 06339cf293..2955f3403c 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs @@ -79,7 +79,7 @@ public void Can_set_value_to_collection_with_single_resource() attribute.SetValue(resource, children); // Assert - attribute.GetValue(resource).Should().BeOfType>().Subject.ShouldHaveCount(1); + attribute.GetValue(resource).Should().BeOfType>().Subject.Should().HaveCount(1); } [Fact] @@ -154,7 +154,7 @@ public void Can_add_value_to_List() // Assert List collection = attribute.GetValue(resource).Should().BeOfType>().Subject!; - collection.ShouldHaveCount(2); + collection.Should().HaveCount(2); } [Fact] @@ -181,7 +181,7 @@ public void Can_add_existing_value_to_List() // Assert List collection = attribute.GetValue(resource).Should().BeOfType>().Subject!; - collection.ShouldHaveCount(1); + collection.Should().HaveCount(1); } [Fact] @@ -208,7 +208,7 @@ public void Can_add_value_to_HashSet() // Assert HashSet collection = attribute.GetValue(resource).Should().BeOfType>().Subject!; - collection.ShouldHaveCount(2); + collection.Should().HaveCount(2); } [Fact] @@ -235,7 +235,7 @@ public void Can_add_existing_value_to_HashSet() // Assert HashSet collection = attribute.GetValue(resource).Should().BeOfType>().Subject!; - collection.ShouldHaveCount(1); + collection.Should().HaveCount(1); } [Fact] @@ -259,7 +259,7 @@ public void Can_add_value_to_null_collection() // Assert HashSet collection = attribute.GetValue(resource).Should().BeOfType>().Subject!; - collection.ShouldHaveCount(1); + collection.Should().HaveCount(1); } public sealed class TestResource : Identifiable diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs index de7ac84d1b..8288595662 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs @@ -265,7 +265,7 @@ public void Logs_warning_when_adding_non_resource_type() // Assert IReadOnlyList logLines = loggerProvider.GetLines(); - logLines.ShouldHaveCount(1); + logLines.Should().HaveCount(1); logLines[0].Should().Be( $"[WARNING] Skipping: Type '{typeof(NonResource)}' does not implement 'IIdentifiable'. Add [NoResource] to suppress this warning."); @@ -302,7 +302,7 @@ public void Logs_warning_when_adding_resource_without_attributes() // Assert IReadOnlyList logLines = loggerProvider.GetLines(); - logLines.ShouldHaveCount(1); + logLines.Should().HaveCount(1); logLines[0].Should().Be($"[WARNING] Type '{typeof(ResourceWithHasOneRelationship)}' does not contain any attributes."); } @@ -321,7 +321,7 @@ public void Logs_warning_on_empty_graph() // Assert IReadOnlyList logLines = loggerProvider.GetLines(); - logLines.ShouldHaveCount(1); + logLines.Should().HaveCount(1); logLines[0].Should().Be("[WARNING] The resource graph is empty."); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs index d5a63c0447..adc1bd0ec7 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs @@ -191,7 +191,7 @@ public void Throws_for_request_body_with_extension_in_attributes_when_extension_ JsonApiException? exception = action.Should().ThrowExactly().WithInnerExceptionExactly().Which; exception.StackTrace.Should().Contain(nameof(ExtensionAwareResourceObjectConverter)); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); @@ -232,7 +232,7 @@ public void Throws_for_request_body_with_extension_in_relationships_when_extensi JsonApiException? exception = action.Should().ThrowExactly().WithInnerExceptionExactly().Which; exception.StackTrace.Should().Contain(nameof(ExtensionAwareResourceObjectConverter)); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs index 9216b4b896..8f957f967b 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs @@ -47,7 +47,7 @@ public async Task Adds_source_pointer_to_JsonApiException_thrown_from_JsonConver JsonApiException? exception = (await action.Should().ThrowExactlyAsync()).Which; exception.StackTrace.Should().Contain(nameof(ThrowingResourceObjectConverter)); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); @@ -75,7 +75,7 @@ public async Task Makes_source_pointer_absolute_in_JsonApiException_thrown_from_ JsonApiException? exception = (await action.Should().ThrowExactlyAsync()).Which; exception.StackTrace.Should().Contain(nameof(ThrowingResourceObjectConverter)); - exception.Errors.ShouldHaveCount(1); + exception.Errors.Should().HaveCount(1); ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs index 68b49ef7b8..a837e61593 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs @@ -137,7 +137,7 @@ public void Converts_various_data_types_with_values() model.ComplexObject.ShouldNotBeNull(); model.ComplexObject.Value.Should().Be(complexObject.Value); - model.ComplexObjectList.ShouldHaveCount(2); + model.ComplexObjectList.Should().HaveCount(2); model.ComplexObjectList[0].Value.Should().Be(complexObjectList[0].Value); model.ComplexObjectList[1].Value.Should().Be(complexObjectList[1].Value); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs index 032bcd7c1f..2212de79b0 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs @@ -565,7 +565,7 @@ public void Duplicate_children_in_multiple_chains_occur_once_in_output() Document document = responseModelAdapter.Convert(articles); // Assert - document.Included.ShouldHaveCount(1); + document.Included.Should().HaveCount(1); document.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(person.Name)); document.Included[0].Id.Should().Be(person.StringId); diff --git a/test/MultiDbContextTests/ResourceTests.cs b/test/MultiDbContextTests/ResourceTests.cs index 3b2c259c57..c21627a044 100644 --- a/test/MultiDbContextTests/ResourceTests.cs +++ b/test/MultiDbContextTests/ResourceTests.cs @@ -35,7 +35,7 @@ public async Task Can_get_ResourceAs() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("nameA").With(value => value.Should().Be("SampleA")); } @@ -51,7 +51,7 @@ public async Task Can_get_ResourceBs() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("nameB").With(value => value.Should().Be("SampleB")); } diff --git a/test/NoEntityFrameworkTests/PersonTests.cs b/test/NoEntityFrameworkTests/PersonTests.cs index 01cdefa3e5..cb355dd730 100644 --- a/test/NoEntityFrameworkTests/PersonTests.cs +++ b/test/NoEntityFrameworkTests/PersonTests.cs @@ -35,7 +35,7 @@ public async Task Can_get_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Meta.Should().ContainTotal(2); } @@ -52,7 +52,7 @@ public async Task Can_filter_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be("Jane")); responseDocument.Meta.Should().ContainTotal(1); @@ -70,7 +70,7 @@ public async Task Can_filter_in_related_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be("John")); responseDocument.Meta.Should().ContainTotal(1); @@ -88,7 +88,7 @@ public async Task Can_sort_on_attribute_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be("2"); responseDocument.Data.ManyValue[1].Id.Should().Be("1"); } @@ -105,7 +105,7 @@ public async Task Can_sort_on_count_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be("1"); responseDocument.Data.ManyValue[1].Id.Should().Be("2"); } @@ -122,7 +122,7 @@ public async Task Can_paginate_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be("Jane")); responseDocument.Meta.Should().ContainTotal(2); @@ -188,7 +188,7 @@ public async Task Can_get_secondary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Make homework")); responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Check emails")); @@ -207,7 +207,7 @@ public async Task Can_get_ToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be("1"); responseDocument.Meta.Should().ContainTotal(1); diff --git a/test/NoEntityFrameworkTests/TagTests.cs b/test/NoEntityFrameworkTests/TagTests.cs index 49b5887adb..9dd4c2e65e 100644 --- a/test/NoEntityFrameworkTests/TagTests.cs +++ b/test/NoEntityFrameworkTests/TagTests.cs @@ -35,7 +35,7 @@ public async Task Can_get_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Meta.Should().ContainTotal(3); } @@ -52,7 +52,7 @@ public async Task Can_filter_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Personal")); responseDocument.Meta.Should().ContainTotal(1); @@ -70,7 +70,7 @@ public async Task Can_filter_in_related_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Business")); responseDocument.Meta.Should().ContainTotal(1); @@ -88,7 +88,7 @@ public async Task Can_sort_on_attribute_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Id.Should().Be("3"); responseDocument.Data.ManyValue[1].Id.Should().Be("2"); responseDocument.Data.ManyValue[2].Id.Should().Be("1"); @@ -106,7 +106,7 @@ public async Task Can_sort_on_count_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Id.Should().Be("1"); responseDocument.Data.ManyValue[1].Id.Should().Be("2"); responseDocument.Data.ManyValue[2].Id.Should().Be("3"); @@ -124,7 +124,7 @@ public async Task Can_paginate_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Family")); responseDocument.Meta.Should().ContainTotal(3); @@ -191,7 +191,7 @@ public async Task Can_get_secondary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Make homework")); responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Book vacation")); responseDocument.Data.ManyValue[2].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Cook dinner")); @@ -211,7 +211,7 @@ public async Task Can_get_ToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be("3"); responseDocument.Meta.Should().ContainTotal(1); diff --git a/test/NoEntityFrameworkTests/TodoItemTests.cs b/test/NoEntityFrameworkTests/TodoItemTests.cs index 90691fd770..5f95335009 100644 --- a/test/NoEntityFrameworkTests/TodoItemTests.cs +++ b/test/NoEntityFrameworkTests/TodoItemTests.cs @@ -35,7 +35,7 @@ public async Task Can_get_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Meta.Should().ContainTotal(4); } @@ -52,7 +52,7 @@ public async Task Can_filter_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("priority").With(value => value.Should().Be(TodoItemPriority.High)); responseDocument.Meta.Should().ContainTotal(1); @@ -70,7 +70,7 @@ public async Task Can_filter_in_related_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(3); + responseDocument.Data.ManyValue.Should().HaveCount(3); responseDocument.Meta.Should().ContainTotal(3); } @@ -87,7 +87,7 @@ public async Task Can_sort_on_attribute_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue[0].Id.Should().Be("4"); responseDocument.Data.ManyValue[1].Id.Should().Be("3"); responseDocument.Data.ManyValue[2].Id.Should().Be("2"); @@ -106,7 +106,7 @@ public async Task Can_sort_on_count_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(4); + responseDocument.Data.ManyValue.Should().HaveCount(4); responseDocument.Data.ManyValue[0].Id.Should().Be("2"); } @@ -122,7 +122,7 @@ public async Task Can_paginate_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Check emails")); responseDocument.Meta.Should().ContainTotal(4); @@ -188,7 +188,7 @@ public async Task Cannot_get_primary_resource_for_unknown_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -208,7 +208,7 @@ public async Task Can_get_secondary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(2); + responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Personal")); responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Family")); @@ -244,7 +244,7 @@ public async Task Cannot_get_secondary_resource_for_unknown_primary_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -279,7 +279,7 @@ public async Task Cannot_get_secondary_resource_for_unknown_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Errors.ShouldHaveCount(1); + responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.NotFound); @@ -331,7 +331,7 @@ public async Task Can_get_ToMany_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldHaveCount(1); + responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be("3"); responseDocument.Meta.Should().ContainTotal(1); diff --git a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs index 0627449664..cc5950e436 100644 --- a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs +++ b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs @@ -34,12 +34,6 @@ public static void ShouldNotBeNullOrEmpty([SysNotNull] this string? subject) subject.Should().NotBeNullOrEmpty(); } - [CustomAssertion] - public static void ShouldHaveCount([SysNotNull] this IEnumerable? subject, int expected) - { - subject.Should().HaveCount(expected); - } - [CustomAssertion] public static TValue? ShouldContainKey([SysNotNull] this IDictionary? subject, TKey expected) { From d833b9e6ebf101165c664988006c672b6d17c249 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:34:17 +0100 Subject: [PATCH 4/8] Remove ShouldNotBeEmpty --- .../Creating/AtomicCreateResourceTests.cs | 36 ++++++------- ...reateResourceWithClientGeneratedIdTests.cs | 12 ++--- ...eateResourceWithToManyRelationshipTests.cs | 28 +++++------ ...reateResourceWithToOneRelationshipTests.cs | 28 +++++------ .../Deleting/AtomicDeleteResourceTests.cs | 14 +++--- .../Mixed/AtomicRequestBodyTests.cs | 8 +-- .../Mixed/MaximumOperationsPerRequestTests.cs | 2 +- .../AtomicAddToToManyRelationshipTests.cs | 34 ++++++------- ...AtomicRemoveFromToManyRelationshipTests.cs | 32 ++++++------ .../AtomicReplaceToManyRelationshipTests.cs | 34 ++++++------- .../AtomicUpdateToOneRelationshipTests.cs | 32 ++++++------ .../AtomicReplaceToManyRelationshipTests.cs | 18 +++---- .../Resources/AtomicUpdateResourceTests.cs | 50 +++++++++---------- .../AtomicUpdateToOneRelationshipTests.cs | 18 +++---- .../Authorization/Scopes/ScopeReadTests.cs | 12 ++--- .../ExceptionHandlerTests.cs | 2 +- .../QueryStrings/Includes/IncludeTests.cs | 16 +++--- .../ReadWrite/Creating/CreateResourceTests.cs | 44 ++++++++-------- ...reateResourceWithClientGeneratedIdTests.cs | 14 +++--- ...eateResourceWithToManyRelationshipTests.cs | 34 ++++++------- ...reateResourceWithToOneRelationshipTests.cs | 36 ++++++------- .../ReadWrite/Fetching/FetchResourceTests.cs | 16 +++--- .../AddToToManyRelationshipTests.cs | 20 ++++---- .../RemoveFromToManyRelationshipTests.cs | 20 ++++---- .../ReplaceToManyRelationshipTests.cs | 18 +++---- .../UpdateToOneRelationshipTests.cs | 16 +++--- .../ReplaceToManyRelationshipTests.cs | 20 ++++---- .../Updating/Resources/UpdateResourceTests.cs | 42 ++++++++-------- .../Resources/UpdateToOneRelationshipTests.cs | 20 ++++---- .../ResourceInheritanceWriteTests.cs | 8 +-- .../DisableQueryStringTests.cs | 2 +- .../Serialization/ETagTests.cs | 8 +-- test/NoEntityFrameworkTests/PersonTests.cs | 2 +- test/NoEntityFrameworkTests/TagTests.cs | 2 +- test/NoEntityFrameworkTests/TodoItemTests.cs | 2 +- .../NullabilityAssertionExtensions.cs | 12 ----- .../ResourceDescriptorAssemblyCacheTests.cs | 4 +- 37 files changed, 352 insertions(+), 364 deletions(-) diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs index a9a30ff9ea..2bb03ca2eb 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs @@ -144,7 +144,7 @@ public async Task Can_create_resources() resource.Attributes.ShouldContainKey("genre").With(value => value.Should().Be(newTracks[index].Genre)); resource.Attributes.ShouldContainKey("releasedAt").With(value => value.Should().Be(newTracks[index].ReleasedAt)); - resource.Relationships.ShouldNotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); } @@ -264,7 +264,7 @@ public async Task Cannot_create_resource_with_unknown_attribute() error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'playlists'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -310,7 +310,7 @@ public async Task Can_create_resource_with_unknown_attribute() { resource.Type.Should().Be("playlists"); resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newName)); - resource.Relationships.ShouldNotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -369,7 +369,7 @@ public async Task Cannot_create_resource_with_unknown_relationship() error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'lyrics'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -424,8 +424,8 @@ public async Task Can_create_resource_with_unknown_relationship() responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("lyrics"); - resource.Attributes.ShouldNotBeEmpty(); - resource.Relationships.ShouldNotBeEmpty(); + resource.Attributes.Should().NotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); long newLyricId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -481,7 +481,7 @@ public async Task Cannot_create_resource_with_client_generated_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -516,7 +516,7 @@ public async Task Cannot_create_resource_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -554,7 +554,7 @@ public async Task Cannot_create_resource_for_ref_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -588,7 +588,7 @@ public async Task Cannot_create_resource_for_missing_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -623,7 +623,7 @@ public async Task Cannot_create_resource_for_null_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -670,7 +670,7 @@ public async Task Cannot_create_resource_for_array_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -710,7 +710,7 @@ public async Task Cannot_create_resource_for_missing_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -748,7 +748,7 @@ public async Task Cannot_create_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -793,7 +793,7 @@ public async Task Cannot_create_resource_with_readonly_attribute() error.Detail.Should().Be("Attribute 'isArchived' on resource type 'playlists' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -835,7 +835,7 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() error.Detail.Should().Be("Failed to convert attribute 'bornAt' with value '12345' of type 'Number' to type 'DateTimeOffset'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -917,7 +917,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Type.Should().Be("musicTracks"); resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTitle)); - resource.Relationships.ShouldNotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -988,6 +988,6 @@ public async Task Cannot_assign_attribute_with_blocked_capability() error.Detail.Should().Be("The attribute 'createdAt' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs index e0372af39e..32376795ea 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs @@ -80,7 +80,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ resource.Type.Should().Be("textLanguages"); resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode)); resource.Attributes.Should().NotContainKey("isRightToLeft"); - resource.Relationships.ShouldNotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -189,7 +189,7 @@ public async Task Can_create_resource_for_missing_client_generated_ID_having_sid { resource.Type.Should().Be("textLanguages"); resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode)); - resource.Relationships.ShouldNotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); Guid newLanguageId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -247,7 +247,7 @@ public async Task Cannot_create_resource_for_missing_client_generated_ID(ClientI error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -356,7 +356,7 @@ public async Task Cannot_create_resource_for_incompatible_ID(ClientIdGenerationM error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int32'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -456,7 +456,7 @@ public async Task Cannot_create_resource_with_local_ID(ClientIdGenerationMode mo error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -501,6 +501,6 @@ public async Task Cannot_create_resource_for_ID_and_local_ID(ClientIdGenerationM error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs index 0c338989f7..80f9f71ce0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs @@ -88,8 +88,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldNotBeEmpty(); - resource.Relationships.ShouldNotBeEmpty(); + resource.Attributes.Should().NotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -173,8 +173,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("playlists"); - resource.Attributes.ShouldNotBeEmpty(); - resource.Relationships.ShouldNotBeEmpty(); + resource.Attributes.Should().NotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -238,7 +238,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -290,7 +290,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -341,7 +341,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -467,7 +467,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -534,8 +534,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldNotBeEmpty(); - resource.Relationships.ShouldNotBeEmpty(); + resource.Attributes.Should().NotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -590,7 +590,7 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -635,7 +635,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -682,7 +682,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -734,6 +734,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs index 2b5fc0b62e..6f070904da 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs @@ -82,8 +82,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("lyrics"); - resource.Attributes.ShouldNotBeEmpty(); - resource.Relationships.ShouldNotBeEmpty(); + resource.Attributes.Should().NotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); long newLyricId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -153,8 +153,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldNotBeEmpty(); - resource.Relationships.ShouldNotBeEmpty(); + resource.Attributes.Should().NotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -304,7 +304,7 @@ public async Task Cannot_create_for_null_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -348,7 +348,7 @@ public async Task Cannot_create_for_missing_data_in_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -400,7 +400,7 @@ public async Task Cannot_create_for_array_data_in_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -448,7 +448,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -497,7 +497,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -545,7 +545,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -651,7 +651,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -720,8 +720,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldNotBeEmpty(); - resource.Relationships.ShouldNotBeEmpty(); + resource.Attributes.Should().NotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -781,6 +781,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/language"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs index 9331040392..daa0e06ffe 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs @@ -355,7 +355,7 @@ public async Task Cannot_delete_resource_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -389,7 +389,7 @@ public async Task Cannot_delete_resource_for_missing_ref_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -427,7 +427,7 @@ public async Task Cannot_delete_resource_for_missing_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -466,7 +466,7 @@ public async Task Cannot_delete_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -504,7 +504,7 @@ public async Task Cannot_delete_resource_for_missing_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -586,7 +586,7 @@ public async Task Cannot_delete_resource_for_incompatible_ID() error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int64'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -626,6 +626,6 @@ public async Task Cannot_delete_resource_for_ID_and_local_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs index 138fc349c1..a978b1e8fb 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs @@ -64,7 +64,7 @@ public async Task Cannot_process_for_null_request_body() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -117,7 +117,7 @@ public async Task Cannot_process_for_missing_operations_array() error.Title.Should().Be("Failed to deserialize request body: No operations found."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -144,7 +144,7 @@ public async Task Cannot_process_empty_operations_array() error.Title.Should().Be("Failed to deserialize request body: No operations found."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -175,7 +175,7 @@ public async Task Cannot_process_null_operation() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs index 0ad82fbb2b..c775bb1f1b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs @@ -73,7 +73,7 @@ public async Task Cannot_process_more_operations_than_maximum() error.Detail.Should().Be("The number of operations in this request (3) is higher than the maximum of 2."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs index d4bfc2479b..5e94bc2b56 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'ownedBy' is not a to-many relationship."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -265,7 +265,7 @@ public async Task Cannot_add_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -304,7 +304,7 @@ public async Task Cannot_add_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -344,7 +344,7 @@ public async Task Cannot_add_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -383,7 +383,7 @@ public async Task Cannot_add_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -482,7 +482,7 @@ public async Task Cannot_add_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -521,7 +521,7 @@ public async Task Cannot_add_for_missing_relationship_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -561,7 +561,7 @@ public async Task Cannot_add_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -609,7 +609,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -658,7 +658,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -709,7 +709,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -756,7 +756,7 @@ public async Task Cannot_add_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -804,7 +804,7 @@ public async Task Cannot_add_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -851,7 +851,7 @@ public async Task Cannot_add_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -900,7 +900,7 @@ public async Task Cannot_add_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1029,7 +1029,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1132,6 +1132,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be added to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs index b3bced11d2..3ca22176b0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'ownedBy' is not a to-many relationship."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -264,7 +264,7 @@ public async Task Cannot_remove_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -303,7 +303,7 @@ public async Task Cannot_remove_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -343,7 +343,7 @@ public async Task Cannot_remove_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -382,7 +382,7 @@ public async Task Cannot_remove_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -481,7 +481,7 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -521,7 +521,7 @@ public async Task Cannot_remove_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -569,7 +569,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -618,7 +618,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -669,7 +669,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -716,7 +716,7 @@ public async Task Cannot_remove_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -764,7 +764,7 @@ public async Task Cannot_remove_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -811,7 +811,7 @@ public async Task Cannot_remove_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -860,7 +860,7 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -989,7 +989,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1093,6 +1093,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be removed from."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs index 4c4e75ca11..b47fe0259b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs @@ -299,7 +299,7 @@ public async Task Cannot_replace_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -338,7 +338,7 @@ public async Task Cannot_replace_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -378,7 +378,7 @@ public async Task Cannot_replace_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -417,7 +417,7 @@ public async Task Cannot_replace_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -533,7 +533,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int16'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -574,7 +574,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -614,7 +614,7 @@ public async Task Cannot_replace_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -662,7 +662,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -711,7 +711,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -762,7 +762,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -809,7 +809,7 @@ public async Task Cannot_replace_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -857,7 +857,7 @@ public async Task Cannot_replace_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -904,7 +904,7 @@ public async Task Cannot_replace_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -953,7 +953,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1082,7 +1082,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1138,7 +1138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1191,6 +1191,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs index 504196b009..7b55f12be4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs @@ -552,7 +552,7 @@ public async Task Cannot_create_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -591,7 +591,7 @@ public async Task Cannot_create_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -631,7 +631,7 @@ public async Task Cannot_create_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -670,7 +670,7 @@ public async Task Cannot_create_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -778,7 +778,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -819,7 +819,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -859,7 +859,7 @@ public async Task Cannot_create_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -907,7 +907,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -963,7 +963,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1007,7 +1007,7 @@ public async Task Cannot_create_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1052,7 +1052,7 @@ public async Task Cannot_create_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1096,7 +1096,7 @@ public async Task Cannot_create_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1142,7 +1142,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1250,7 +1250,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1303,7 +1303,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1356,6 +1356,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs index 521c482707..ba5e0b268d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs @@ -337,7 +337,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -391,7 +391,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -447,7 +447,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -499,7 +499,7 @@ public async Task Cannot_replace_for_missing_type_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -552,7 +552,7 @@ public async Task Cannot_replace_for_unknown_type_in_relationship_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -604,7 +604,7 @@ public async Task Cannot_replace_for_missing_ID_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -658,7 +658,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_relationship_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -797,7 +797,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -858,6 +858,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs index d06b9713c5..f632793947 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs @@ -208,7 +208,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'musicTracks'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -321,7 +321,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'musicTracks'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -551,7 +551,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Type.Should().Be("textLanguages"); resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode)); resource.Attributes.Should().NotContainKey("isRightToLeft"); - resource.Relationships.ShouldNotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); }); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -602,7 +602,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Relationships.ShouldNotBeEmpty(); + resource.Relationships.Should().NotBeEmpty(); resource.Relationships.Values.Should().OnlyContain(value => value != null && value.Data.Value == null); }); } @@ -639,7 +639,7 @@ public async Task Cannot_update_resource_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -745,7 +745,7 @@ public async Task Cannot_update_resource_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -794,7 +794,7 @@ public async Task Cannot_update_resource_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -845,7 +845,7 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -879,7 +879,7 @@ public async Task Cannot_update_resource_for_missing_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -914,7 +914,7 @@ public async Task Cannot_update_resource_for_null_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -968,7 +968,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1012,7 +1012,7 @@ public async Task Cannot_update_resource_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1056,7 +1056,7 @@ public async Task Cannot_update_resource_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1102,7 +1102,7 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1152,7 +1152,7 @@ public async Task Cannot_update_on_resource_type_mismatch_between_ref_and_data() error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1205,7 +1205,7 @@ public async Task Cannot_update_on_resource_ID_mismatch_between_ref_and_data() error.Detail.Should().Be($"Expected '{performerId1}' instead of '{performerId2}'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1255,7 +1255,7 @@ public async Task Cannot_update_on_resource_local_ID_mismatch_between_ref_and_da error.Detail.Should().Be("Expected 'local-1' instead of 'local-2'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1307,7 +1307,7 @@ public async Task Cannot_update_on_mixture_of_ID_and_local_ID_between_ref_and_da error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1359,7 +1359,7 @@ public async Task Cannot_update_on_mixture_of_local_ID_and_ID_between_ref_and_da error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1404,7 +1404,7 @@ public async Task Cannot_update_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1500,7 +1500,7 @@ public async Task Cannot_update_resource_for_incompatible_ID() error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int32'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1551,7 +1551,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'isArchived' on resource type 'playlists' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1602,7 +1602,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1653,7 +1653,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert attribute 'bornAt' with value '123.45' of type 'Number' to type 'DateTimeOffset'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1813,6 +1813,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The attribute 'createdAt' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs index 05ba62e66e..c265e0094f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs @@ -613,7 +613,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -666,7 +666,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -727,7 +727,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -776,7 +776,7 @@ public async Task Cannot_create_for_missing_type_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/track/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -826,7 +826,7 @@ public async Task Cannot_create_for_unknown_type_in_relationship_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -875,7 +875,7 @@ public async Task Cannot_create_for_missing_ID_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -926,7 +926,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1044,7 +1044,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1102,6 +1102,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/language"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs index f2cfbf5f5e..a00682d446 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs @@ -95,8 +95,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("movies"); responseDocument.Data.ManyValue[0].Id.Should().Be(movie.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldNotBeEmpty(); - responseDocument.Data.ManyValue[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Data.ManyValue[0].Attributes.Should().NotBeEmpty(); + responseDocument.Data.ManyValue[0].Relationships.Should().NotBeEmpty(); } [Fact] @@ -125,8 +125,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("genres"); responseDocument.Data.ManyValue[0].Id.Should().Be(genre.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldNotBeEmpty(); - responseDocument.Data.ManyValue[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Data.ManyValue[0].Attributes.Should().NotBeEmpty(); + responseDocument.Data.ManyValue[0].Relationships.Should().NotBeEmpty(); } [Fact] @@ -155,8 +155,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("actors"); responseDocument.Data.ManyValue[0].Id.Should().Be(actor.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldNotBeEmpty(); - responseDocument.Data.ManyValue[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Data.ManyValue[0].Attributes.Should().NotBeEmpty(); + responseDocument.Data.ManyValue[0].Relationships.Should().NotBeEmpty(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs index ba4ba08ee1..a6a7c1fba8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs @@ -121,7 +121,7 @@ public async Task Logs_and_produces_error_response_on_deserialization_failure() JsonElement element = value.Should().BeOfType().Subject; IEnumerable stackTraceLines = element.EnumerateArray().Select(token => token.GetString()); - stackTraceLines.ShouldNotBeEmpty(); + stackTraceLines.Should().NotBeEmpty(); }); IReadOnlyList logMessages = loggerProvider.GetMessages(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs index 7d37d180c5..c3eb0fadc1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs @@ -451,7 +451,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldNotBeEmpty(); + value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); }); @@ -472,7 +472,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.ShouldContainKey("comments").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldNotBeEmpty(); + value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("comments"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).StringId); }); @@ -514,7 +514,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[4].Relationships.ShouldContainKey("posts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldNotBeEmpty(); + value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).Author!.Posts[0].StringId); }); @@ -662,7 +662,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[2].Relationships.ShouldContainKey("loginAttempts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldNotBeEmpty(); + value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("loginAttempts"); value.Data.ManyValue[0].Id.Should().Be(reviewer.LoginAttempts[0].StringId); }); @@ -684,7 +684,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[4].Relationships.ShouldContainKey("loginAttempts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldNotBeEmpty(); + value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("loginAttempts"); value.Data.ManyValue[0].Id.Should().Be(person.LoginAttempts[0].StringId); }); @@ -727,7 +727,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldNotBeEmpty(); + value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); }); @@ -751,7 +751,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Relationships.ShouldContainKey("posts").With(value => { value.ShouldNotBeNull(); - value.Data.ManyValue.ShouldNotBeEmpty(); + value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); }); @@ -966,7 +966,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("calendars"); responseDocument.Data.SingleValue.Id.Should().Be(calendar.StringId); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotContainKey("appointments"); responseDocument.Included.Should().BeEmpty(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs index 5e9983bd2d..1d0014ea19 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs @@ -100,7 +100,7 @@ public async Task Can_create_resource_with_int_ID() responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newWorkItem.Description)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(newWorkItem.DueAt)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -148,7 +148,7 @@ public async Task Can_create_resource_with_long_ID() responseDocument.Data.SingleValue.Type.Should().Be("userAccounts"); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(newUserAccount.FirstName)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(newUserAccount.LastName)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); long newUserAccountId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -194,7 +194,7 @@ public async Task Can_create_resource_with_guid_ID() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newGroup.Name)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -240,7 +240,7 @@ public async Task Can_create_resource_without_attributes_or_relationships() responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().BeNull()); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -288,7 +288,7 @@ public async Task Cannot_create_resource_with_unknown_attribute() error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -324,7 +324,7 @@ public async Task Can_create_resource_with_unknown_attribute() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newWorkItem.Description)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -375,7 +375,7 @@ public async Task Cannot_create_resource_with_unknown_relationship() error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -414,8 +414,8 @@ public async Task Can_create_resource_with_unknown_relationship() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -460,7 +460,7 @@ public async Task Cannot_create_resource_with_client_generated_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -511,7 +511,7 @@ public async Task Cannot_create_resource_for_null_request_body() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -541,7 +541,7 @@ public async Task Cannot_create_resource_for_missing_data() error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -569,7 +569,7 @@ public async Task Cannot_create_resource_for_null_data() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -603,7 +603,7 @@ public async Task Cannot_create_resource_for_array_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -636,7 +636,7 @@ public async Task Cannot_create_resource_for_missing_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -670,7 +670,7 @@ public async Task Cannot_create_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -728,7 +728,7 @@ public async Task Cannot_create_on_resource_type_mismatch_between_url_and_body() error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -763,7 +763,7 @@ public async Task Cannot_create_resource_with_readonly_attribute() error.Detail.Should().Be("Attribute 'isDeprecated' on resource type 'workItemGroups' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isDeprecated"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -787,7 +787,7 @@ public async Task Cannot_create_resource_for_broken_JSON_request_body() error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().StartWith("'{' is invalid after a property name."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -822,7 +822,7 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() error.Detail.Should().Be("Failed to convert attribute 'dueAt' with value 'not-a-valid-time' of type 'String' to type 'Nullable'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/dueAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -896,7 +896,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newDescription)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -959,6 +959,6 @@ public async Task Cannot_assign_attribute_with_blocked_capability() error.Detail.Should().Be("The attribute 'isImportant' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isImportant"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs index 4fec0164ad..7df22f2ffe 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs @@ -69,7 +69,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(newGroup.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(groupName)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -281,7 +281,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("rgbColors"); responseDocument.Data.SingleValue.Id.Should().Be(defaultId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(defaultName)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -338,7 +338,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -381,7 +381,7 @@ public async Task Cannot_create_resource_with_client_generated_zero_guid_ID(Clie error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -424,7 +424,7 @@ public async Task Cannot_create_resource_with_client_generated_empty_guid_ID(Cli error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -519,7 +519,7 @@ public async Task Cannot_create_resource_with_client_generated_zero_long_ID(Clie error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -563,7 +563,7 @@ public async Task Cannot_create_resource_with_client_generated_empty_long_ID(Cli error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs index acf706a202..9aff98fa1c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs @@ -69,8 +69,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().BeNull(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -133,8 +133,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().OnlyContain(resource => resource.Type == "userAccounts"); @@ -204,8 +204,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(2); responseDocument.Included.Should().OnlyContain(resource => resource.Type == "userAccounts"); @@ -362,7 +362,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -407,7 +407,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -451,7 +451,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -560,7 +560,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'subscribers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -611,8 +611,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); @@ -663,7 +663,7 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -701,7 +701,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -741,7 +741,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -789,7 +789,7 @@ public async Task Cannot_create_resource_with_local_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -834,6 +834,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/items"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs index a2650e1c50..ffbd080bbc 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs @@ -75,8 +75,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); string newGroupId = responseDocument.Data.SingleValue.Id.ShouldNotBeNull(); @@ -199,15 +199,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); - responseDocument.Included[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Included[0].Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -282,7 +282,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); - responseDocument.Included[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Included[0].Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -337,7 +337,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -382,7 +382,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -435,7 +435,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -476,7 +476,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -518,7 +518,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -559,7 +559,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -644,7 +644,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -697,15 +697,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccounts[1].StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccounts[1].FirstName)); responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccounts[1].LastName)); - responseDocument.Included[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Included[0].Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -760,7 +760,7 @@ public async Task Cannot_create_resource_with_local_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -802,6 +802,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/group"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs index 92ae3370c5..ab834e2a03 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs @@ -48,14 +48,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => item1.Attributes.ShouldContainKey("description").With(value => value.Should().Be(workItems[0].Description)); item1.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(workItems[0].DueAt)); item1.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(workItems[0].Priority)); - item1.Relationships.ShouldNotBeEmpty(); + item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItems[1].StringId); item2.Type.Should().Be("workItems"); item2.Attributes.ShouldContainKey("description").With(value => value.Should().Be(workItems[1].Description)); item2.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(workItems[1].DueAt)); item2.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(workItems[1].Priority)); - item2.Relationships.ShouldNotBeEmpty(); + item2.Relationships.Should().NotBeEmpty(); } [Fact] @@ -99,7 +99,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(workItem.Description)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(workItem.DueAt)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(workItem.Priority)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); } [Fact] @@ -165,7 +165,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(workItem.Assignee.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(workItem.Assignee.FirstName)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(workItem.Assignee.LastName)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); } [Fact] @@ -219,14 +219,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => item1.Attributes.ShouldContainKey("description").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Description)); item1.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).DueAt)); item1.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Priority)); - item1.Relationships.ShouldNotBeEmpty(); + item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == userAccount.AssignedItems.ElementAt(1).StringId); item2.Type.Should().Be("workItems"); item2.Attributes.ShouldContainKey("description").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Description)); item2.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).DueAt)); item2.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Priority)); - item2.Relationships.ShouldNotBeEmpty(); + item2.Relationships.Should().NotBeEmpty(); } [Fact] @@ -279,13 +279,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => item1.Type.Should().Be("workTags"); item1.Attributes.ShouldContainKey("text").With(value => value.Should().Be(workItem.Tags.ElementAt(0).Text)); item1.Attributes.ShouldContainKey("isBuiltIn").With(value => value.Should().Be(workItem.Tags.ElementAt(0).IsBuiltIn)); - item1.Relationships.ShouldNotBeEmpty(); + item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItem.Tags.ElementAt(1).StringId); item2.Type.Should().Be("workTags"); item2.Attributes.ShouldContainKey("text").With(value => value.Should().Be(workItem.Tags.ElementAt(1).Text)); item2.Attributes.ShouldContainKey("isBuiltIn").With(value => value.Should().Be(workItem.Tags.ElementAt(1).IsBuiltIn)); - item2.Relationships.ShouldNotBeEmpty(); + item2.Relationships.Should().NotBeEmpty(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs index 0b59670d08..5a6d76875f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs @@ -58,7 +58,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this endpoint."); error.Detail.Should().Be("Relationship 'assignee' is not a to-many relationship."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -239,7 +239,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -281,7 +281,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -324,7 +324,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -366,7 +366,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -684,7 +684,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -802,7 +802,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -838,7 +838,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -876,7 +876,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1020,6 +1020,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be added to."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be added to."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs index ac6165df8e..adbf304db1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs @@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this endpoint."); error.Detail.Should().Be("Relationship 'assignee' is not a to-many relationship."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -351,7 +351,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -394,7 +394,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -437,7 +437,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -479,7 +479,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -797,7 +797,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -917,7 +917,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -953,7 +953,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -991,7 +991,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1138,7 +1138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be removed from."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be removed from."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs index 2bbc825cca..0d35e50eed 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs @@ -268,7 +268,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -310,7 +310,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -353,7 +353,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -395,7 +395,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -710,7 +710,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -795,7 +795,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -831,7 +831,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -869,7 +869,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1099,6 +1099,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs index 7e9d8cd139..ef98b200b4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs @@ -304,7 +304,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -339,7 +339,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -383,7 +383,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -422,7 +422,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -462,7 +462,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -501,7 +501,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -735,7 +735,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -853,6 +853,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs index fe8a15d7f9..f0c5d67a99 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs @@ -299,14 +299,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); - responseDocument.Included[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Included[0].Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -443,7 +443,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -497,7 +497,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -550,7 +550,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -697,7 +697,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'subscribers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -805,7 +805,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -852,7 +852,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -901,7 +901,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1183,6 +1183,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/items"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs index 2b9eb3d936..b5d10695dc 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs @@ -125,7 +125,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'userAccounts'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'userAccounts'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -315,7 +315,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Id.Should().Be(existingGroup.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(groupName)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isPublic").With(value => value.Should().Be(existingGroup.IsPublic)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -468,7 +468,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().BeNull()); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isImportant").With(value => value.Should().Be(existingWorkItem.IsImportant)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -637,7 +637,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Values.Should().OnlyContain(value => value.ShouldNotBeNull().Data.Value == null); responseDocument.Included.Should().BeNull(); } @@ -706,7 +706,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -744,7 +744,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -780,7 +780,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -823,7 +823,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -862,7 +862,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -902,7 +902,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -941,7 +941,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1046,7 +1046,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1086,7 +1086,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Expected '{existingWorkItems[1].StringId}' instead of '{existingWorkItems[0].StringId}'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1130,7 +1130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'isDeprecated' on resource type 'workItemGroups' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isDeprecated"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1162,7 +1162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().StartWith("Expected end of string, but instead reached end of data."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1206,7 +1206,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1248,7 +1248,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().Be($"Failed to convert ID '{existingWorkItem.Id}' of type 'Number' to type 'String'."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1296,7 +1296,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Match("Failed to convert attribute 'dueAt' with value '*start*end*' of type 'Object' to type 'Nullable'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/dueAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1378,7 +1378,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(itemDescription)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1544,6 +1544,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The attribute 'isImportant' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isImportant"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs index 746e7d5bd0..348e671dd7 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs @@ -345,14 +345,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(description)); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); - responseDocument.Included[0].Relationships.ShouldNotBeEmpty(); + responseDocument.Included[0].Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -480,7 +480,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -527,7 +527,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -582,7 +582,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -632,7 +632,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -683,7 +683,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -733,7 +733,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -836,7 +836,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -987,6 +987,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/group"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty()); + error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs index 4ab232092c..3ce4e83d8b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs @@ -663,8 +663,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("carbonWheels"); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); long newCarbonWheelId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -728,8 +728,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("vehicleManufacturers"); - responseDocument.Data.SingleValue.Attributes.ShouldNotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeEmpty(); + responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); long newManufacturerId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs index 8b756a673f..998e86f3e6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs @@ -82,7 +82,7 @@ public async Task Can_use_custom_query_string_parameter() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.ShouldNotBeEmpty(); + responseDocument.Should().NotBeEmpty(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs index ef54a50766..a1c1f28095 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs @@ -73,7 +73,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); httpResponse.Headers.ETag.Tag.ShouldNotBeNullOrEmpty(); - responseDocument.ShouldNotBeEmpty(); + responseDocument.Should().NotBeEmpty(); } [Fact] @@ -90,7 +90,7 @@ public async Task Returns_no_ETag_for_failed_GET_request() httpResponse.Headers.ETag.Should().BeNull(); - responseDocument.ShouldNotBeEmpty(); + responseDocument.Should().NotBeEmpty(); } [Fact] @@ -123,7 +123,7 @@ public async Task Returns_no_ETag_for_POST_request() httpResponse.Headers.ETag.Should().BeNull(); - responseDocument.ShouldNotBeEmpty(); + responseDocument.Should().NotBeEmpty(); } [Fact] @@ -234,6 +234,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); httpResponse.Headers.ETag.Tag.ShouldNotBeNullOrEmpty(); - responseDocument.ShouldNotBeEmpty(); + responseDocument.Should().NotBeEmpty(); } } diff --git a/test/NoEntityFrameworkTests/PersonTests.cs b/test/NoEntityFrameworkTests/PersonTests.cs index cb355dd730..22c7ea959b 100644 --- a/test/NoEntityFrameworkTests/PersonTests.cs +++ b/test/NoEntityFrameworkTests/PersonTests.cs @@ -140,7 +140,7 @@ public async Task Can_select_fields_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldNotBeEmpty(); + responseDocument.Data.ManyValue.Should().NotBeEmpty(); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.ShouldOnlyContainKeys("lastName", "displayName")); } diff --git a/test/NoEntityFrameworkTests/TagTests.cs b/test/NoEntityFrameworkTests/TagTests.cs index 9dd4c2e65e..3aff1b7d43 100644 --- a/test/NoEntityFrameworkTests/TagTests.cs +++ b/test/NoEntityFrameworkTests/TagTests.cs @@ -142,7 +142,7 @@ public async Task Can_select_fields_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldNotBeEmpty(); + responseDocument.Data.ManyValue.Should().NotBeEmpty(); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.Should().BeNull()); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Relationships.ShouldOnlyContainKeys("todoItems")); } diff --git a/test/NoEntityFrameworkTests/TodoItemTests.cs b/test/NoEntityFrameworkTests/TodoItemTests.cs index 5f95335009..5f1f6cc68a 100644 --- a/test/NoEntityFrameworkTests/TodoItemTests.cs +++ b/test/NoEntityFrameworkTests/TodoItemTests.cs @@ -140,7 +140,7 @@ public async Task Can_select_fields_in_primary_resources() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.ManyValue.ShouldNotBeEmpty(); + responseDocument.Data.ManyValue.Should().NotBeEmpty(); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.ShouldOnlyContainKeys("description", "priority")); } diff --git a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs index cc5950e436..de1ec8460c 100644 --- a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs +++ b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs @@ -16,18 +16,6 @@ public static T ShouldNotBeNull([SysNotNull] this T? subject) return subject!; } - [CustomAssertion] - public static void ShouldNotBeEmpty([SysNotNull] this string? subject) - { - subject.Should().NotBeEmpty(); - } - - [CustomAssertion] - public static void ShouldNotBeEmpty([SysNotNull] this IEnumerable? subject) - { - subject.Should().NotBeEmpty(); - } - [CustomAssertion] public static void ShouldNotBeNullOrEmpty([SysNotNull] this string? subject) { diff --git a/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs b/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs index 8f30b584e4..6593d4ebcc 100644 --- a/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs +++ b/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs @@ -21,7 +21,7 @@ public void GetResourceDescriptorsPerAssembly_Locates_Identifiable_Resource() IReadOnlyCollection descriptors = assemblyCache.GetResourceDescriptors(); // Assert - descriptors.ShouldNotBeEmpty(); + descriptors.Should().NotBeEmpty(); descriptors.Should().ContainSingle(descriptor => descriptor.ResourceClrType == resourceClrType); } @@ -38,7 +38,7 @@ public void GetResourceDescriptorsPerAssembly_Only_Contains_IIdentifiable_Types( IReadOnlyCollection descriptors = assemblyCache.GetResourceDescriptors(); // Assert - descriptors.ShouldNotBeEmpty(); + descriptors.Should().NotBeEmpty(); descriptors.Select(descriptor => descriptor.ResourceClrType).Should().AllBeAssignableTo(); } } From 3c1b7a8373ab7857d9102ffe14edf97273d43ba3 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:35:03 +0100 Subject: [PATCH 5/8] Remove ShouldNotBeNullOrEmpty --- .../IntegrationTests/Serialization/ETagTests.cs | 8 ++++---- test/TestBuildingBlocks/NullabilityAssertionExtensions.cs | 6 ------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs index a1c1f28095..071433deff 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs @@ -43,7 +43,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Headers.ETag.ShouldNotBeNull(); httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); - httpResponse.Headers.ETag.Tag.ShouldNotBeNullOrEmpty(); + httpResponse.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); responseDocument.Should().BeEmpty(); } @@ -71,7 +71,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Headers.ETag.ShouldNotBeNull(); httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); - httpResponse.Headers.ETag.Tag.ShouldNotBeNullOrEmpty(); + httpResponse.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); responseDocument.Should().NotBeEmpty(); } @@ -202,7 +202,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse2.Headers.ETag.ShouldNotBeNull(); httpResponse2.Headers.ETag.IsWeak.Should().BeFalse(); - httpResponse2.Headers.ETag.Tag.ShouldNotBeNullOrEmpty(); + httpResponse2.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); responseDocument2.Should().BeEmpty(); } @@ -232,7 +232,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Headers.ETag.ShouldNotBeNull(); httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); - httpResponse.Headers.ETag.Tag.ShouldNotBeNullOrEmpty(); + httpResponse.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); responseDocument.Should().NotBeEmpty(); } diff --git a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs index de1ec8460c..c022f059fc 100644 --- a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs +++ b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs @@ -16,12 +16,6 @@ public static T ShouldNotBeNull([SysNotNull] this T? subject) return subject!; } - [CustomAssertion] - public static void ShouldNotBeNullOrEmpty([SysNotNull] this string? subject) - { - subject.Should().NotBeNullOrEmpty(); - } - [CustomAssertion] public static TValue? ShouldContainKey([SysNotNull] this IDictionary? subject, TKey expected) { From 10e112d763060a92ca04b497a5857392c3127512 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:52:14 +0100 Subject: [PATCH 6/8] Remove ShouldOnlyContainKeys --- .../QueryStrings/IncludeTests.cs | 4 +- .../Resources/CreateResourceTests.cs | 8 +- .../ReadWrite/Resources/FetchResourceTests.cs | 12 +-- .../Resources/UpdateResourceTests.cs | 4 +- .../ResourceInheritanceReadTests.cs | 86 +++++++++---------- .../ResourceInheritanceWriteTests.cs | 12 +-- test/NoEntityFrameworkTests/PersonTests.cs | 2 +- test/NoEntityFrameworkTests/TagTests.cs | 2 +- test/NoEntityFrameworkTests/TodoItemTests.cs | 2 +- test/TestBuildingBlocks/FluentExtensions.cs | 15 ++++ .../NullabilityAssertionExtensions.cs | 9 +- 11 files changed, 82 insertions(+), 74 deletions(-) create mode 100644 test/TestBuildingBlocks/FluentExtensions.cs diff --git a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs index bf1815c29c..b2c6a84e39 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs @@ -204,8 +204,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.ForEach(resource => { resource.Type.Should().Be("todoItems"); - resource.Attributes.ShouldOnlyContainKeys("description", "priority", "durationInHours", "createdAt", "modifiedAt"); - resource.Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + resource.Attributes.Should().OnlyContainKeys("description", "priority", "durationInHours", "createdAt", "modifiedAt"); + resource.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); }); responseDocument.Included.Should().HaveCount(25 * 15 * 2); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs index c631144ef8..580d8d5c57 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs @@ -100,7 +100,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); httpResponse.Headers.Location.Should().Be($"/todoItems/{newTodoItemId}"); @@ -235,7 +235,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().BeNull()); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -411,7 +411,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("loginAccounts"); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("userName").With(value => value.Should().Be(newUserName)); responseDocument.Data.SingleValue.Attributes.Should().NotContainKey("lastUsedAt"); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("recovery", "person"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("recovery", "person"); long newLoginAccountId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -525,7 +525,7 @@ public async Task Can_create_resource_with_calculated_attribute() responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(newPerson.FirstName)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(newPerson.LastName)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(newPerson.DisplayName)); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); long newPersonId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs index 672504de22..1ffda70c3e 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs @@ -58,7 +58,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItems[1].DurationInHours)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(todoItems[1].CreatedAt)); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(todoItems[1].LastModifiedAt)); - responseDocument.Data.ManyValue[0].Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + responseDocument.Data.ManyValue[0].Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItems[0].StringId); responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItems[0].Description)); @@ -66,7 +66,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItems[0].DurationInHours)); responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(todoItems[0].CreatedAt)); responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(todoItems[0].LastModifiedAt)); - responseDocument.Data.ManyValue[1].Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + responseDocument.Data.ManyValue[1].Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Meta.Should().ContainTotal(2); @@ -126,7 +126,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItem.DurationInHours)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(todoItem.CreatedAt)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(todoItem.LastModifiedAt)); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Meta.Should().BeNull(); @@ -216,11 +216,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.Tags.ElementAt(0).StringId); responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItem.Tags.ElementAt(0).Name)); - responseDocument.Data.ManyValue[0].Relationships.ShouldOnlyContainKeys("todoItem", "color"); + responseDocument.Data.ManyValue[0].Relationships.Should().OnlyContainKeys("todoItem", "color"); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItem.Tags.ElementAt(1).StringId); responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItem.Tags.ElementAt(1).Name)); - responseDocument.Data.ManyValue[1].Relationships.ShouldOnlyContainKeys("todoItem", "color"); + responseDocument.Data.ManyValue[1].Relationships.Should().OnlyContainKeys("todoItem", "color"); responseDocument.Meta.Should().ContainTotal(2); @@ -284,7 +284,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(todoItem.Owner.FirstName)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Owner.LastName)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(todoItem.Owner.DisplayName)); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); responseDocument.Meta.Should().BeNull(); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs index 0de6c93264..e97c0050e5 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs @@ -151,7 +151,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(newDurationInHours)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(existingTodoItem.CreatedAt)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -308,7 +308,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(newTodoItem.DurationInHours)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(existingTodoItem.CreatedAt)); responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("owner", "assignee", "tags"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs index cd39784fcf..4953100a57 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs @@ -90,7 +90,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(bike.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(bike.GearCount)); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); foreach ((string name, RelationshipObject? value) in resource.Relationships) { @@ -114,7 +114,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); resource.Attributes.ShouldContainKey("passengerCount").With(value => value.Should().Be(tandem.PassengerCount)); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); foreach ((string name, RelationshipObject? value) in resource.Relationships) { @@ -138,7 +138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.ShouldContainKey("licensePlate").With(value => value.Should().Be(car.LicensePlate)); resource.Attributes.ShouldContainKey("seatCount").With(value => value.Should().Be(car.SeatCount)); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "features"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "features"); foreach ((string name, RelationshipObject? value) in resource.Relationships) { @@ -162,7 +162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.ShouldContainKey("licensePlate").With(value => value.Should().Be(truck.LicensePlate)); resource.Attributes.ShouldContainKey("loadingCapacity").With(value => value.Should().Be(truck.LoadingCapacity)); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "sleepingArea", "features"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "sleepingArea", "features"); foreach ((string name, RelationshipObject? value) in resource.Relationships) { @@ -213,7 +213,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(bike.RequiresDriverLicense)); resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(bike.GearCount)); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); foreach ((string name, RelationshipObject? value) in resource.Relationships) { @@ -237,7 +237,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); resource.Attributes.ShouldContainKey("passengerCount").With(value => value.Should().Be(tandem.PassengerCount)); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); foreach ((string name, RelationshipObject? value) in resource.Relationships) { @@ -289,7 +289,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); resource.Attributes.ShouldContainKey("passengerCount").With(value => value.Should().Be(tandem.PassengerCount)); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); foreach ((string name, RelationshipObject? value) in resource.Relationships) { @@ -324,8 +324,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); } [Fact] @@ -351,8 +351,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); } [Fact] @@ -378,8 +378,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); } [Fact] @@ -660,7 +660,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/chromeWheels/{resource.Id}"); - resource.Attributes.ShouldOnlyContainKeys("radius", "paintColor"); + resource.Attributes.Should().OnlyContainKeys("radius", "paintColor"); } foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "carbonWheels")) @@ -668,7 +668,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/carbonWheels/{resource.Id}"); - resource.Attributes.ShouldOnlyContainKeys("radius", "hasTube"); + resource.Attributes.Should().OnlyContainKeys("radius", "hasTube"); } foreach (ResourceObject resource in responseDocument.Data.ManyValue) @@ -728,7 +728,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/chromeWheels/{resource.Id}"); - resource.Attributes.ShouldOnlyContainKeys("radius", "paintColor"); + resource.Attributes.Should().OnlyContainKeys("radius", "paintColor"); } foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "carbonWheels")) @@ -736,7 +736,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/carbonWheels/{resource.Id}"); - resource.Attributes.ShouldOnlyContainKeys("radius", "hasTube"); + resource.Attributes.Should().OnlyContainKeys("radius", "hasTube"); } foreach (ResourceObject resource in responseDocument.Data.ManyValue) @@ -790,7 +790,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/chromeWheels/{resource.Id}"); - resource.Attributes.ShouldOnlyContainKeys("radius", "paintColor"); + resource.Attributes.Should().OnlyContainKeys("radius", "paintColor"); } foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "carbonWheels")) @@ -798,7 +798,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be($"/carbonWheels/{resource.Id}"); - resource.Attributes.ShouldOnlyContainKeys("radius", "hasTube"); + resource.Attributes.Should().OnlyContainKeys("radius", "hasTube"); } foreach (ResourceObject resource in responseDocument.Data.ManyValue) @@ -1222,29 +1222,29 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { resource.Id.Should().Be(bike.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "gearCount"); - resource.Relationships.ShouldOnlyContainKeys("lights"); + resource.Attributes.Should().OnlyContainKeys("weight", "gearCount"); + resource.Relationships.Should().OnlyContainKeys("lights"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "tandems").Subject.With(resource => { resource.Id.Should().Be(tandem.StringId); - resource.Attributes.ShouldOnlyContainKeys("gearCount", "passengerCount"); - resource.Relationships.ShouldOnlyContainKeys("cargoBox"); + resource.Attributes.Should().OnlyContainKeys("gearCount", "passengerCount"); + resource.Relationships.Should().OnlyContainKeys("cargoBox"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "cars").Subject.With(resource => { resource.Id.Should().Be(car.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "seatCount"); - resource.Relationships.ShouldOnlyContainKeys("engine"); + resource.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "seatCount"); + resource.Relationships.Should().OnlyContainKeys("engine"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "trucks").Subject.With(resource => { resource.Id.Should().Be(truck.StringId); - resource.Attributes.ShouldOnlyContainKeys("loadingCapacity"); - resource.Relationships.ShouldOnlyContainKeys("sleepingArea"); + resource.Attributes.Should().OnlyContainKeys("loadingCapacity"); + resource.Relationships.Should().OnlyContainKeys("sleepingArea"); }); } @@ -1285,29 +1285,29 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "bikes").Subject.With(resource => { resource.Id.Should().Be(bike.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "gearCount"); - resource.Relationships.ShouldOnlyContainKeys("lights"); + resource.Attributes.Should().OnlyContainKeys("weight", "gearCount"); + resource.Relationships.Should().OnlyContainKeys("lights"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "tandems").Subject.With(resource => { resource.Id.Should().Be(tandem.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "lights", "cargoBox", "foldingDimensions", "features"); + resource.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "lights", "cargoBox", "foldingDimensions", "features"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "cars").Subject.With(resource => { resource.Id.Should().Be(car.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "seatCount"); - resource.Relationships.ShouldOnlyContainKeys("engine"); + resource.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "seatCount"); + resource.Relationships.Should().OnlyContainKeys("engine"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "trucks").Subject.With(resource => { resource.Id.Should().Be(truck.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "licensePlate", "loadingCapacity"); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "sleepingArea", "features"); + resource.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "licensePlate", "loadingCapacity"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "sleepingArea", "features"); }); } @@ -1342,16 +1342,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(bike.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "gearCount"); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "lights"); + resource.Attributes.Should().OnlyContainKeys("weight", "gearCount"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "lights"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "tandems").Subject.With(resource => { resource.Id.Should().Be(tandem.StringId); - resource.Attributes.ShouldOnlyContainKeys("passengerCount"); - resource.Relationships.ShouldOnlyContainKeys("cargoBox"); + resource.Attributes.Should().OnlyContainKeys("passengerCount"); + resource.Relationships.Should().OnlyContainKeys("cargoBox"); }); } @@ -1385,16 +1385,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(bike.StringId); - resource.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "gearCount"); - resource.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); + resource.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount"); + resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); }); responseDocument.Data.ManyValue.Should().ContainSingle(resource => resource.Type == "tandems").Subject.With(resource => { resource.Id.Should().Be(tandem.StringId); - resource.Attributes.ShouldOnlyContainKeys("passengerCount"); - resource.Relationships.ShouldOnlyContainKeys("cargoBox"); + resource.Attributes.Should().OnlyContainKeys("passengerCount"); + resource.Relationships.Should().OnlyContainKeys("cargoBox"); }); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs index 3ce4e83d8b..c6e3c13d4c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs @@ -194,8 +194,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("bikes"); - responseDocument.Data.SingleValue.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "gearCount"); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); + responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); long newBikeId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -335,8 +335,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("cars"); - responseDocument.Data.SingleValue.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "licensePlate", "seatCount"); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "features"); + responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "licensePlate", "seatCount"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "features"); long newCarId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -485,8 +485,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); - responseDocument.Data.SingleValue.Attributes.ShouldOnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.ShouldOnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); long newTandemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); diff --git a/test/NoEntityFrameworkTests/PersonTests.cs b/test/NoEntityFrameworkTests/PersonTests.cs index 22c7ea959b..bb45893b52 100644 --- a/test/NoEntityFrameworkTests/PersonTests.cs +++ b/test/NoEntityFrameworkTests/PersonTests.cs @@ -141,7 +141,7 @@ public async Task Can_select_fields_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().NotBeEmpty(); - responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.ShouldOnlyContainKeys("lastName", "displayName")); + responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.Should().OnlyContainKeys("lastName", "displayName")); } [Fact] diff --git a/test/NoEntityFrameworkTests/TagTests.cs b/test/NoEntityFrameworkTests/TagTests.cs index 3aff1b7d43..c0af4900b0 100644 --- a/test/NoEntityFrameworkTests/TagTests.cs +++ b/test/NoEntityFrameworkTests/TagTests.cs @@ -144,7 +144,7 @@ public async Task Can_select_fields_in_primary_resources() responseDocument.Data.ManyValue.Should().NotBeEmpty(); responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.Should().BeNull()); - responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Relationships.ShouldOnlyContainKeys("todoItems")); + responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Relationships.Should().OnlyContainKeys("todoItems")); } [Fact] diff --git a/test/NoEntityFrameworkTests/TodoItemTests.cs b/test/NoEntityFrameworkTests/TodoItemTests.cs index 5f1f6cc68a..8a4d7ffb38 100644 --- a/test/NoEntityFrameworkTests/TodoItemTests.cs +++ b/test/NoEntityFrameworkTests/TodoItemTests.cs @@ -141,7 +141,7 @@ public async Task Can_select_fields_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().NotBeEmpty(); - responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.ShouldOnlyContainKeys("description", "priority")); + responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Attributes.Should().OnlyContainKeys("description", "priority")); } [Fact] diff --git a/test/TestBuildingBlocks/FluentExtensions.cs b/test/TestBuildingBlocks/FluentExtensions.cs new file mode 100644 index 0000000000..2da5e81a79 --- /dev/null +++ b/test/TestBuildingBlocks/FluentExtensions.cs @@ -0,0 +1,15 @@ +using FluentAssertions; +using FluentAssertions.Collections; + +namespace TestBuildingBlocks; + +public static class FluentExtensions +{ + public static AndConstraint OnlyContainKeys( + this GenericDictionaryAssertions source, params TKey[] expected) + where TCollection : IEnumerable> + where TAssertions : GenericDictionaryAssertions + { + return source.HaveCount(expected.Length).And.ContainKeys(expected); + } +} diff --git a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs index c022f059fc..9a36e8e51d 100644 --- a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs +++ b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs @@ -13,7 +13,7 @@ public static class NullabilityAssertionExtensions public static T ShouldNotBeNull([SysNotNull] this T? subject) { subject.Should().NotBeNull(); - return subject!; + return subject; } [CustomAssertion] @@ -24,13 +24,6 @@ public static T ShouldNotBeNull([SysNotNull] this T? subject) return subject![expected]; } - [CustomAssertion] - public static void ShouldOnlyContainKeys([SysNotNull] this IDictionary? subject, params TKey[] expected) - { - subject.Should().HaveCount(expected.Length); - subject.Should().ContainKeys(expected); - } - public static void With(this T subject, [InstantHandle] Action continuation) { continuation(subject); From f54403c8821f95c663a3d1119d4b7bad2e2d1e95 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 1 Mar 2025 14:14:35 +0100 Subject: [PATCH 7/8] Remove ShouldContainKey --- .../AtomicOperations/AtomicOperationsTests.cs | 6 +- .../QueryStrings/IncludeTests.cs | 28 ++-- .../QueryStrings/SparseFieldSets.cs | 20 +-- .../Resources/CreateResourceTests.cs | 28 ++-- .../ReadWrite/Resources/FetchResourceTests.cs | 40 +++--- .../Resources/UpdateResourceTests.cs | 20 +-- .../Archiving/ArchiveTests.cs | 36 +++--- .../Creating/AtomicCreateResourceTests.cs | 46 +++---- ...reateResourceWithClientGeneratedIdTests.cs | 14 +- ...eateResourceWithToManyRelationshipTests.cs | 16 +-- ...reateResourceWithToOneRelationshipTests.cs | 18 +-- .../Deleting/AtomicDeleteResourceTests.cs | 14 +- .../Links/AtomicAbsoluteLinksTests.cs | 4 +- .../AtomicRelativeLinksWithNamespaceTests.cs | 4 +- .../LocalIds/AtomicLocalIdTests.cs | 64 ++++----- .../Meta/AtomicResourceMetaTests.cs | 6 +- .../Meta/AtomicResponseMetaTests.cs | 12 +- .../Mixed/AtomicRequestBodyTests.cs | 8 +- .../Mixed/MaximumOperationsPerRequestTests.cs | 2 +- ...micSerializationResourceDefinitionTests.cs | 16 +-- ...icSparseFieldSetResourceDefinitionTests.cs | 8 +- .../AtomicAddToToManyRelationshipTests.cs | 34 ++--- ...AtomicRemoveFromToManyRelationshipTests.cs | 32 ++--- .../AtomicReplaceToManyRelationshipTests.cs | 34 ++--- .../AtomicUpdateToOneRelationshipTests.cs | 32 ++--- .../AtomicReplaceToManyRelationshipTests.cs | 18 +-- .../Resources/AtomicUpdateResourceTests.cs | 48 +++---- .../AtomicUpdateToOneRelationshipTests.cs | 18 +-- .../IntegrationTests/Blobs/BlobTests.cs | 26 ++-- .../CustomExtensionsContentTypeTests.cs | 9 +- .../CustomRoutes/CustomRouteTests.cs | 8 +- .../EagerLoading/EagerLoadingTests.cs | 42 +++--- .../ExceptionHandlerTests.cs | 8 +- .../HostingInIIS/HostingTests.cs | 8 +- .../IdObfuscation/IdObfuscationTests.cs | 4 +- .../ModelState/ModelStateValidationTests.cs | 8 +- .../ModelState/NoModelStateValidationTests.cs | 2 +- .../Links/AbsoluteLinksWithNamespaceTests.cs | 18 +-- .../AbsoluteLinksWithoutNamespaceTests.cs | 18 +-- .../Links/LinkInclusionIncludeTests.cs | 2 +- .../Links/LinkInclusionTests.cs | 10 +- .../Links/RelativeLinksWithNamespaceTests.cs | 18 +-- .../RelativeLinksWithoutNamespaceTests.cs | 18 +-- .../Meta/ResourceMetaTests.cs | 6 +- .../FireForgetTests.Group.cs | 4 +- .../FireForgetTests.User.cs | 8 +- .../OutboxTests.Group.cs | 4 +- .../OutboxTests.User.cs | 8 +- .../MultiTenancy/MultiTenancyTests.cs | 6 +- .../NamingConventions/KebabCasingTests.cs | 16 +-- .../NamingConventions/PascalCasingTests.cs | 18 +-- .../Filtering/FilterDataTypeTests.cs | 22 ++-- .../Filtering/FilterOperatorTests.cs | 42 +++--- .../QueryStrings/Filtering/FilterTests.cs | 2 +- .../QueryStrings/Includes/IncludeTests.cs | 122 +++++++++--------- .../SerializerIgnoreConditionTests.cs | 8 +- .../SparseFieldSets/SparseFieldSetTests.cs | 84 ++++++------ .../ReadWrite/Creating/CreateResourceTests.cs | 46 +++---- ...reateResourceWithClientGeneratedIdTests.cs | 16 +-- ...eateResourceWithToManyRelationshipTests.cs | 30 ++--- ...reateResourceWithToOneRelationshipTests.cs | 34 ++--- .../ReadWrite/Fetching/FetchResourceTests.cs | 42 +++--- .../AddToToManyRelationshipTests.cs | 20 +-- .../RemoveFromToManyRelationshipTests.cs | 20 +-- .../ReplaceToManyRelationshipTests.cs | 18 +-- .../UpdateToOneRelationshipTests.cs | 16 +-- .../ReplaceToManyRelationshipTests.cs | 28 ++-- .../Updating/Resources/UpdateResourceTests.cs | 60 ++++----- .../Resources/UpdateToOneRelationshipTests.cs | 28 ++-- .../ResourceInjectionTests.cs | 20 +-- .../Reading/ResourceDefinitionReadTests.cs | 20 +-- .../ResourceDefinitionSerializationTests.cs | 32 ++--- .../AtomicOperationTests.cs | 6 +- .../ResourceInheritanceChangeTrackerTests.cs | 2 +- .../ResourceInheritanceReadTests.cs | 84 ++++++------ .../ZeroKeys/ZeroAsKeyTests.cs | 2 +- .../ResourceObjectConverterTests.cs | 6 +- .../Response/ResponseModelAdapterTests.cs | 2 +- test/MultiDbContextTests/ResourceTests.cs | 4 +- test/NoEntityFrameworkTests/PersonTests.cs | 10 +- test/NoEntityFrameworkTests/TagTests.cs | 12 +- test/NoEntityFrameworkTests/TodoItemTests.cs | 10 +- .../NullabilityAssertionExtensions.cs | 8 -- 83 files changed, 871 insertions(+), 880 deletions(-) diff --git a/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs index dd802fbc0c..d82cf6bbfb 100644 --- a/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs +++ b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs @@ -509,7 +509,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => """)); command.Parameters.Should().HaveCount(1); - command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull()); + command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull(); }); store.SqlCommands[2].With(command => @@ -522,7 +522,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => """)); command.Parameters.Should().HaveCount(1); - command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull()); + command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull(); }); store.SqlCommands[3].With(command => @@ -534,7 +534,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => """)); command.Parameters.Should().HaveCount(2); - command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull()); + command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull(); command.Parameters.Should().Contain("@p2", unknownTodoItemId); }); diff --git a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs index b2c6a84e39..1a49ad1bcc 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs @@ -60,7 +60,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Relationships.With(relationships => { - relationships.ShouldContainKey("owner").With(value => + relationships.Should().ContainKey("owner").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -68,13 +68,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(todoItems[0].Owner.StringId); }); - relationships.ShouldContainKey("assignee").With(value => + relationships.Should().ContainKey("assignee").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.Should().BeNull(); }); - relationships.ShouldContainKey("tags").With(value => + relationships.Should().ContainKey("tags").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(2); @@ -88,7 +88,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Relationships.With(relationships => { - relationships.ShouldContainKey("owner").With(value => + relationships.Should().ContainKey("owner").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -96,7 +96,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(todoItems[1].Owner.StringId); }); - relationships.ShouldContainKey("assignee").With(value => + relationships.Should().ContainKey("assignee").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -104,7 +104,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(todoItems[1].Assignee!.StringId); }); - relationships.ShouldContainKey("tags").With(value => + relationships.Should().ContainKey("tags").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(2); @@ -118,29 +118,29 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("people"); responseDocument.Included[0].Id.Should().Be(owner.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(owner.FirstName)); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(owner.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(owner.FirstName); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(owner.LastName); responseDocument.Included[1].Type.Should().Be("tags"); responseDocument.Included[1].Id.Should().Be(todoItems[0].Tags.ElementAt(0).StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[0].Tags.ElementAt(0).Name)); + responseDocument.Included[1].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[0].Tags.ElementAt(0).Name); responseDocument.Included[2].Type.Should().Be("tags"); responseDocument.Included[2].Id.Should().Be(todoItems[0].Tags.ElementAt(1).StringId); - responseDocument.Included[2].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[0].Tags.ElementAt(1).Name)); + responseDocument.Included[2].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[0].Tags.ElementAt(1).Name); responseDocument.Included[3].Type.Should().Be("people"); responseDocument.Included[3].Id.Should().Be(todoItems[1].Assignee!.StringId); - responseDocument.Included[3].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(todoItems[1].Assignee!.FirstName)); - responseDocument.Included[3].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItems[1].Assignee!.LastName)); + responseDocument.Included[3].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(todoItems[1].Assignee!.FirstName); + responseDocument.Included[3].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(todoItems[1].Assignee!.LastName); responseDocument.Included[4].Type.Should().Be("tags"); responseDocument.Included[4].Id.Should().Be(todoItems[1].Tags.ElementAt(0).StringId); - responseDocument.Included[4].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[1].Tags.ElementAt(0).Name)); + responseDocument.Included[4].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[1].Tags.ElementAt(0).Name); responseDocument.Included[5].Type.Should().Be("tags"); responseDocument.Included[5].Id.Should().Be(todoItems[1].Tags.ElementAt(1).StringId); - responseDocument.Included[5].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[1].Tags.ElementAt(1).Name)); + responseDocument.Included[5].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[1].Tags.ElementAt(1).Name); responseDocument.Meta.Should().ContainTotal(2); diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs index de65f7d918..d479eb821e 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs @@ -51,11 +51,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(2); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItem.DurationInHours)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItem.DurationInHours)); responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(2); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("owner").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("owner").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -63,7 +63,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(todoItem.Owner.StringId); }); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("assignee").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("assignee").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -76,12 +76,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Id.Should().Be(todoItem.Owner.StringId); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Owner.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.LastName)); responseDocument.Included[0].Relationships.Should().BeNull(); responseDocument.Included[1].Id.Should().Be(todoItem.Assignee.StringId); responseDocument.Included[1].Attributes.Should().HaveCount(1); - responseDocument.Included[1].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Assignee.LastName)); + responseDocument.Included[1].Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Assignee.LastName)); responseDocument.Included[1].Relationships.Should().BeNull(); store.SqlCommands.Should().HaveCount(2); @@ -138,7 +138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); store.SqlCommands.Should().HaveCount(1); @@ -187,7 +187,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Attributes.Should().BeNull(); responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("color").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("color").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -338,7 +338,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(person.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(person.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(person.DisplayName)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); store.SqlCommands.Should().HaveCount(1); @@ -385,7 +385,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); responseDocument.Included.Should().HaveCount(2); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs index 580d8d5c57..e2e050bac2 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs @@ -94,11 +94,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newTodoItem.Description)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(newTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(newTodoItem.DurationInHours)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(newTodoItem.DurationInHours)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().BeNull()); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); @@ -230,11 +230,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newTodoItem.Description)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(newTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().BeNull()); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -409,7 +409,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("loginAccounts"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("userName").With(value => value.Should().Be(newUserName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("userName").WhoseValue.With(value => value.Should().Be(newUserName)); responseDocument.Data.SingleValue.Attributes.Should().NotContainKey("lastUsedAt"); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("recovery", "person"); @@ -522,9 +522,9 @@ public async Task Can_create_resource_with_calculated_attribute() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(newPerson.FirstName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(newPerson.LastName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(newPerson.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(newPerson.FirstName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(newPerson.LastName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(newPerson.DisplayName)); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); long newPersonId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs index 1ffda70c3e..0bf6a09ce7 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs @@ -53,19 +53,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItems[1].Description)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("priority").With(value => value.Should().Be(todoItems[1].Priority)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItems[1].DurationInHours)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(todoItems[1].CreatedAt)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(todoItems[1].LastModifiedAt)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItems[1].Description)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(todoItems[1].Priority)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItems[1].DurationInHours)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(todoItems[1].CreatedAt)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(todoItems[1].LastModifiedAt)); responseDocument.Data.ManyValue[0].Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItems[0].StringId); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItems[0].Description)); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("priority").With(value => value.Should().Be(todoItems[0].Priority)); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItems[0].DurationInHours)); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(todoItems[0].CreatedAt)); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(todoItems[0].LastModifiedAt)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItems[0].Description)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(todoItems[0].Priority)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItems[0].DurationInHours)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(todoItems[0].CreatedAt)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(todoItems[0].LastModifiedAt)); responseDocument.Data.ManyValue[1].Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Meta.Should().ContainTotal(2); @@ -121,11 +121,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(todoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItem.DurationInHours)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(todoItem.CreatedAt)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(todoItem.LastModifiedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(todoItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItem.DurationInHours)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(todoItem.CreatedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(todoItem.LastModifiedAt)); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Meta.Should().BeNull(); @@ -215,11 +215,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.Tags.ElementAt(0).StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItem.Tags.ElementAt(0).Name)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(todoItem.Tags.ElementAt(0).Name)); responseDocument.Data.ManyValue[0].Relationships.Should().OnlyContainKeys("todoItem", "color"); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItem.Tags.ElementAt(1).StringId); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItem.Tags.ElementAt(1).Name)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(todoItem.Tags.ElementAt(1).Name)); responseDocument.Data.ManyValue[1].Relationships.Should().OnlyContainKeys("todoItem", "color"); responseDocument.Meta.Should().ContainTotal(2); @@ -281,9 +281,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.Owner.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(todoItem.Owner.FirstName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Owner.LastName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(todoItem.Owner.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.FirstName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.LastName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.DisplayName)); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); responseDocument.Meta.Should().BeNull(); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs index e97c0050e5..4b559712c8 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs @@ -146,11 +146,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingTodoItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newDescription)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(newDurationInHours)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(existingTodoItem.CreatedAt)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newDescription)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(existingTodoItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(newDurationInHours)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(existingTodoItem.CreatedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -303,11 +303,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingTodoItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newTodoItem.Description)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(newTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(newTodoItem.DurationInHours)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(existingTodoItem.CreatedAt)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().Be(DapperTestContext.FrozenTime)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(newTodoItem.DurationInHours)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(existingTodoItem.CreatedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); await _testContext.RunOnDatabaseAsync(async dbContext => diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs index 159c837b82..cb9f7b80c6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs @@ -46,7 +46,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(broadcast.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(broadcast.ArchivedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(broadcast.ArchivedAt)); } [Fact] @@ -72,7 +72,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(broadcast.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -99,7 +99,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(broadcasts[1].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -126,10 +126,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(broadcasts[0].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(broadcasts[0].ArchivedAt)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(broadcasts[0].ArchivedAt)); responseDocument.Data.ManyValue[1].Id.Should().Be(broadcasts[1].StringId); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -159,7 +159,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -189,9 +189,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(station.Broadcasts.ElementAt(0).StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(station.Broadcasts.ElementAt(0).ArchivedAt)); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(station.Broadcasts.ElementAt(0).ArchivedAt)); responseDocument.Included[1].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Included[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -217,7 +217,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.AppliesTo.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(comment.AppliesTo.ArchivedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(comment.AppliesTo.ArchivedAt)); } [Fact] @@ -244,7 +244,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -273,10 +273,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(0).StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(archivedAt0)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(archivedAt0)); responseDocument.Data.ManyValue[1].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -307,7 +307,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(1).StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -340,9 +340,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(0).StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().Be(archivedAt0)); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(archivedAt0)); responseDocument.Included[1].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(1).StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Included[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] @@ -426,9 +426,9 @@ public async Task Can_create_unarchived_resource() httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newBroadcast.Title)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("airedAt").With(value => value.Should().Be(newBroadcast.AiredAt)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("archivedAt").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newBroadcast.Title)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("airedAt").WhoseValue.With(value => value.Should().Be(newBroadcast.AiredAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs index 2bb03ca2eb..ab13c192f2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs @@ -70,8 +70,8 @@ public async Task Can_create_resource() responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("performers"); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newArtistName)); - resource.Attributes.ShouldContainKey("bornAt").With(value => value.Should().Be(newBornAt)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("bornAt").WhoseValue.With(value => value.Should().Be(newBornAt)); resource.Relationships.Should().BeNull(); }); @@ -136,13 +136,13 @@ public async Task Can_create_resources() { resource.ShouldNotBeNull(); resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTracks[index].Title)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTracks[index].Title)); - resource.Attributes.ShouldContainKey("lengthInSeconds") + resource.Attributes.Should().ContainKey("lengthInSeconds").WhoseValue .With(value => value.As().Should().BeApproximately(newTracks[index].LengthInSeconds)); - resource.Attributes.ShouldContainKey("genre").With(value => value.Should().Be(newTracks[index].Genre)); - resource.Attributes.ShouldContainKey("releasedAt").With(value => value.Should().Be(newTracks[index].ReleasedAt)); + resource.Attributes.Should().ContainKey("genre").WhoseValue.With(value => value.Should().Be(newTracks[index].Genre)); + resource.Attributes.Should().ContainKey("releasedAt").WhoseValue.With(value => value.Should().Be(newTracks[index].ReleasedAt)); resource.Relationships.Should().NotBeEmpty(); }); @@ -206,8 +206,8 @@ public async Task Can_create_resource_without_attributes_or_relationships() responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("performers"); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().BeNull()); - resource.Attributes.ShouldContainKey("bornAt").With(value => value.Should().Be(default(DateTimeOffset))); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().BeNull()); + resource.Attributes.Should().ContainKey("bornAt").WhoseValue.With(value => value.Should().Be(default(DateTimeOffset))); resource.Relationships.Should().BeNull(); }); @@ -264,7 +264,7 @@ public async Task Cannot_create_resource_with_unknown_attribute() error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'playlists'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -309,7 +309,7 @@ public async Task Can_create_resource_with_unknown_attribute() responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("playlists"); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newName)); resource.Relationships.Should().NotBeEmpty(); }); @@ -369,7 +369,7 @@ public async Task Cannot_create_resource_with_unknown_relationship() error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'lyrics'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -481,7 +481,7 @@ public async Task Cannot_create_resource_with_client_generated_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -516,7 +516,7 @@ public async Task Cannot_create_resource_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -554,7 +554,7 @@ public async Task Cannot_create_resource_for_ref_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -588,7 +588,7 @@ public async Task Cannot_create_resource_for_missing_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -623,7 +623,7 @@ public async Task Cannot_create_resource_for_null_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -670,7 +670,7 @@ public async Task Cannot_create_resource_for_array_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -710,7 +710,7 @@ public async Task Cannot_create_resource_for_missing_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -748,7 +748,7 @@ public async Task Cannot_create_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -793,7 +793,7 @@ public async Task Cannot_create_resource_with_readonly_attribute() error.Detail.Should().Be("Attribute 'isArchived' on resource type 'playlists' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -835,7 +835,7 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() error.Detail.Should().Be("Failed to convert attribute 'bornAt' with value '12345' of type 'Number' to type 'DateTimeOffset'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -916,7 +916,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTitle)); resource.Relationships.Should().NotBeEmpty(); }); @@ -988,6 +988,6 @@ public async Task Cannot_assign_attribute_with_blocked_capability() error.Detail.Should().Be("The attribute 'createdAt' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs index 32376795ea..0bd7e2ad1d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs @@ -78,7 +78,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("textLanguages"); - resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode)); + resource.Attributes.Should().ContainKey("isoCode").WhoseValue.With(value => value.Should().Be(isoCode)); resource.Attributes.Should().NotContainKey("isRightToLeft"); resource.Relationships.Should().NotBeEmpty(); }); @@ -188,7 +188,7 @@ public async Task Can_create_resource_for_missing_client_generated_ID_having_sid responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("textLanguages"); - resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode)); + resource.Attributes.Should().ContainKey("isoCode").WhoseValue.With(value => value.Should().Be(isoCode)); resource.Relationships.Should().NotBeEmpty(); }); @@ -247,7 +247,7 @@ public async Task Cannot_create_resource_for_missing_client_generated_ID(ClientI error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -356,7 +356,7 @@ public async Task Cannot_create_resource_for_incompatible_ID(ClientIdGenerationM error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int32'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -402,7 +402,7 @@ public async Task Can_create_resource_with_local_ID(ClientIdGenerationMode mode) responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTitle)); resource.Relationships.Should().BeNull(); }); @@ -456,7 +456,7 @@ public async Task Cannot_create_resource_with_local_ID(ClientIdGenerationMode mo error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -501,6 +501,6 @@ public async Task Cannot_create_resource_for_ID_and_local_ID(ClientIdGenerationM error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs index 80f9f71ce0..e7c91381d6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs @@ -238,7 +238,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -290,7 +290,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -341,7 +341,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -467,7 +467,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -590,7 +590,7 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -635,7 +635,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -682,7 +682,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -734,6 +734,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs index 6f070904da..78825741da 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs @@ -232,7 +232,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[index].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitles[index])); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitles[index])); }); } @@ -304,7 +304,7 @@ public async Task Cannot_create_for_null_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -348,7 +348,7 @@ public async Task Cannot_create_for_missing_data_in_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -400,7 +400,7 @@ public async Task Cannot_create_for_array_data_in_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -448,7 +448,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -497,7 +497,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -545,7 +545,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -651,7 +651,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -781,6 +781,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/language"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs index daa0e06ffe..bbd9cf8080 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs @@ -355,7 +355,7 @@ public async Task Cannot_delete_resource_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -389,7 +389,7 @@ public async Task Cannot_delete_resource_for_missing_ref_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -427,7 +427,7 @@ public async Task Cannot_delete_resource_for_missing_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -466,7 +466,7 @@ public async Task Cannot_delete_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -504,7 +504,7 @@ public async Task Cannot_delete_resource_for_missing_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -586,7 +586,7 @@ public async Task Cannot_delete_resource_for_incompatible_ID() error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int64'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -626,6 +626,6 @@ public async Task Cannot_delete_resource_for_ID_and_local_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs index 3702697d01..c23fb387c1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs @@ -90,7 +90,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(languageLink); - resource.Relationships.ShouldContainKey("lyrics").With(value => + resource.Relationships.Should().ContainKey("lyrics").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -107,7 +107,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(companyLink); - resource.Relationships.ShouldContainKey("tracks").With(value => + resource.Relationships.Should().ContainKey("tracks").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs index 76a8fe7799..16a6ed61fb 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs @@ -84,7 +84,7 @@ public async Task Create_resource_with_side_effects_returns_relative_links() resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(languageLink); - resource.Relationships.ShouldContainKey("lyrics").With(value => + resource.Relationships.Should().ContainKey("lyrics").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -102,7 +102,7 @@ public async Task Create_resource_with_side_effects_returns_relative_links() resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(companyLink); - resource.Relationships.ShouldContainKey("tracks").With(value => + resource.Relationships.Should().ContainKey("tracks").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs index d6aa71181d..fe97aa6d1a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs @@ -86,15 +86,15 @@ public async Task Can_create_resource_with_ManyToOne_relationship_using_local_ID { resource.Type.Should().Be("recordCompanies"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newCompany.Name)); - resource.Attributes.ShouldContainKey("countryOfResidence").With(value => value.Should().Be(newCompany.CountryOfResidence)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompany.Name)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(newCompany.CountryOfResidence)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); short newCompanyId = short.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -183,15 +183,15 @@ public async Task Can_create_resource_with_OneToMany_relationship_using_local_ID { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newPerformer.ArtistName)); - resource.Attributes.ShouldContainKey("bornAt").With(value => value.Should().Be(newPerformer.BornAt)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newPerformer.ArtistName)); + resource.Attributes.Should().ContainKey("bornAt").WhoseValue.With(value => value.Should().Be(newPerformer.BornAt)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); int newPerformerId = int.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -279,14 +279,14 @@ public async Task Can_create_resource_with_ManyToMany_relationship_using_local_I { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); }); Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); @@ -493,8 +493,8 @@ public async Task Can_update_resource_using_local_ID() { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); - resource.Attributes.ShouldContainKey("genre").With(value => value.Should().BeNull()); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("genre").WhoseValue.With(value => value.Should().BeNull()); }); responseDocument.Results[1].Data.Value.Should().BeNull(); @@ -613,21 +613,21 @@ public async Task Can_update_resource_with_relationships_using_local_ID() { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); }); responseDocument.Results[2].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("recordCompanies"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newCompanyName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanyName)); }); responseDocument.Results[3].Data.Value.Should().BeNull(); @@ -732,14 +732,14 @@ public async Task Can_create_ManyToOne_relationship_using_local_ID() { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("recordCompanies"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newCompanyName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanyName)); }); responseDocument.Results[2].Data.Value.Should().BeNull(); @@ -834,14 +834,14 @@ public async Task Can_create_OneToMany_relationship_using_local_ID() { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); }); responseDocument.Results[2].Data.Value.Should().BeNull(); @@ -936,14 +936,14 @@ public async Task Can_create_ManyToMany_relationship_using_local_ID() { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[2].Data.Value.Should().BeNull(); @@ -1060,14 +1060,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); }); responseDocument.Results[2].Data.Value.Should().BeNull(); @@ -1184,14 +1184,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[2].Data.Value.Should().BeNull(); @@ -1308,14 +1308,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); }); responseDocument.Results[2].Data.Value.Should().BeNull(); @@ -1454,14 +1454,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[2].Data.Value.Should().BeNull(); @@ -1611,21 +1611,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newArtistName1)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName1)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("artistName").With(value => value.Should().Be(newArtistName2)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName2)); }); responseDocument.Results[2].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[3].Data.Value.Should().BeNull(); @@ -1749,7 +1749,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.Value.Should().BeNull(); @@ -1818,7 +1818,7 @@ public async Task Can_delete_resource_using_local_ID() { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); }); responseDocument.Results[1].Data.Value.Should().BeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs index 0eb283dbf8..6d4fe2adbd 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs @@ -89,7 +89,7 @@ public async Task Returns_resource_meta_in_create_resource_with_side_effects() { resource.Meta.Should().HaveCount(1); - resource.Meta.ShouldContainKey("copyright").With(value => + resource.Meta.Should().ContainKey("copyright").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be("(C) 2018. All rights reserved."); @@ -100,7 +100,7 @@ public async Task Returns_resource_meta_in_create_resource_with_side_effects() { resource.Meta.Should().HaveCount(1); - resource.Meta.ShouldContainKey("copyright").With(value => + resource.Meta.Should().ContainKey("copyright").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be("(C) 1994. All rights reserved."); @@ -161,7 +161,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Meta.Should().HaveCount(1); - resource.Meta.ShouldContainKey("notice").With(value => + resource.Meta.Should().ContainKey("notice").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be(TextLanguageMetaDefinition.NoticeText); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs index 92262234b2..b111ee47fb 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResponseMetaTests.cs @@ -62,19 +62,19 @@ public async Task Returns_top_level_meta_in_create_resource_with_side_effects() responseDocument.Meta.Should().HaveCount(3); - responseDocument.Meta.ShouldContainKey("license").With(value => + responseDocument.Meta.Should().ContainKey("license").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be("MIT"); }); - responseDocument.Meta.ShouldContainKey("projectUrl").With(value => + responseDocument.Meta.Should().ContainKey("projectUrl").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be("https://github.com/json-api-dotnet/JsonApiDotNetCore/"); }); - responseDocument.Meta.ShouldContainKey("versions").With(value => + responseDocument.Meta.Should().ContainKey("versions").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; string?[] versionArray = element.EnumerateArray().Select(arrayItem => arrayItem.GetString()).ToArray(); @@ -128,19 +128,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Meta.Should().HaveCount(3); - responseDocument.Meta.ShouldContainKey("license").With(value => + responseDocument.Meta.Should().ContainKey("license").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be("MIT"); }); - responseDocument.Meta.ShouldContainKey("projectUrl").With(value => + responseDocument.Meta.Should().ContainKey("projectUrl").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be("https://github.com/json-api-dotnet/JsonApiDotNetCore/"); }); - responseDocument.Meta.ShouldContainKey("versions").With(value => + responseDocument.Meta.Should().ContainKey("versions").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; string?[] versionArray = element.EnumerateArray().Select(arrayItem => arrayItem.GetString()).ToArray(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs index a978b1e8fb..ed04dc74e3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs @@ -64,7 +64,7 @@ public async Task Cannot_process_for_null_request_body() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -117,7 +117,7 @@ public async Task Cannot_process_for_missing_operations_array() error.Title.Should().Be("Failed to deserialize request body: No operations found."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -144,7 +144,7 @@ public async Task Cannot_process_empty_operations_array() error.Title.Should().Be("Failed to deserialize request body: No operations found."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -175,7 +175,7 @@ public async Task Cannot_process_null_operation() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs index c775bb1f1b..41a9792e37 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs @@ -73,7 +73,7 @@ public async Task Cannot_process_more_operations_than_maximum() error.Detail.Should().Be("The number of operations in this request (3) is higher than the maximum of 2."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs index f398f4a813..d4d7fbefa0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs @@ -92,18 +92,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newCompanies[0].Name.ToUpperInvariant())); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanies[0].Name.ToUpperInvariant())); string countryOfResidence = newCompanies[0].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.ShouldContainKey("countryOfResidence").With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newCompanies[1].Name.ToUpperInvariant())); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanies[1].Name.ToUpperInvariant())); string countryOfResidence = newCompanies[1].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.ShouldContainKey("countryOfResidence").With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); }); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -244,18 +244,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(existingCompanies[0].Name)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(existingCompanies[0].Name)); string countryOfResidence = existingCompanies[0].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.ShouldContainKey("countryOfResidence").With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(existingCompanies[1].Name)); + resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(existingCompanies[1].Name)); string countryOfResidence = existingCompanies[1].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.ShouldContainKey("countryOfResidence").With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); }); await _testContext.RunOnDatabaseAsync(async dbContext => diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs index 9409013f29..9e09b1014c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs @@ -90,13 +90,13 @@ public async Task Hides_text_in_create_resource_with_side_effects() responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("format").With(value => value.Should().Be(newLyrics[0].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(newLyrics[0].Format)); resource.Attributes.Should().NotContainKey("text"); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("format").With(value => value.Should().Be(newLyrics[1].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(newLyrics[1].Format)); resource.Attributes.Should().NotContainKey("text"); }); @@ -169,13 +169,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("format").With(value => value.Should().Be(existingLyrics[0].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(existingLyrics[0].Format)); resource.Attributes.Should().NotContainKey("text"); }); responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => { - resource.Attributes.ShouldContainKey("format").With(value => value.Should().Be(existingLyrics[1].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(existingLyrics[1].Format)); resource.Attributes.Should().NotContainKey("text"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs index 5e94bc2b56..b1e5794220 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'ownedBy' is not a to-many relationship."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -265,7 +265,7 @@ public async Task Cannot_add_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -304,7 +304,7 @@ public async Task Cannot_add_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -344,7 +344,7 @@ public async Task Cannot_add_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -383,7 +383,7 @@ public async Task Cannot_add_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -482,7 +482,7 @@ public async Task Cannot_add_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -521,7 +521,7 @@ public async Task Cannot_add_for_missing_relationship_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -561,7 +561,7 @@ public async Task Cannot_add_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -609,7 +609,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -658,7 +658,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -709,7 +709,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -756,7 +756,7 @@ public async Task Cannot_add_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -804,7 +804,7 @@ public async Task Cannot_add_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -851,7 +851,7 @@ public async Task Cannot_add_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -900,7 +900,7 @@ public async Task Cannot_add_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1029,7 +1029,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1132,6 +1132,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be added to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs index 3ca22176b0..975d0f99db 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'ownedBy' is not a to-many relationship."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -264,7 +264,7 @@ public async Task Cannot_remove_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -303,7 +303,7 @@ public async Task Cannot_remove_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -343,7 +343,7 @@ public async Task Cannot_remove_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -382,7 +382,7 @@ public async Task Cannot_remove_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -481,7 +481,7 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -521,7 +521,7 @@ public async Task Cannot_remove_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -569,7 +569,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -618,7 +618,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -669,7 +669,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -716,7 +716,7 @@ public async Task Cannot_remove_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -764,7 +764,7 @@ public async Task Cannot_remove_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -811,7 +811,7 @@ public async Task Cannot_remove_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -860,7 +860,7 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -989,7 +989,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1093,6 +1093,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be removed from."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs index b47fe0259b..b8326ce56a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs @@ -299,7 +299,7 @@ public async Task Cannot_replace_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -338,7 +338,7 @@ public async Task Cannot_replace_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -378,7 +378,7 @@ public async Task Cannot_replace_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -417,7 +417,7 @@ public async Task Cannot_replace_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -533,7 +533,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int16'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -574,7 +574,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -614,7 +614,7 @@ public async Task Cannot_replace_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -662,7 +662,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -711,7 +711,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -762,7 +762,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -809,7 +809,7 @@ public async Task Cannot_replace_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -857,7 +857,7 @@ public async Task Cannot_replace_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -904,7 +904,7 @@ public async Task Cannot_replace_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -953,7 +953,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1082,7 +1082,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1138,7 +1138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1191,6 +1191,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs index 7b55f12be4..e1d39724dd 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs @@ -552,7 +552,7 @@ public async Task Cannot_create_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -591,7 +591,7 @@ public async Task Cannot_create_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -631,7 +631,7 @@ public async Task Cannot_create_for_unknown_type_in_ref() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -670,7 +670,7 @@ public async Task Cannot_create_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -778,7 +778,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -819,7 +819,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -859,7 +859,7 @@ public async Task Cannot_create_for_unknown_relationship_in_ref() error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -907,7 +907,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -963,7 +963,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1007,7 +1007,7 @@ public async Task Cannot_create_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1052,7 +1052,7 @@ public async Task Cannot_create_for_unknown_type_in_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1096,7 +1096,7 @@ public async Task Cannot_create_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1142,7 +1142,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1250,7 +1250,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1303,7 +1303,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1356,6 +1356,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs index ba5e0b268d..fc752a80f3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs @@ -337,7 +337,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -391,7 +391,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -447,7 +447,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -499,7 +499,7 @@ public async Task Cannot_replace_for_missing_type_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -552,7 +552,7 @@ public async Task Cannot_replace_for_unknown_type_in_relationship_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -604,7 +604,7 @@ public async Task Cannot_replace_for_missing_ID_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -658,7 +658,7 @@ public async Task Cannot_replace_for_ID_and_local_ID_relationship_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -797,7 +797,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -858,6 +858,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs index f632793947..7b8a1f4f1d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs @@ -208,7 +208,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'musicTracks'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -321,7 +321,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'musicTracks'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -549,7 +549,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("textLanguages"); - resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode)); + resource.Attributes.Should().ContainKey("isoCode").WhoseValue.With(value => value.Should().Be(isoCode)); resource.Attributes.Should().NotContainKey("isRightToLeft"); resource.Relationships.Should().NotBeEmpty(); }); @@ -639,7 +639,7 @@ public async Task Cannot_update_resource_for_href_element() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -745,7 +745,7 @@ public async Task Cannot_update_resource_for_missing_type_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -794,7 +794,7 @@ public async Task Cannot_update_resource_for_missing_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -845,7 +845,7 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_ref() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -879,7 +879,7 @@ public async Task Cannot_update_resource_for_missing_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -914,7 +914,7 @@ public async Task Cannot_update_resource_for_null_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -968,7 +968,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1012,7 +1012,7 @@ public async Task Cannot_update_resource_for_missing_type_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1056,7 +1056,7 @@ public async Task Cannot_update_resource_for_missing_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1102,7 +1102,7 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1152,7 +1152,7 @@ public async Task Cannot_update_on_resource_type_mismatch_between_ref_and_data() error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1205,7 +1205,7 @@ public async Task Cannot_update_on_resource_ID_mismatch_between_ref_and_data() error.Detail.Should().Be($"Expected '{performerId1}' instead of '{performerId2}'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1255,7 +1255,7 @@ public async Task Cannot_update_on_resource_local_ID_mismatch_between_ref_and_da error.Detail.Should().Be("Expected 'local-1' instead of 'local-2'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1307,7 +1307,7 @@ public async Task Cannot_update_on_mixture_of_ID_and_local_ID_between_ref_and_da error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1359,7 +1359,7 @@ public async Task Cannot_update_on_mixture_of_local_ID_and_ID_between_ref_and_da error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1404,7 +1404,7 @@ public async Task Cannot_update_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1500,7 +1500,7 @@ public async Task Cannot_update_resource_for_incompatible_ID() error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int32'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1551,7 +1551,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'isArchived' on resource type 'playlists' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1602,7 +1602,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1653,7 +1653,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Failed to convert attribute 'bornAt' with value '123.45' of type 'Number' to type 'DateTimeOffset'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1813,6 +1813,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The attribute 'createdAt' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs index c265e0094f..4e9c0bc75d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs @@ -613,7 +613,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -666,7 +666,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -727,7 +727,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -776,7 +776,7 @@ public async Task Cannot_create_for_missing_type_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/track/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -826,7 +826,7 @@ public async Task Cannot_create_for_unknown_type_in_relationship_data() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -875,7 +875,7 @@ public async Task Cannot_create_for_missing_ID_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -926,7 +926,7 @@ public async Task Cannot_create_for_ID_and_local_ID_in_relationship_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1044,7 +1044,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1102,6 +1102,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/language"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs index faac9f2b1f..326578213e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs @@ -45,9 +45,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(container.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("fileName").With(value => value.Should().Be(container.FileName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("data").As().With(value => value.Should().Equal(container.Data)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("thumbnail").As().With(value => value.Should().Equal(container.Thumbnail)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(container.FileName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().Equal(container.Data)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().With(value => value.Should().Equal(container.Thumbnail)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -81,9 +81,9 @@ public async Task Can_create_resource() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("fileName").With(value => value.Should().Be(newContainer.FileName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("data").As().With(value => value.Should().Equal(newContainer.Data)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("thumbnail").As().With(value => value.Should().Equal(newContainer.Thumbnail)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(newContainer.FileName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().Equal(newContainer.Data)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().With(value => value.Should().Equal(newContainer.Thumbnail)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); long newContainerId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -138,9 +138,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(existingContainer.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("fileName").With(value => value.Should().Be(existingContainer.FileName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("data").As().With(value => value.Should().Equal(newData)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("thumbnail").As().With(value => value.Should().Equal(newThumbnail)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(existingContainer.FileName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().Equal(newData)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().With(value => value.Should().Equal(newThumbnail)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -189,8 +189,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(existingContainer.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("fileName").With(value => value.Should().Be(existingContainer.FileName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("data").As().With(value => value.Should().BeEmpty()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(existingContainer.FileName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().BeEmpty()); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -238,8 +238,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(existingContainer.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("fileName").With(value => value.Should().Be(existingContainer.FileName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("thumbnail").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(existingContainer.FileName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.With(value => value.Should().BeNull()); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs index 54222aab8e..66130068ab 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs @@ -114,8 +114,7 @@ public async Task Permits_JsonApi_ContentType_header_with_ServerTime_extension() httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.ServerTime.ToString()); - responseDocument.Meta.ShouldContainKey("localServerTime").With(time => - time.ShouldNotBeNull().ToString().Should().Be("2025-01-01T06:53:40.0000000+09:00")); + responseDocument.Meta.Should().ContainKey("localServerTime").WhoseValue.ShouldNotBeNull().ToString().Should().Be("2025-01-01T06:53:40.0000000+09:00"); } [Fact] @@ -150,7 +149,7 @@ public async Task Permits_JsonApi_ContentType_header_with_relaxed_ServerTime_ext httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.RelaxedServerTime.ToString()); - responseDocument.Meta.ShouldContainKey("utcServerTime").With(time => time.ShouldNotBeNull().ToString().Should().Be("2024-12-31T21:53:40.0000000Z")); + responseDocument.Meta.Should().ContainKey("utcServerTime").WhoseValue.ShouldNotBeNull().ToString().Should().Be("2024-12-31T21:53:40.0000000Z"); } [Fact] @@ -192,7 +191,7 @@ public async Task Permits_JsonApi_ContentType_header_with_AtomicOperations_and_S httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.AtomicOperationsWithServerTime.ToString()); - responseDocument.Meta.ShouldContainKey("utcServerTime").With(time => time.ShouldNotBeNull().ToString().Should().Be("2024-12-31T21:53:40.0000000Z")); + responseDocument.Meta.Should().ContainKey("utcServerTime").WhoseValue.ShouldNotBeNull().ToString().Should().Be("2024-12-31T21:53:40.0000000Z"); } [Fact] @@ -239,7 +238,7 @@ public async Task Permits_JsonApi_ContentType_header_with_relaxed_AtomicOperatio httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.RelaxedAtomicOperationsWithRelaxedServerTime.ToString()); - responseDocument.Meta.ShouldContainKey("localServerTime"); + responseDocument.Meta.Should().ContainKey("localServerTime"); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs index c3c88c8bed..88c3be1071 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs @@ -45,11 +45,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("towns"); responseDocument.Data.SingleValue.Id.Should().Be(town.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(town.Name)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("latitude").With(value => value.Should().Be(town.Latitude)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("longitude").With(value => value.Should().Be(town.Longitude)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(town.Name); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("latitude").WhoseValue.Should().Be(town.Latitude); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("longitude").WhoseValue.Should().Be(town.Longitude); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("civilians").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("civilians").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs index e07dbb78f8..d3d984411d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs @@ -53,10 +53,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(building.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("number").With(value => value.Should().Be(building.Number)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("windowCount").With(value => value.Should().Be(4)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("primaryDoorColor").With(value => value.Should().Be(building.PrimaryDoor.Color)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("secondaryDoorColor").With(value => value.Should().Be(building.SecondaryDoor.Color)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("number").WhoseValue.With(value => value.Should().Be(building.Number)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowCount").WhoseValue.With(value => value.Should().Be(4)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("primaryDoorColor").WhoseValue.With(value => value.Should().Be(building.PrimaryDoor.Color)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("secondaryDoorColor").WhoseValue.With(value => value.Should().Be(building.SecondaryDoor.Color)); } [Fact] @@ -89,10 +89,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(street.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(street.Name)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("buildingCount").With(value => value.Should().Be(2)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("doorTotalCount").With(value => value.Should().Be(3)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("windowTotalCount").With(value => value.Should().Be(5)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(street.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("buildingCount").WhoseValue.With(value => value.Should().Be(2)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("doorTotalCount").WhoseValue.With(value => value.Should().Be(3)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(5)); } [Fact] @@ -121,7 +121,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(street.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("windowTotalCount").With(value => value.Should().Be(3)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(3)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -152,19 +152,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(state.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(state.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(state.Name)); responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("cities"); responseDocument.Included[0].Id.Should().Be(state.Cities[0].StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(state.Cities[0].Name)); + responseDocument.Included[0].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(state.Cities[0].Name)); responseDocument.Included[1].Type.Should().Be("streets"); responseDocument.Included[1].Id.Should().Be(state.Cities[0].Streets[0].StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("buildingCount").With(value => value.Should().Be(1)); - responseDocument.Included[1].Attributes.ShouldContainKey("doorTotalCount").With(value => value.Should().Be(1)); - responseDocument.Included[1].Attributes.ShouldContainKey("windowTotalCount").With(value => value.Should().Be(3)); + responseDocument.Included[1].Attributes.Should().ContainKey("buildingCount").WhoseValue.With(value => value.Should().Be(1)); + responseDocument.Included[1].Attributes.Should().ContainKey("doorTotalCount").WhoseValue.With(value => value.Should().Be(1)); + responseDocument.Included[1].Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(3)); } [Fact] @@ -196,15 +196,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(state.Cities[0].StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(state.Cities[0].Name)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(state.Cities[0].Name)); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("streets"); responseDocument.Included[0].Id.Should().Be(state.Cities[0].Streets[0].StringId); responseDocument.Included[0].Attributes.Should().HaveCount(2); - responseDocument.Included[0].Attributes.ShouldContainKey("doorTotalCount").With(value => value.Should().Be(2)); - responseDocument.Included[0].Attributes.ShouldContainKey("windowTotalCount").With(value => value.Should().Be(1)); + responseDocument.Included[0].Attributes.Should().ContainKey("doorTotalCount").WhoseValue.With(value => value.Should().Be(2)); + responseDocument.Included[0].Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(1)); responseDocument.Included[0].Relationships.Should().BeNull(); } @@ -235,10 +235,10 @@ public async Task Can_create_resource() httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("number").With(value => value.Should().Be(newBuilding.Number)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("windowCount").With(value => value.Should().Be(0)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("primaryDoorColor").With(value => value.Should().Be("(unspecified)")); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("secondaryDoorColor").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("number").WhoseValue.With(value => value.Should().Be(newBuilding.Number)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowCount").WhoseValue.With(value => value.Should().Be(0)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("primaryDoorColor").WhoseValue.With(value => value.Should().Be("(unspecified)")); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("secondaryDoorColor").WhoseValue.With(value => value.Should().BeNull()); int newBuildingId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs index a6a7c1fba8..8a635c734f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ExceptionHandlerTests.cs @@ -71,7 +71,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("The requested article is no longer available."); error.Detail.Should().Be("Article with code 'X123' is no longer available."); - error.Meta.ShouldContainKey("support").With(value => + error.Meta.Should().ContainKey("support").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be("Please contact us for info about similar articles at company@email.com."); @@ -110,13 +110,13 @@ public async Task Logs_and_produces_error_response_on_deserialization_failure() error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be("Resource type '' does not exist."); - error.Meta.ShouldContainKey("requestBody").With(value => + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetString().Should().Be(requestBody); }); - error.Meta.ShouldContainKey("stackTrace").With(value => + error.Meta.Should().ContainKey("stackTrace").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; IEnumerable stackTraceLines = element.EnumerateArray().Select(token => token.GetString()); @@ -158,7 +158,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("An unhandled error occurred while processing this request."); error.Detail.Should().Be("Exception has been thrown by the target of an invocation."); - error.Meta.ShouldContainKey("stackTrace").With(value => + error.Meta.Should().ContainKey("stackTrace").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; IEnumerable stackTraceLines = element.EnumerateArray().Select(token => token.GetString()); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs index 816f349354..563dd1aad6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs @@ -60,7 +60,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(galleryLink); - resource.Relationships.ShouldContainKey("paintings").With(value => + resource.Relationships.Should().ContainKey("paintings").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -78,7 +78,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(paintingLink); - resource.Relationships.ShouldContainKey("exposedAt").With(value => + resource.Relationships.Should().ContainKey("exposedAt").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -127,7 +127,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(paintingLink); - resource.Relationships.ShouldContainKey("exposedAt").With(value => + resource.Relationships.Should().ContainKey("exposedAt").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -145,7 +145,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(galleryLink); - resource.Relationships.ShouldContainKey("paintings").With(value => + resource.Relationships.Should().ContainKey("paintings").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs index c557f566a3..5859cb029c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs @@ -266,8 +266,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("ownerName").With(value => value.Should().Be(newCard.OwnerName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("pinCode").With(value => value.Should().Be(newCard.PinCode)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("ownerName").WhoseValue.With(value => value.Should().Be(newCard.OwnerName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("pinCode").WhoseValue.With(value => value.Should().Be(newCard.PinCode)); var codec = new HexadecimalCodec(); int newCardId = codec.Decode(responseDocument.Data.SingleValue.Id); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs index 49c659c79d..66dc592322 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs @@ -198,8 +198,8 @@ public async Task Can_create_resource_with_valid_attribute_value() httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("directoryName").With(value => value.Should().Be(newDirectory.Name)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isCaseSensitive").With(value => value.Should().Be(newDirectory.IsCaseSensitive)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.With(value => value.Should().Be(newDirectory.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isCaseSensitive").WhoseValue.With(value => value.Should().Be(newDirectory.IsCaseSensitive)); } [Fact] @@ -360,8 +360,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("directoryName").With(value => value.Should().Be(newDirectory.Name)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isCaseSensitive").With(value => value.Should().Be(newDirectory.IsCaseSensitive)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.With(value => value.Should().Be(newDirectory.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isCaseSensitive").WhoseValue.With(value => value.Should().Be(newDirectory.IsCaseSensitive)); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs index 3658ab8ad5..e007759a9d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs @@ -47,7 +47,7 @@ public async Task Can_create_resource_with_invalid_attribute_value() httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("directoryName").With(value => value.Should().Be("!@#$%^&*().-")); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.With(value => value.Should().Be("!@#$%^&*().-")); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs index 503937e430..9f07879b2e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs @@ -64,7 +64,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -113,7 +113,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -177,7 +177,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -369,7 +369,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -386,7 +386,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -454,7 +454,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("album").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -471,7 +471,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs index 72d45b9cab..f732c018a8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs @@ -64,7 +64,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -113,7 +113,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -177,7 +177,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -369,7 +369,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -386,7 +386,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -454,7 +454,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("album").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -471,7 +471,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs index a7b69ba196..d927722b5a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs @@ -42,7 +42,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photo").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photo").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs index 7dc8c5687e..736902fcf4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs @@ -47,7 +47,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photo").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photo").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -55,7 +55,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Links.Related.ShouldNotBeNull(); }); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("album").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.Should().BeNull(); @@ -68,7 +68,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.ShouldNotBeNull(); - resource.Relationships.ShouldContainKey("location").With(value => + resource.Relationships.Should().ContainKey("location").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -82,7 +82,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.ShouldNotBeNull(); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -118,7 +118,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photo").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photo").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs index 0aab640ccf..04040d235b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs @@ -64,7 +64,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -113,7 +113,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -177,7 +177,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -369,7 +369,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -386,7 +386,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -454,7 +454,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("album").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -471,7 +471,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs index afc98e58b2..9a1178de0a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs @@ -64,7 +64,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -113,7 +113,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -177,7 +177,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -369,7 +369,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("photos").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -386,7 +386,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(photoLink); - resource.Relationships.ShouldContainKey("album").With(value => + resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -454,7 +454,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("album").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -471,7 +471,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(albumLink); - resource.Relationships.ShouldContainKey("photos").With(value => + resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs index 95e53fc2f7..d2cff1888b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs @@ -57,9 +57,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(3); - responseDocument.Data.ManyValue[0].Meta.ShouldContainKey("hasHighPriority"); + responseDocument.Data.ManyValue[0].Meta.Should().ContainKey("hasHighPriority"); responseDocument.Data.ManyValue[1].Meta.Should().BeNull(); - responseDocument.Data.ManyValue[2].Meta.ShouldContainKey("hasHighPriority"); + responseDocument.Data.ManyValue[2].Meta.Should().ContainKey("hasHighPriority"); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -96,7 +96,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Included.Should().HaveCount(1); - responseDocument.Included[0].Meta.ShouldContainKey("hasHighPriority"); + responseDocument.Included[0].Meta.Should().ContainKey("hasHighPriority"); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs index 218da5b454..f3f4797bae 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs @@ -40,7 +40,7 @@ public async Task Create_group_sends_messages() httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -118,7 +118,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs index f24f660d7e..0c52832658 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs @@ -42,8 +42,8 @@ public async Task Create_user_sends_messages() httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("loginName").With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(newDisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(newDisplayName)); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -111,8 +111,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("loginName").With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().BeNull()); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs index 631aaf075c..88ab57fa2a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs @@ -45,7 +45,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -127,7 +127,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs index 9312aee66e..1c1eaf9358 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs @@ -47,8 +47,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("loginName").With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(newDisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(newDisplayName)); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -120,8 +120,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("loginName").With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().BeNull()); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs index f70f276e2f..4fa2e50eb9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs @@ -307,7 +307,7 @@ public async Task Can_create_resource() httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("url").With(value => value.Should().Be(newShopUrl)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("url").WhoseValue.Should().Be(newShopUrl); responseDocument.Data.SingleValue.Relationships.ShouldNotBeNull(); int newShopId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -1025,7 +1025,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(shopLink); - resource.Relationships.ShouldContainKey("products").With(value => + resource.Relationships.Should().ContainKey("products").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -1043,7 +1043,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.ShouldNotBeNull(); resource.Links.Self.Should().Be(productLink); - resource.Relationships.ShouldContainKey("shop").With(value => + resource.Relationships.Should().ContainKey("shop").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs index 0935400343..3e69a7197a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs @@ -43,16 +43,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "swimming-pools"); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.ShouldContainKey("is-indoor") != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldContainKey("water-slides") != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldContainKey("diving-boards") != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.Should().ContainKey("is-indoor").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("water-slides").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("diving-boards").WhoseValue != null); decimal height = pools[1].DivingBoards[0].HeightInMeters; responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("diving-boards"); responseDocument.Included[0].Id.Should().Be(pools[1].DivingBoards[0].StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("height-in-meters").With(value => value.As().Should().BeApproximately(height)); + responseDocument.Included[0].Attributes.Should().ContainKey("height-in-meters").WhoseValue.As().Should().BeApproximately(height); responseDocument.Included[0].Relationships.Should().BeNull(); responseDocument.Included[0].Links.ShouldNotBeNull().Self.Should().Be($"/public-api/diving-boards/{pools[1].DivingBoards[0].StringId}"); @@ -117,12 +117,12 @@ public async Task Can_create_resource() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("swimming-pools"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("is-indoor").With(value => value.Should().Be(newPool.IsIndoor)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("is-indoor").WhoseValue.Should().Be(newPool.IsIndoor); int newPoolId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); string poolLink = $"{route}/{newPoolId}"; - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("water-slides").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("water-slides").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -130,7 +130,7 @@ public async Task Can_create_resource() value.Links.Related.Should().Be($"{poolLink}/water-slides"); }); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("diving-boards").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("diving-boards").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -165,7 +165,7 @@ public async Task Applies_casing_convention_on_error_stack_trace() ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body."); - error.Meta.ShouldContainKey("stack-trace"); + error.Meta.Should().ContainKey("stack-trace"); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs index 22d6712926..3498e72eaa 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs @@ -44,20 +44,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "SwimmingPools"); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.ShouldContainKey("IsIndoor") != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldContainKey("WaterSlides") != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldContainKey("DivingBoards") != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.Should().ContainKey("IsIndoor").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("WaterSlides").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("DivingBoards").WhoseValue != null); decimal height = pools[1].DivingBoards[0].HeightInMeters; responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("DivingBoards"); responseDocument.Included[0].Id.Should().Be(pools[1].DivingBoards[0].StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("HeightInMeters").With(value => value.As().Should().BeApproximately(height)); + responseDocument.Included[0].Attributes.Should().ContainKey("HeightInMeters").WhoseValue.As().Should().BeApproximately(height); responseDocument.Included[0].Relationships.Should().BeNull(); responseDocument.Included[0].Links.ShouldNotBeNull().Self.Should().Be($"/PublicApi/DivingBoards/{pools[1].DivingBoards[0].StringId}"); - responseDocument.Meta.ShouldContainKey("Total").With(value => + responseDocument.Meta.Should().ContainKey("Total").WhoseValue.With(value => { JsonElement element = value.Should().BeOfType().Subject; element.GetInt32().Should().Be(2); @@ -121,12 +121,12 @@ public async Task Can_create_resource() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("SwimmingPools"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("IsIndoor").With(value => value.Should().Be(newPool.IsIndoor)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("IsIndoor").WhoseValue.Should().Be(newPool.IsIndoor); int newPoolId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); string poolLink = $"{route}/{newPoolId}"; - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("WaterSlides").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("WaterSlides").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -134,7 +134,7 @@ public async Task Can_create_resource() value.Links.Related.Should().Be($"{poolLink}/WaterSlides"); }); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("DivingBoards").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("DivingBoards").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -169,7 +169,7 @@ public async Task Applies_casing_convention_on_error_stack_trace() ErrorObject error = responseDocument.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body."); - error.Meta.ShouldContainKey("StackTrace"); + error.Meta.Should().ContainKey("StackTrace"); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs index 4cc6a7b880..3ff1b7b074 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs @@ -72,7 +72,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey(attributeName).With(value => value.Should().Be(value)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.With(value => value.Should().Be(value)); } [Fact] @@ -100,7 +100,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDecimal").With(value => value.Should().Be(resource.SomeDecimal)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDecimal").WhoseValue.With(value => value.Should().Be(resource.SomeDecimal)); } [Fact] @@ -128,7 +128,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someGuid").With(value => value.Should().Be(resource.SomeGuid)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someGuid").WhoseValue.With(value => value.Should().Be(resource.SomeGuid)); } [Fact] @@ -157,7 +157,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInLocalZone") + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInLocalZone").WhoseValue .With(value => value.Should().Be(resource.SomeDateTimeInLocalZone)); } @@ -187,7 +187,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInUtcZone") + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInUtcZone").WhoseValue .With(value => value.Should().Be(resource.SomeDateTimeInUtcZone)); } @@ -216,7 +216,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeOffset").With(value => value.Should().Be(resource.SomeDateTimeOffset)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeOffset").WhoseValue.With(value => value.Should().Be(resource.SomeDateTimeOffset)); } [Fact] @@ -244,7 +244,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeSpan").With(value => value.Should().Be(resource.SomeTimeSpan)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeSpan").WhoseValue.With(value => value.Should().Be(resource.SomeTimeSpan)); } [Fact] @@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateOnly").With(value => value.Should().Be(resource.SomeDateOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateOnly").WhoseValue.With(value => value.Should().Be(resource.SomeDateOnly)); } [Fact] @@ -300,7 +300,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeOnly").With(value => value.Should().Be(resource.SomeTimeOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeOnly").WhoseValue.With(value => value.Should().Be(resource.SomeTimeOnly)); } [Fact] @@ -393,7 +393,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey(attributeName).With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.With(value => value.Should().BeNull()); } [Theory] @@ -447,6 +447,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey(attributeName).With(value => value.Should().NotBeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.With(value => value.Should().NotBeNull()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs index 99a34f087a..82e0558411 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs @@ -84,7 +84,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someString").With(value => value.Should().Be(resource.SomeString)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.With(value => value.Should().Be(resource.SomeString)); responseDocument.Links.ShouldNotBeNull(); responseDocument.Links.Self.Should().Be("http://localhost/filterableResources?filter=equals(someString,'This%2c+that+%26+more+%2b+some')"); @@ -123,8 +123,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("otherInt32").With(value => value.Should().Be(resource.OtherInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("otherInt32").WhoseValue.With(value => value.Should().Be(resource.OtherInt32)); } [Fact] @@ -159,8 +159,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someNullableInt32").With(value => value.Should().Be(resource.SomeNullableInt32)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("otherNullableInt32").With(value => value.Should().Be(resource.OtherNullableInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.With(value => value.Should().Be(resource.SomeNullableInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("otherNullableInt32").WhoseValue.With(value => value.Should().Be(resource.OtherNullableInt32)); } [Fact] @@ -195,8 +195,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someNullableInt32").With(value => value.Should().Be(resource.SomeNullableInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.With(value => value.Should().Be(resource.SomeNullableInt32)); } [Fact] @@ -231,8 +231,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someNullableInt32").With(value => value.Should().Be(resource.SomeNullableInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.With(value => value.Should().Be(resource.SomeNullableInt32)); } [Fact] @@ -267,8 +267,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someUnsignedInt64").With(value => value.Should().Be(resource.SomeUnsignedInt64)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someUnsignedInt64").WhoseValue.With(value => value.Should().Be(resource.SomeUnsignedInt64)); } [Fact] @@ -331,7 +331,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someInt32").With(value => value.Should().Be(resource.SomeInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); } [Theory] @@ -373,7 +373,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDouble").With(value => value.Should().Be(resource.SomeDouble)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDouble").WhoseValue.With(value => value.Should().Be(resource.SomeDouble)); } [Theory] @@ -424,7 +424,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInLocalZone") + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInLocalZone").WhoseValue .With(value => value.Should().Be(resource.SomeDateTimeInLocalZone)); } @@ -476,7 +476,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeInUtcZone") + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInUtcZone").WhoseValue .With(value => value.Should().Be(resource.SomeDateTimeInUtcZone)); } @@ -528,7 +528,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateTimeOffset").With(value => value.Should().Be(resource.SomeDateTimeOffset)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeOffset").WhoseValue.With(value => value.Should().Be(resource.SomeDateTimeOffset)); } [Theory] @@ -569,7 +569,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeSpan").With(value => value.Should().Be(resource.SomeTimeSpan)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeSpan").WhoseValue.With(value => value.Should().Be(resource.SomeTimeSpan)); } [Theory] @@ -618,7 +618,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someDateOnly").With(value => value.Should().Be(resource.SomeDateOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateOnly").WhoseValue.With(value => value.Should().Be(resource.SomeDateOnly)); } [Theory] @@ -659,7 +659,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someTimeOnly").With(value => value.Should().Be(resource.SomeTimeOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeOnly").WhoseValue.With(value => value.Should().Be(resource.SomeTimeOnly)); } [Theory] @@ -697,7 +697,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someString").With(value => value.Should().Be(resource.SomeString)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.With(value => value.Should().Be(resource.SomeString)); } [Fact] @@ -779,7 +779,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("someString").With(value => value.Should().Be(resource.SomeString)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.With(value => value.Should().Be(resource.SomeString)); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs index bacd2f353d..91b56df83c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs @@ -139,6 +139,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(accounts[0].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(accounts[0].UserName)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("userName").WhoseValue.With(value => value.Should().Be(accounts[0].UserName)); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs index c3eb0fadc1..4ec5b8115b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs @@ -51,12 +51,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(post.Author.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(post.Author.DisplayName)); + responseDocument.Included[0].Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(post.Author.DisplayName); } [Fact] @@ -82,12 +82,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(post.Author.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(post.Author.DisplayName)); + responseDocument.Included[0].Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(post.Author.DisplayName); } [Fact] @@ -114,12 +114,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Owner.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(blog.Owner.DisplayName); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Owner.Posts[0].StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Owner.Posts[0].Caption)); + responseDocument.Included[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(blog.Owner.Posts[0].Caption); } [Fact] @@ -146,12 +146,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Posts[0].Caption)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(blog.Posts[0].Caption); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].Author!.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Posts[0].Author!.DisplayName)); + responseDocument.Included[0].Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(blog.Posts[0].Author!.DisplayName); } [Fact] @@ -178,17 +178,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Text)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Text); responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(comment.Author.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(comment.Author.UserName)); + responseDocument.Included[0].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(comment.Author.UserName); responseDocument.Included[1].Type.Should().Be("blogPosts"); responseDocument.Included[1].Id.Should().Be(comment.Parent.StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(comment.Parent.Caption)); + responseDocument.Included[1].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(comment.Parent.Caption); } [Fact] @@ -214,14 +214,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); DateTime createdAt = post.Comments.Single().CreatedAt; responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("comments"); responseDocument.Included[0].Id.Should().Be(post.Comments.Single().StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(createdAt)); + responseDocument.Included[0].Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(createdAt); } [Fact] @@ -247,12 +247,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("labels"); responseDocument.Included[0].Id.Should().Be(post.Labels.Single().StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(post.Labels.Single().Name)); + responseDocument.Included[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(post.Labels.Single().Name); } [Fact] @@ -279,12 +279,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Type.Should().Be("labels"); responseDocument.Data.ManyValue[0].Id.Should().Be(post.Labels.ElementAt(0).StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(post.Labels.Single().Name)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(post.Labels.Single().Name); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(post.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Included[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); } [Fact] @@ -312,23 +312,23 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Text)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Text); responseDocument.Included.Should().HaveCount(3); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(comment.Parent.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(comment.Parent.Caption)); + responseDocument.Included[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(comment.Parent.Caption); responseDocument.Included[1].Type.Should().Be("webAccounts"); responseDocument.Included[1].Id.Should().Be(comment.Parent.Author.StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(comment.Parent.Author.DisplayName)); + responseDocument.Included[1].Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(comment.Parent.Author.DisplayName); bool useDarkTheme = comment.Parent.Author.Preferences.UseDarkTheme; responseDocument.Included[2].Type.Should().Be("accountPreferences"); responseDocument.Included[2].Id.Should().Be(comment.Parent.Author.Preferences.StringId); - responseDocument.Included[2].Attributes.ShouldContainKey("useDarkTheme").With(value => value.Should().Be(useDarkTheme)); + responseDocument.Included[2].Attributes.Should().ContainKey("useDarkTheme").WhoseValue.Should().Be(useDarkTheme); } [Fact] @@ -355,19 +355,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(blog.Title)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(blog.Title); responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Posts[0].Caption)); + responseDocument.Included[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(blog.Posts[0].Caption); DateTime createdAt = blog.Posts[0].Comments.Single().CreatedAt; responseDocument.Included[1].Type.Should().Be("comments"); responseDocument.Included[1].Id.Should().Be(blog.Posts[0].Comments.Single().StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(createdAt)); + responseDocument.Included[1].Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(createdAt); } [Fact] @@ -396,27 +396,27 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Text)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Text); responseDocument.Included.Should().HaveCount(4); responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(comment.Parent.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(comment.Parent.Caption)); + responseDocument.Included[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(comment.Parent.Caption); responseDocument.Included[1].Type.Should().Be("comments"); responseDocument.Included[1].Id.Should().Be(comment.Parent.Comments.ElementAt(0).StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Parent.Comments.ElementAt(0).Text)); + responseDocument.Included[1].Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Parent.Comments.ElementAt(0).Text); string userName = comment.Parent.Comments.ElementAt(0).Author!.UserName; responseDocument.Included[2].Type.Should().Be("webAccounts"); responseDocument.Included[2].Id.Should().Be(comment.Parent.Comments.ElementAt(0).Author!.StringId); - responseDocument.Included[2].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(userName)); + responseDocument.Included[2].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(userName); responseDocument.Included[3].Type.Should().Be("comments"); responseDocument.Included[3].Id.Should().Be(comment.Parent.Comments.ElementAt(1).StringId); - responseDocument.Included[3].Attributes.ShouldContainKey("text").With(value => value.Should().Be(comment.Parent.Comments.ElementAt(1).Text)); + responseDocument.Included[3].Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Parent.Comments.ElementAt(1).Text); } [Fact] @@ -448,7 +448,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); @@ -461,7 +461,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].StringId); - responseDocument.Included[0].Relationships.ShouldContainKey("author").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -469,7 +469,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(blog.Posts[0].Author!.StringId); }); - responseDocument.Included[0].Relationships.ShouldContainKey("comments").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("comments").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); @@ -480,7 +480,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Type.Should().Be("webAccounts"); responseDocument.Included[1].Id.Should().Be(blog.Posts[0].Author!.StringId); - responseDocument.Included[1].Relationships.ShouldContainKey("preferences").With(value => + responseDocument.Included[1].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -488,7 +488,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(blog.Posts[0].Author!.Preferences!.StringId); }); - responseDocument.Included[1].Relationships.ShouldContainKey("posts").With(value => + responseDocument.Included[1].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -500,7 +500,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[3].Type.Should().Be("comments"); responseDocument.Included[3].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).StringId); - responseDocument.Included[3].Relationships.ShouldContainKey("author").With(value => + responseDocument.Included[3].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -511,7 +511,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[4].Type.Should().Be("webAccounts"); responseDocument.Included[4].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).Author!.StringId); - responseDocument.Included[4].Relationships.ShouldContainKey("posts").With(value => + responseDocument.Included[4].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); @@ -519,7 +519,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).Author!.Posts[0].StringId); }); - responseDocument.Included[4].Relationships.ShouldContainKey("preferences").With(value => + responseDocument.Included[4].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -528,13 +528,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[5].Type.Should().Be("blogPosts"); responseDocument.Included[5].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).Author!.Posts[0].StringId); - responseDocument.Included[5].Relationships.ShouldContainKey("author").With(value => + responseDocument.Included[5].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); }); - responseDocument.Included[5].Relationships.ShouldContainKey("comments").With(value => + responseDocument.Included[5].Relationships.Should().ContainKey("comments").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -543,7 +543,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[6].Type.Should().Be("comments"); responseDocument.Included[6].Id.Should().Be(blog.Posts[0].Comments.ElementAt(1).StringId); - responseDocument.Included[5].Relationships.ShouldContainKey("author").With(value => + responseDocument.Included[5].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -593,7 +593,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[0].Id.Should().Be(post1.StringId); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("author").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -601,7 +601,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(author.StringId); }); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("reviewer").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("reviewer").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -612,7 +612,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Type.Should().Be("blogPosts"); responseDocument.Data.ManyValue[1].Id.Should().Be(post2.StringId); - responseDocument.Data.ManyValue[1].Relationships.ShouldContainKey("author").With(value => + responseDocument.Data.ManyValue[1].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -620,7 +620,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(person.StringId); }); - responseDocument.Data.ManyValue[1].Relationships.ShouldContainKey("reviewer").With(value => + responseDocument.Data.ManyValue[1].Relationships.Should().ContainKey("reviewer").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -633,7 +633,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(author.StringId); - responseDocument.Included[0].Relationships.ShouldContainKey("preferences").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -641,7 +641,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(author.Preferences.StringId); }); - responseDocument.Included[0].Relationships.ShouldContainKey("loginAttempts").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("loginAttempts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -653,13 +653,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[2].Type.Should().Be("webAccounts"); responseDocument.Included[2].Id.Should().Be(reviewer.StringId); - responseDocument.Included[2].Relationships.ShouldContainKey("preferences").With(value => + responseDocument.Included[2].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); }); - responseDocument.Included[2].Relationships.ShouldContainKey("loginAttempts").With(value => + responseDocument.Included[2].Relationships.Should().ContainKey("loginAttempts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); @@ -673,7 +673,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[4].Type.Should().Be("webAccounts"); responseDocument.Included[4].Id.Should().Be(person.StringId); - responseDocument.Included[4].Relationships.ShouldContainKey("preferences").With(value => + responseDocument.Included[4].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -681,7 +681,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => value.Data.SingleValue.Id.Should().Be(person.Preferences.StringId); }); - responseDocument.Included[4].Relationships.ShouldContainKey("loginAttempts").With(value => + responseDocument.Included[4].Relationships.Should().ContainKey("loginAttempts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); @@ -724,7 +724,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); @@ -737,7 +737,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("blogPosts"); responseDocument.Included[0].Id.Should().Be(blog.Posts[0].StringId); - responseDocument.Included[0].Relationships.ShouldContainKey("author").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -748,7 +748,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Type.Should().Be("webAccounts"); responseDocument.Included[1].Id.Should().Be(blog.Posts[0].Author!.StringId); - responseDocument.Included[1].Relationships.ShouldContainKey("posts").With(value => + responseDocument.Included[1].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); @@ -783,12 +783,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(account.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(account.UserName)); + responseDocument.Included[0].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(account.UserName); } [Fact] @@ -821,7 +821,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(account.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(account.UserName)); + responseDocument.Included[0].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(account.UserName); } [Fact] @@ -1005,7 +1005,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("calendars"); responseDocument.Data.SingleValue.Id.Should().Be(calendar.StringId); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("mostRecentAppointment").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("mostRecentAppointment").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -1044,24 +1044,24 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.ShouldContainKey("reviewer") != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.Should().ContainKey("reviewer").WhoseValue != null); ResourceObject[] postWithReviewer = responseDocument.Data.ManyValue .Where(resource => resource.Relationships!.First(pair => pair.Key == "reviewer").Value!.Data.SingleValue != null).ToArray(); postWithReviewer.Should().HaveCount(1); - postWithReviewer[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(posts[0].Caption)); + postWithReviewer[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(posts[0].Caption); ResourceObject[] postWithoutReviewer = responseDocument.Data.ManyValue .Where(resource => resource.Relationships!.First(pair => pair.Key == "reviewer").Value!.Data.SingleValue == null).ToArray(); postWithoutReviewer.Should().HaveCount(1); - postWithoutReviewer[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(posts[1].Caption)); + postWithoutReviewer[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(posts[1].Caption); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(posts[0].Reviewer!.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(posts[0].Reviewer!.UserName)); + responseDocument.Included[0].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(posts[0].Reviewer!.UserName); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs index 2ad12e79cf..f5787f6363 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs @@ -58,8 +58,8 @@ await RunOnDatabaseAsync(async dbContext => if (expectNullValueInDocument) { - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("timeZone"); - responseDocument.Included[0].Attributes.ShouldContainKey("description"); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("timeZone"); + responseDocument.Included[0].Attributes.Should().ContainKey("description"); } else { @@ -69,8 +69,8 @@ await RunOnDatabaseAsync(async dbContext => if (expectDefaultValueInDocument) { - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("defaultAppointmentDurationInMinutes"); - responseDocument.Included[0].Attributes.ShouldContainKey("startTime"); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("defaultAppointmentDurationInMinutes"); + responseDocument.Included[0].Attributes.Should().ContainKey("startTime"); } else { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs index 6627bae4f2..71a5d712a3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs @@ -59,10 +59,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("author").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -103,7 +103,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; @@ -140,7 +140,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Attributes.Should().BeNull(); responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("author").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -181,10 +181,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Posts[0].Caption)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(blog.Posts[0].Caption); responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("labels").With(value => + responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("labels").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -228,10 +228,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("url").With(value => value.Should().Be(post.Url)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("url").WhoseValue.Should().Be(post.Url); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("author").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -271,9 +271,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("author").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -286,11 +286,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.Should().HaveCount(2); - responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(post.Author.DisplayName)); - responseDocument.Included[0].Attributes.ShouldContainKey("emailAddress").With(value => value.Should().Be(post.Author.EmailAddress)); + responseDocument.Included[0].Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(post.Author.DisplayName); + responseDocument.Included[0].Attributes.Should().ContainKey("emailAddress").WhoseValue.Should().Be(post.Author.EmailAddress); responseDocument.Included[0].Relationships.Should().HaveCount(1); - responseDocument.Included[0].Relationships.ShouldContainKey("preferences").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -335,9 +335,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(account.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(account.DisplayName); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(1); @@ -349,10 +349,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(account.Posts[0].Caption)); + responseDocument.Included[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(account.Posts[0].Caption); responseDocument.Included[0].Relationships.Should().HaveCount(1); - responseDocument.Included[0].Relationships.ShouldContainKey("labels").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("labels").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -397,9 +397,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Owner.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(blog.Owner.DisplayName); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("posts").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(1); @@ -411,10 +411,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Owner.Posts[0].Caption)); + responseDocument.Included[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(blog.Owner.Posts[0].Caption); responseDocument.Included[0].Relationships.Should().HaveCount(1); - responseDocument.Included[0].Relationships.ShouldContainKey("comments").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("comments").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -459,9 +459,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("labels").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("labels").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(1); @@ -473,7 +473,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("color").With(value => value.Should().Be(post.Labels.Single().Color)); + responseDocument.Included[0].Attributes.Should().ContainKey("color").WhoseValue.Should().Be(post.Labels.Single().Color); responseDocument.Included[0].Relationships.Should().BeNull(); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; @@ -514,7 +514,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(blog.Title)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(blog.Title); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); responseDocument.Included.Should().HaveCount(2); @@ -522,14 +522,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blog.Owner.StringId); responseDocument.Included[0].Attributes.Should().HaveCount(2); - responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(blog.Owner.UserName)); - responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Owner.DisplayName)); + responseDocument.Included[0].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(blog.Owner.UserName); + responseDocument.Included[0].Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(blog.Owner.DisplayName); responseDocument.Included[0].Relationships.Should().BeNull(); responseDocument.Included[1].Type.Should().Be("blogPosts"); responseDocument.Included[1].Id.Should().Be(blog.Owner.Posts[0].StringId); responseDocument.Included[1].Attributes.Should().HaveCount(1); - responseDocument.Included[1].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Owner.Posts[0].Caption)); + responseDocument.Included[1].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(blog.Owner.Posts[0].Caption); responseDocument.Included[1].Relationships.Should().BeNull(); var blogCaptured = (Blog)store.Resources.Should().ContainSingle(resource => resource is Blog).Which; @@ -575,10 +575,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(blog.Title)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(blog.Title); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("owner").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("owner").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -592,11 +592,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("webAccounts"); responseDocument.Included[0].Id.Should().Be(blog.Owner.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("userName").With(value => value.Should().Be(blog.Owner.UserName)); - responseDocument.Included[0].Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(blog.Owner.DisplayName)); - responseDocument.Included[0].Attributes.ShouldContainKey("dateOfBirth").With(value => value.Should().Be(blog.Owner.DateOfBirth)); + responseDocument.Included[0].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(blog.Owner.UserName); + responseDocument.Included[0].Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(blog.Owner.DisplayName); + responseDocument.Included[0].Attributes.Should().ContainKey("dateOfBirth").WhoseValue.Should().Be(blog.Owner.DateOfBirth); - responseDocument.Included[0].Relationships.ShouldContainKey("posts").With(value => + responseDocument.Included[0].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(1); @@ -608,10 +608,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Type.Should().Be("blogPosts"); responseDocument.Included[1].Id.Should().Be(blog.Owner.Posts[0].StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(blog.Owner.Posts[0].Caption)); - responseDocument.Included[1].Attributes.ShouldContainKey("url").With(value => value.Should().Be(blog.Owner.Posts[0].Url)); + responseDocument.Included[1].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(blog.Owner.Posts[0].Caption); + responseDocument.Included[1].Attributes.Should().ContainKey("url").WhoseValue.Should().Be(blog.Owner.Posts[0].Url); - responseDocument.Included[1].Relationships.ShouldContainKey("labels").With(value => + responseDocument.Included[1].Relationships.Should().ContainKey("labels").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); @@ -653,7 +653,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; @@ -821,7 +821,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("showAdvertisements").With(value => value.Should().Be(blog.ShowAdvertisements)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("showAdvertisements").WhoseValue.Should().Be(blog.ShowAdvertisements); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); var blogCaptured = (Blog)store.Resources.Should().ContainSingle(resource => resource is Blog).Which; @@ -856,11 +856,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("caption").With(value => value.Should().Be(post.Caption)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("url").With(value => value.Should().Be(post.Url)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("url").WhoseValue.Should().Be(post.Url); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("author").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("author").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.Value.Should().BeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs index 1d0014ea19..63af6ee8cf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs @@ -98,8 +98,8 @@ public async Task Can_create_resource_with_int_ID() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newWorkItem.Description)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(newWorkItem.DueAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newWorkItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(newWorkItem.DueAt)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -146,8 +146,8 @@ public async Task Can_create_resource_with_long_ID() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("userAccounts"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(newUserAccount.FirstName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(newUserAccount.LastName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(newUserAccount.FirstName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(newUserAccount.LastName)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); long newUserAccountId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -193,7 +193,7 @@ public async Task Can_create_resource_with_guid_ID() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newGroup.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroup.Name)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -238,8 +238,8 @@ public async Task Can_create_resource_without_attributes_or_relationships() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().BeNull()); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -288,7 +288,7 @@ public async Task Cannot_create_resource_with_unknown_attribute() error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -323,7 +323,7 @@ public async Task Can_create_resource_with_unknown_attribute() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newWorkItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newWorkItem.Description)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -375,7 +375,7 @@ public async Task Cannot_create_resource_with_unknown_relationship() error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -460,7 +460,7 @@ public async Task Cannot_create_resource_with_client_generated_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -511,7 +511,7 @@ public async Task Cannot_create_resource_for_null_request_body() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -541,7 +541,7 @@ public async Task Cannot_create_resource_for_missing_data() error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -569,7 +569,7 @@ public async Task Cannot_create_resource_for_null_data() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -603,7 +603,7 @@ public async Task Cannot_create_resource_for_array_data() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -636,7 +636,7 @@ public async Task Cannot_create_resource_for_missing_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -670,7 +670,7 @@ public async Task Cannot_create_resource_for_unknown_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -728,7 +728,7 @@ public async Task Cannot_create_on_resource_type_mismatch_between_url_and_body() error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -763,7 +763,7 @@ public async Task Cannot_create_resource_with_readonly_attribute() error.Detail.Should().Be("Attribute 'isDeprecated' on resource type 'workItemGroups' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isDeprecated"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -787,7 +787,7 @@ public async Task Cannot_create_resource_for_broken_JSON_request_body() error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().StartWith("'{' is invalid after a property name."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -822,7 +822,7 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() error.Detail.Should().Be("Failed to convert attribute 'dueAt' with value 'not-a-valid-time' of type 'String' to type 'Nullable'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/dueAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -895,7 +895,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newDescription)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newDescription)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -959,6 +959,6 @@ public async Task Cannot_assign_attribute_with_blocked_capability() error.Detail.Should().Be("The attribute 'isImportant' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isImportant"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs index 7df22f2ffe..d7d7353193 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs @@ -68,7 +68,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(newGroup.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(groupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(groupName)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -122,7 +122,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(newGroup.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(groupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(groupName)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -280,7 +280,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("rgbColors"); responseDocument.Data.SingleValue.Id.Should().Be(defaultId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(defaultName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(defaultName)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -338,7 +338,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -381,7 +381,7 @@ public async Task Cannot_create_resource_with_client_generated_zero_guid_ID(Clie error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -424,7 +424,7 @@ public async Task Cannot_create_resource_with_client_generated_empty_guid_ID(Cli error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -519,7 +519,7 @@ public async Task Cannot_create_resource_with_client_generated_zero_long_ID(Clie error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] @@ -563,7 +563,7 @@ public async Task Cannot_create_resource_with_client_generated_empty_long_ID(Cli error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Theory] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs index 9aff98fa1c..80441532c4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs @@ -140,8 +140,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().OnlyContain(resource => resource.Type == "userAccounts"); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[1].StringId); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldContainKey("firstName") != null); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldContainKey("lastName") != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("firstName").WhoseValue != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("lastName").WhoseValue != null); responseDocument.Included.Should().OnlyContain(resource => resource.Relationships.ShouldNotBeNull().Count > 0); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -212,7 +212,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[1].StringId); responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldNotBeNull().Count == 1); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldContainKey("firstName") != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("firstName").WhoseValue != null); responseDocument.Included.Should().OnlyContain(resource => resource.Relationships == null); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -287,10 +287,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(newWorkItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(newWorkItem.Priority); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("tags").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("tags").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(3); @@ -305,7 +305,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingTags[1].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingTags[2].StringId); responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldNotBeNull().Count == 1); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldContainKey("text") != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("text").WhoseValue != null); responseDocument.Included.Should().OnlyContain(resource => resource.Relationships == null); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -362,7 +362,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -407,7 +407,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -451,7 +451,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -560,7 +560,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'subscribers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -663,7 +663,7 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -701,7 +701,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -741,7 +741,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -789,7 +789,7 @@ public async Task Cannot_create_resource_with_local_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -834,6 +834,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/items"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs index ffbd080bbc..a24fd006ee 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs @@ -205,8 +205,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(existingUserAccount.FirstName); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccount.LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -267,10 +267,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newWorkItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newWorkItem.Description); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("assignee").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("assignee").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -280,8 +280,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(existingUserAccount.FirstName); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccount.LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -337,7 +337,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -382,7 +382,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -435,7 +435,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -476,7 +476,7 @@ public async Task Cannot_create_for_missing_relationship_type() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -518,7 +518,7 @@ public async Task Cannot_create_for_unknown_relationship_type() error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -559,7 +559,7 @@ public async Task Cannot_create_for_missing_relationship_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -644,7 +644,7 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -703,8 +703,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccounts[1].StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccounts[1].FirstName)); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccounts[1].LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(existingUserAccounts[1].FirstName); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccounts[1].LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -760,7 +760,7 @@ public async Task Cannot_create_resource_with_local_ID() error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/lid"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -802,6 +802,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/group"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs index ab834e2a03..0f54357f7c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs @@ -45,16 +45,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItems[0].StringId); item1.Type.Should().Be("workItems"); - item1.Attributes.ShouldContainKey("description").With(value => value.Should().Be(workItems[0].Description)); - item1.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(workItems[0].DueAt)); - item1.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(workItems[0].Priority)); + item1.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(workItems[0].Description)); + item1.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(workItems[0].DueAt)); + item1.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(workItems[0].Priority)); item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItems[1].StringId); item2.Type.Should().Be("workItems"); - item2.Attributes.ShouldContainKey("description").With(value => value.Should().Be(workItems[1].Description)); - item2.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(workItems[1].DueAt)); - item2.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(workItems[1].Priority)); + item2.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(workItems[1].Description)); + item2.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(workItems[1].DueAt)); + item2.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(workItems[1].Priority)); item2.Relationships.Should().NotBeEmpty(); } @@ -96,9 +96,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(workItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(workItem.Description)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(workItem.DueAt)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(workItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(workItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(workItem.DueAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(workItem.Priority)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); } @@ -163,8 +163,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("userAccounts"); responseDocument.Data.SingleValue.Id.Should().Be(workItem.Assignee.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(workItem.Assignee.FirstName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(workItem.Assignee.LastName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(workItem.Assignee.FirstName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(workItem.Assignee.LastName)); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); } @@ -216,16 +216,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == userAccount.AssignedItems.ElementAt(0).StringId); item1.Type.Should().Be("workItems"); - item1.Attributes.ShouldContainKey("description").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Description)); - item1.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).DueAt)); - item1.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Priority)); + item1.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Description)); + item1.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).DueAt)); + item1.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Priority)); item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == userAccount.AssignedItems.ElementAt(1).StringId); item2.Type.Should().Be("workItems"); - item2.Attributes.ShouldContainKey("description").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Description)); - item2.Attributes.ShouldContainKey("dueAt").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).DueAt)); - item2.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Priority)); + item2.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Description)); + item2.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).DueAt)); + item2.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Priority)); item2.Relationships.Should().NotBeEmpty(); } @@ -277,14 +277,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItem.Tags.ElementAt(0).StringId); item1.Type.Should().Be("workTags"); - item1.Attributes.ShouldContainKey("text").With(value => value.Should().Be(workItem.Tags.ElementAt(0).Text)); - item1.Attributes.ShouldContainKey("isBuiltIn").With(value => value.Should().Be(workItem.Tags.ElementAt(0).IsBuiltIn)); + item1.Attributes.Should().ContainKey("text").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(0).Text)); + item1.Attributes.Should().ContainKey("isBuiltIn").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(0).IsBuiltIn)); item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItem.Tags.ElementAt(1).StringId); item2.Type.Should().Be("workTags"); - item2.Attributes.ShouldContainKey("text").With(value => value.Should().Be(workItem.Tags.ElementAt(1).Text)); - item2.Attributes.ShouldContainKey("isBuiltIn").With(value => value.Should().Be(workItem.Tags.ElementAt(1).IsBuiltIn)); + item2.Attributes.Should().ContainKey("text").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(1).Text)); + item2.Attributes.Should().ContainKey("isBuiltIn").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(1).IsBuiltIn)); item2.Relationships.Should().NotBeEmpty(); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs index 5a6d76875f..41081cb01b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs @@ -58,7 +58,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this endpoint."); error.Detail.Should().Be("Relationship 'assignee' is not a to-many relationship."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -239,7 +239,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -281,7 +281,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -324,7 +324,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -366,7 +366,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -684,7 +684,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -802,7 +802,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -838,7 +838,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -876,7 +876,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1020,6 +1020,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be added to."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be added to."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs index adbf304db1..6af61e1448 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs @@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this endpoint."); error.Detail.Should().Be("Relationship 'assignee' is not a to-many relationship."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -351,7 +351,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -394,7 +394,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -437,7 +437,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -479,7 +479,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -797,7 +797,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -917,7 +917,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -953,7 +953,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -991,7 +991,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1138,7 +1138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be removed from."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be removed from."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs index 0d35e50eed..8c9d3ecae9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs @@ -268,7 +268,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -310,7 +310,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -353,7 +353,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -395,7 +395,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -710,7 +710,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -795,7 +795,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -831,7 +831,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -869,7 +869,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -1099,6 +1099,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs index ef98b200b4..69a4316c80 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs @@ -304,7 +304,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -339,7 +339,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -383,7 +383,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -422,7 +422,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -462,7 +462,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -501,7 +501,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -735,7 +735,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } [Fact] @@ -853,6 +853,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs index f0c5d67a99..7660963f5c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs @@ -298,14 +298,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(existingWorkItem.Priority); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(existingUserAccount.FirstName); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccount.LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -365,10 +365,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(existingWorkItem.Priority); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("tags").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("tags").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(1); @@ -379,7 +379,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("workTags"); responseDocument.Included[0].Id.Should().Be(existingTag.StringId); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("text").With(value => value.Should().Be(existingTag.Text)); + responseDocument.Included[0].Attributes.Should().ContainKey("text").WhoseValue.Should().Be(existingTag.Text); responseDocument.Included[0].Relationships.Should().BeNull(); int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); @@ -443,7 +443,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -497,7 +497,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -550,7 +550,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -697,7 +697,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'subscribers'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -805,7 +805,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -852,7 +852,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -901,7 +901,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1183,6 +1183,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/items"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs index b5d10695dc..3b5b7ea702 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs @@ -125,7 +125,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'userAccounts'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'userAccounts'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/doesNotExist"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -313,8 +313,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(existingGroup.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(groupName)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isPublic").With(value => value.Should().Be(existingGroup.IsPublic)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(groupName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isPublic").WhoseValue.Should().Be(existingGroup.IsPublic); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -464,10 +464,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(itemDescription)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("dueAt").With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isImportant").With(value => value.Should().Be(existingWorkItem.IsImportant)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(itemDescription); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().BeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(existingWorkItem.Priority); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isImportant").WhoseValue.Should().Be(existingWorkItem.IsImportant); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -521,8 +521,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(itemDescription)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(itemDescription); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(existingWorkItem.Priority); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -578,11 +578,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(itemDescription)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(existingWorkItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(itemDescription); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(existingWorkItem.Priority); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("tags").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("tags").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.ManyValue.Should().HaveCount(1); @@ -593,7 +593,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("workTags"); responseDocument.Included[0].Id.Should().Be(existingWorkItem.Tags.Single().StringId); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("text").With(value => value.Should().Be(existingWorkItem.Tags.Single().Text)); + responseDocument.Included[0].Attributes.Should().ContainKey("text").WhoseValue.Should().Be(existingWorkItem.Tags.Single().Text); responseDocument.Included[0].Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -706,7 +706,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -744,7 +744,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -780,7 +780,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -823,7 +823,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -862,7 +862,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -902,7 +902,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -941,7 +941,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1046,7 +1046,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'workItems'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1086,7 +1086,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Expected '{existingWorkItems[1].StringId}' instead of '{existingWorkItems[0].StringId}'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1130,7 +1130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Attribute 'isDeprecated' on resource type 'workItemGroups' is read-only."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isDeprecated"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1162,7 +1162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().StartWith("Expected end of string, but instead reached end of data."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1206,7 +1206,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/id"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1248,7 +1248,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().Be($"Failed to convert ID '{existingWorkItem.Id}' of type 'Number' to type 'String'."); error.Source.Should().BeNull(); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1296,7 +1296,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Match("Failed to convert attribute 'dueAt' with value '*start*end*' of type 'Object' to type 'Nullable'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/dueAt"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -1377,7 +1377,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string itemDescription = $"{newDescription}{ImplicitlyChangingWorkItemDefinition.Suffix}"; responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(itemDescription)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(itemDescription); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -1544,6 +1544,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The attribute 'isImportant' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isImportant"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs index 348e671dd7..9dc0907d22 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs @@ -344,14 +344,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(description); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(existingUserAccount.FirstName)); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(existingUserAccount.FirstName); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccount.LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -412,10 +412,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(description); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("assignee").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("assignee").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -426,7 +426,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(existingUserAccount.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccount.LastName); responseDocument.Included[0].Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -480,7 +480,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -527,7 +527,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -582,7 +582,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -632,7 +632,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -683,7 +683,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -733,7 +733,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().BeNull(); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -836,7 +836,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } [Fact] @@ -987,6 +987,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); error.Source.ShouldNotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/group"); - error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs index b17ff01082..0ac892c847 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs @@ -57,8 +57,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(certificate.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("issueDate").With(value => value.Should().Be(certificate.IssueDate)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("hasExpired").With(value => value.Should().Be(false)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("issueDate").WhoseValue.Should().Be(certificate.IssueDate); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("hasExpired").WhoseValue.Should().Be(false); } [Fact] @@ -87,8 +87,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(postOffices[1].StringId); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("address").With(value => value.Should().Be(postOffices[1].Address)); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("isOpen").With(value => value.Should().Be(true)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("address").WhoseValue.Should().Be(postOffices[1].Address); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("isOpen").WhoseValue.Should().Be(true); } [Fact] @@ -118,7 +118,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(certificate.Issuer.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isOpen").With(value => value.Should().Be(true)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isOpen").WhoseValue.Should().Be(true); } [Fact] @@ -170,10 +170,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("issueDate").With(value => value.Should().Be(newIssueDate)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("hasExpired").With(value => value.Should().Be(true)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("issueDate").WhoseValue.Should().Be(newIssueDate); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("hasExpired").WhoseValue.Should().Be(true); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("issuer").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("issuer").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -185,8 +185,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].With(resource => { resource.Id.Should().Be(existingOffice.StringId); - resource.Attributes.ShouldContainKey("address").With(value => value.Should().Be(existingOffice.Address)); - resource.Attributes.ShouldContainKey("isOpen").With(value => value.Should().Be(false)); + resource.Attributes.Should().ContainKey("address").WhoseValue.Should().Be(existingOffice.Address); + resource.Attributes.Should().ContainKey("isOpen").WhoseValue.Should().Be(false); }); int newCertificateId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs index 9ed6264857..868b603e8b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs @@ -114,7 +114,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("isGivenLightBy").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("isGivenLightBy").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); @@ -125,7 +125,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("stars"); responseDocument.Included[0].Id.Should().Be(moon.IsGivenLightBy.StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(moon.IsGivenLightBy.Name)); + responseDocument.Included[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(moon.IsGivenLightBy.Name); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -176,11 +176,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("moons"); responseDocument.Included[0].Id.Should().Be(planet.Moons.ElementAt(0).StringId); - responseDocument.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(planet.Moons.ElementAt(0).Name)); + responseDocument.Included[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(planet.Moons.ElementAt(0).Name); responseDocument.Included[1].Type.Should().Be("stars"); responseDocument.Included[1].Id.Should().Be(planet.Moons.ElementAt(0).IsGivenLightBy!.StringId); - responseDocument.Included[1].Attributes.ShouldContainKey("name").With(value => value.Should().Be(planet.Moons.ElementAt(0).IsGivenLightBy!.Name)); + responseDocument.Included[1].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(planet.Moons.ElementAt(0).IsGivenLightBy!.Name); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -579,8 +579,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(star.Name)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("kind").With(value => value.Should().Be(star.Kind)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("kind").WhoseValue.Should().Be(star.Kind); responseDocument.Data.SingleValue.Relationships.ShouldNotBeNull(); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] @@ -620,8 +620,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(star.Name)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("solarRadius").With(value => value.Should().Be(star.SolarRadius)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("solarRadius").WhoseValue.Should().Be(star.SolarRadius); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] @@ -660,7 +660,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(star.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); responseDocument.Data.SingleValue.Attributes.Should().NotContainKey("isVisibleFromEarth"); responseDocument.Data.SingleValue.Relationships.ShouldNotBeNull(); @@ -701,7 +701,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("name").With(value => value.Should().Be(star.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs index 8a1e20e6b8..6cf6d306db 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs @@ -61,7 +61,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => socialSecurityNumber.Should().Be(students[0].SocialSecurityNumber); }); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -114,7 +114,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(4); - responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => socialSecurityNumber.Should().Be(scholarships[0].Participants[0].SocialSecurityNumber); }); - responseDocument.Included[1].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -130,7 +130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => socialSecurityNumber.Should().Be(scholarships[0].Participants[1].SocialSecurityNumber); }); - responseDocument.Included[2].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[2].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -138,7 +138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => socialSecurityNumber.Should().Be(scholarships[1].Participants[0].SocialSecurityNumber); }); - responseDocument.Included[3].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[3].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -180,7 +180,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -220,7 +220,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -228,7 +228,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => socialSecurityNumber.Should().Be(scholarship.Participants[0].SocialSecurityNumber); }); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -269,7 +269,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -311,7 +311,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -358,7 +358,7 @@ public async Task Decrypts_on_create_resource() responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -436,7 +436,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); - responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -490,7 +490,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -574,7 +574,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(2); - responseDocument.Included[0].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); @@ -582,7 +582,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => socialSecurityNumber.Should().Be(existingScholarship.Participants[0].SocialSecurityNumber); }); - responseDocument.Included[1].Attributes.ShouldContainKey("socialSecurityNumber").With(value => + responseDocument.Included[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); string socialSecurityNumber = encryptionService.Decrypt(stringValue); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs index 552d76fa93..44da7fc066 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs @@ -60,9 +60,9 @@ public async Task When_operation_is_enabled_on_base_type_it_is_implicitly_enable responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => { resource.Type.Should().Be("alwaysMovingTandems"); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(newMovingTandem.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(newMovingTandem.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(newMovingTandem.GearCount)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(newMovingTandem.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(newMovingTandem.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("gearCount").WhoseValue.Should().Be(newMovingTandem.GearCount); resource.Relationships.Should().BeNull(); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs index 7c05fe882f..1888a7d972 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs @@ -57,6 +57,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("alwaysMovingTandems"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("locationToken").With(value => value.Should().NotBe(existingMovingTandem.LocationToken)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("locationToken").WhoseValue.Should().NotBe(existingMovingTandem.LocationToken); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs index 4953100a57..dd11f50ac2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs @@ -86,9 +86,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.Self.Should().Be($"/bikes/{bike.StringId}"); resource.Attributes.Should().HaveCount(3); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(bike.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(bike.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(bike.GearCount)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(bike.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(bike.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("gearCount").WhoseValue.Should().Be(bike.GearCount); resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); @@ -109,10 +109,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); resource.Attributes.Should().HaveCount(4); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(tandem.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(tandem.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); - resource.Attributes.ShouldContainKey("passengerCount").With(value => value.Should().Be(tandem.PassengerCount)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(tandem.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(tandem.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("gearCount").WhoseValue.Should().Be(tandem.GearCount); + resource.Attributes.Should().ContainKey("passengerCount").WhoseValue.Should().Be(tandem.PassengerCount); resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); @@ -133,10 +133,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.Self.Should().Be($"/cars/{car.StringId}"); resource.Attributes.Should().HaveCount(4); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(car.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(car.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("licensePlate").With(value => value.Should().Be(car.LicensePlate)); - resource.Attributes.ShouldContainKey("seatCount").With(value => value.Should().Be(car.SeatCount)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(car.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(car.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("licensePlate").WhoseValue.Should().Be(car.LicensePlate); + resource.Attributes.Should().ContainKey("seatCount").WhoseValue.Should().Be(car.SeatCount); resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "features"); @@ -157,10 +157,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.Self.Should().Be($"/trucks/{truck.StringId}"); resource.Attributes.Should().HaveCount(4); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(truck.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(truck.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("licensePlate").With(value => value.Should().Be(truck.LicensePlate)); - resource.Attributes.ShouldContainKey("loadingCapacity").With(value => value.Should().Be(truck.LoadingCapacity)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(truck.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(truck.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("licensePlate").WhoseValue.Should().Be(truck.LicensePlate); + resource.Attributes.Should().ContainKey("loadingCapacity").WhoseValue.Should().Be(truck.LoadingCapacity); resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "sleepingArea", "features"); @@ -209,9 +209,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.Self.Should().Be($"/bikes/{bike.StringId}"); resource.Attributes.Should().HaveCount(3); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(bike.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(bike.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(bike.GearCount)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(bike.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(bike.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("gearCount").WhoseValue.Should().Be(bike.GearCount); resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); @@ -232,10 +232,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); resource.Attributes.Should().HaveCount(4); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(tandem.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(tandem.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); - resource.Attributes.ShouldContainKey("passengerCount").With(value => value.Should().Be(tandem.PassengerCount)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(tandem.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(tandem.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("gearCount").WhoseValue.Should().Be(tandem.GearCount); + resource.Attributes.Should().ContainKey("passengerCount").WhoseValue.Should().Be(tandem.PassengerCount); resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); @@ -284,10 +284,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); resource.Attributes.Should().HaveCount(4); - resource.Attributes.ShouldContainKey("weight").With(value => value.Should().Be(tandem.Weight)); - resource.Attributes.ShouldContainKey("requiresDriverLicense").With(value => value.Should().Be(tandem.RequiresDriverLicense)); - resource.Attributes.ShouldContainKey("gearCount").With(value => value.Should().Be(tandem.GearCount)); - resource.Attributes.ShouldContainKey("passengerCount").With(value => value.Should().Be(tandem.PassengerCount)); + resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(tandem.Weight); + resource.Attributes.Should().ContainKey("requiresDriverLicense").WhoseValue.Should().Be(tandem.RequiresDriverLicense); + resource.Attributes.Should().ContainKey("gearCount").WhoseValue.Should().Be(tandem.GearCount); + resource.Attributes.Should().ContainKey("passengerCount").WhoseValue.Should().Be(tandem.PassengerCount); resource.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); @@ -461,14 +461,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}"); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(4); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isHydrocarbonBased").With(value => value.Should().Be(car.Engine.IsHydrocarbonBased)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("capacity").With(value => value.Should().Be(car.Engine.Capacity)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("serialCode").With(value => value.Should().Be(((GasolineEngine)car.Engine).SerialCode)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("volatility").With(value => value.Should().Be(((GasolineEngine)car.Engine).Volatility)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isHydrocarbonBased").WhoseValue.Should().Be(car.Engine.IsHydrocarbonBased); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("capacity").WhoseValue.Should().Be(car.Engine.Capacity); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("serialCode").WhoseValue.Should().Be(((GasolineEngine)car.Engine).SerialCode); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("volatility").WhoseValue.Should().Be(((GasolineEngine)car.Engine).Volatility); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("cylinders").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("cylinders").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -508,9 +508,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Should().BeNull(); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(3); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("width").With(value => value.Should().Be(tandem.CargoBox.Width)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("height").With(value => value.Should().Be(tandem.CargoBox.Height)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("depth").With(value => value.Should().Be(tandem.CargoBox.Depth)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("width").WhoseValue.Should().Be(tandem.CargoBox.Width); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("height").WhoseValue.Should().Be(tandem.CargoBox.Height); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("depth").WhoseValue.Should().Be(tandem.CargoBox.Depth); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -547,14 +547,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}"); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(4); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("isHydrocarbonBased").With(value => value.Should().Be(car.Engine.IsHydrocarbonBased)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("capacity").With(value => value.Should().Be(car.Engine.Capacity)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("serialCode").With(value => value.Should().Be(((GasolineEngine)car.Engine).SerialCode)); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("volatility").With(value => value.Should().Be(((GasolineEngine)car.Engine).Volatility)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isHydrocarbonBased").WhoseValue.Should().Be(car.Engine.IsHydrocarbonBased); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("capacity").WhoseValue.Should().Be(car.Engine.Capacity); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("serialCode").WhoseValue.Should().Be(((GasolineEngine)car.Engine).SerialCode); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("volatility").WhoseValue.Should().Be(((GasolineEngine)car.Engine).Volatility); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); - responseDocument.Data.SingleValue.Relationships.ShouldContainKey("cylinders").With(value => + responseDocument.Data.SingleValue.Relationships.Should().ContainKey("cylinders").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -675,7 +675,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Relationships.Should().HaveCount(1); - resource.Relationships.ShouldContainKey("vehicle").With(value => + resource.Relationships.Should().ContainKey("vehicle").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -743,7 +743,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Relationships.Should().HaveCount(1); - resource.Relationships.ShouldContainKey("vehicle").With(value => + resource.Relationships.Should().ContainKey("vehicle").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); @@ -805,7 +805,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Relationships.Should().HaveCount(1); - resource.Relationships.ShouldContainKey("vehicle").With(value => + resource.Relationships.Should().ContainKey("vehicle").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Links.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs index f163b5ee11..42f92887ba 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs @@ -175,7 +175,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("0"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTitle)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTitle); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs index adc1bd0ec7..76ed85d367 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs @@ -55,10 +55,10 @@ public void Permits_request_body_without_extension_usage() ResourceObject resourceObject = testContext.Converter.Read(ref reader, typeof(ResourceObject), testContext.SerializerReadOptions); // Assert - resourceObject.Attributes.ShouldContainKey("baseValue").Should().Be("baseAttribute"); - resourceObject.Attributes.ShouldContainKey("derivedValue").Should().Be("derivedAttribute"); + resourceObject.Attributes.Should().ContainKey("baseValue").WhoseValue.Should().Be("baseAttribute"); + resourceObject.Attributes.Should().ContainKey("derivedValue").WhoseValue.Should().Be("derivedAttribute"); - resourceObject.Relationships.ShouldContainKey("parent").With(value => + resourceObject.Relationships.Should().ContainKey("parent").WhoseValue.With(value => { value.ShouldNotBeNull(); value.Data.SingleValue.ShouldNotBeNull(); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs index 2212de79b0..89de6ba3e8 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/ResponseModelAdapterTests.cs @@ -567,7 +567,7 @@ public void Duplicate_children_in_multiple_chains_occur_once_in_output() // Assert document.Included.Should().HaveCount(1); - document.Included[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be(person.Name)); + document.Included[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(person.Name); document.Included[0].Id.Should().Be(person.StringId); } diff --git a/test/MultiDbContextTests/ResourceTests.cs b/test/MultiDbContextTests/ResourceTests.cs index c21627a044..a648f75cfc 100644 --- a/test/MultiDbContextTests/ResourceTests.cs +++ b/test/MultiDbContextTests/ResourceTests.cs @@ -36,7 +36,7 @@ public async Task Can_get_ResourceAs() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("nameA").With(value => value.Should().Be("SampleA")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("nameA").WhoseValue.Should().Be("SampleA"); } [Fact] @@ -52,7 +52,7 @@ public async Task Can_get_ResourceBs() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("nameB").With(value => value.Should().Be("SampleB")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("nameB").WhoseValue.Should().Be("SampleB"); } protected override HttpClient CreateClient() diff --git a/test/NoEntityFrameworkTests/PersonTests.cs b/test/NoEntityFrameworkTests/PersonTests.cs index bb45893b52..3b35dce634 100644 --- a/test/NoEntityFrameworkTests/PersonTests.cs +++ b/test/NoEntityFrameworkTests/PersonTests.cs @@ -53,7 +53,7 @@ public async Task Can_filter_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be("Jane")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be("Jane"); responseDocument.Meta.Should().ContainTotal(1); } @@ -71,7 +71,7 @@ public async Task Can_filter_in_related_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be("John")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be("John"); responseDocument.Meta.Should().ContainTotal(1); } @@ -123,7 +123,7 @@ public async Task Can_paginate_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be("Jane")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be("Jane"); responseDocument.Meta.Should().ContainTotal(2); } @@ -189,8 +189,8 @@ public async Task Can_get_secondary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Make homework")); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Check emails")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.Should().Be("Make homework"); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("description").WhoseValue.Should().Be("Check emails"); responseDocument.Meta.Should().ContainTotal(2); } diff --git a/test/NoEntityFrameworkTests/TagTests.cs b/test/NoEntityFrameworkTests/TagTests.cs index c0af4900b0..c0dc76e2bc 100644 --- a/test/NoEntityFrameworkTests/TagTests.cs +++ b/test/NoEntityFrameworkTests/TagTests.cs @@ -53,7 +53,7 @@ public async Task Can_filter_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Personal")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be("Personal"); responseDocument.Meta.Should().ContainTotal(1); } @@ -71,7 +71,7 @@ public async Task Can_filter_in_related_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Business")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be("Business"); responseDocument.Meta.Should().ContainTotal(1); } @@ -125,7 +125,7 @@ public async Task Can_paginate_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Family")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be("Family"); responseDocument.Meta.Should().ContainTotal(3); } @@ -192,9 +192,9 @@ public async Task Can_get_secondary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(3); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Make homework")); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Book vacation")); - responseDocument.Data.ManyValue[2].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Cook dinner")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.Should().Be("Make homework"); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("description").WhoseValue.Should().Be("Book vacation"); + responseDocument.Data.ManyValue[2].Attributes.Should().ContainKey("description").WhoseValue.Should().Be("Cook dinner"); responseDocument.Meta.Should().ContainTotal(3); } diff --git a/test/NoEntityFrameworkTests/TodoItemTests.cs b/test/NoEntityFrameworkTests/TodoItemTests.cs index 8a4d7ffb38..1ec0916bd8 100644 --- a/test/NoEntityFrameworkTests/TodoItemTests.cs +++ b/test/NoEntityFrameworkTests/TodoItemTests.cs @@ -53,7 +53,7 @@ public async Task Can_filter_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("priority").With(value => value.Should().Be(TodoItemPriority.High)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(TodoItemPriority.High); responseDocument.Meta.Should().ContainTotal(1); } @@ -123,7 +123,7 @@ public async Task Can_paginate_in_primary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be("Check emails")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.Should().Be("Check emails"); responseDocument.Meta.Should().ContainTotal(4); } @@ -209,8 +209,8 @@ public async Task Can_get_secondary_resources() httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Personal")); - responseDocument.Data.ManyValue[1].Attributes.ShouldContainKey("name").With(value => value.Should().Be("Family")); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be("Personal"); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("name").WhoseValue.Should().Be("Family"); responseDocument.Meta.Should().ContainTotal(2); } @@ -229,7 +229,7 @@ public async Task Can_get_secondary_resource() responseDocument.Data.SingleValue.ShouldNotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); - responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be("Jane")); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be("Jane"); } [Fact] diff --git a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs index 9a36e8e51d..2fb6eea06b 100644 --- a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs +++ b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs @@ -16,14 +16,6 @@ public static T ShouldNotBeNull([SysNotNull] this T? subject) return subject; } - [CustomAssertion] - public static TValue? ShouldContainKey([SysNotNull] this IDictionary? subject, TKey expected) - { - subject.Should().ContainKey(expected); - - return subject![expected]; - } - public static void With(this T subject, [InstantHandle] Action continuation) { continuation(subject); From fe2254eb31e55dfdbbb2773caa162f569c0e7974 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sun, 2 Mar 2025 09:13:59 +0100 Subject: [PATCH 8/8] Remove ShouldNotBeNull and redundant With calls --- .../AtomicOperations/AtomicOperationsTests.cs | 28 +-- .../QueryStrings/IncludeTests.cs | 18 +- .../QueryStrings/SparseFieldSets.cs | 34 +-- .../Relationships/FetchRelationshipTests.cs | 2 +- .../UpdateToOneRelationshipTests.cs | 18 +- .../Resources/CreateResourceTests.cs | 62 +++--- .../ReadWrite/Resources/FetchResourceTests.cs | 44 ++-- .../Resources/UpdateResourceTests.cs | 34 +-- .../ServiceDiscoveryFacadeTests.cs | 7 +- .../Archiving/ArchiveTests.cs | 48 ++-- ...tomConstrainedOperationsControllerTests.cs | 6 +- ...ultConstrainedOperationsControllerTests.cs | 8 +- .../Creating/AtomicCreateResourceTests.cs | 107 +++++---- ...reateResourceWithClientGeneratedIdTests.cs | 34 +-- ...eateResourceWithToManyRelationshipTests.cs | 48 ++-- ...reateResourceWithToOneRelationshipTests.cs | 60 ++--- .../Deleting/AtomicDeleteResourceTests.cs | 32 +-- .../Links/AtomicAbsoluteLinksTests.cs | 24 +- .../AtomicRelativeLinksWithNamespaceTests.cs | 24 +- .../LocalIds/AtomicLocalIdTests.cs | 206 +++++++++--------- .../Meta/AtomicResourceMetaTests.cs | 6 +- .../Mixed/AtomicLoggingTests.cs | 2 +- .../Mixed/AtomicRequestBodyTests.cs | 12 +- .../Mixed/MaximumOperationsPerRequestTests.cs | 4 +- .../AtomicModelStateValidationTests.cs | 22 +- .../QueryStrings/AtomicQueryStringTests.cs | 14 +- ...micSerializationResourceDefinitionTests.cs | 24 +- ...icSparseFieldSetResourceDefinitionTests.cs | 16 +- .../Transactions/AtomicRollbackTests.cs | 4 +- .../AtomicTransactionConsistencyTests.cs | 6 +- .../AtomicAddToToManyRelationshipTests.cs | 74 +++---- ...AtomicRemoveFromToManyRelationshipTests.cs | 70 +++--- .../AtomicReplaceToManyRelationshipTests.cs | 74 +++---- .../AtomicUpdateToOneRelationshipTests.cs | 80 +++---- .../AtomicReplaceToManyRelationshipTests.cs | 40 ++-- .../Resources/AtomicUpdateResourceTests.cs | 110 +++++----- .../AtomicUpdateToOneRelationshipTests.cs | 50 ++--- .../Scopes/ScopeOperationsTests.cs | 18 +- .../Authorization/Scopes/ScopeReadTests.cs | 20 +- .../Authorization/Scopes/ScopeWriteTests.cs | 20 +- .../IntegrationTests/Blobs/BlobTests.cs | 32 +-- .../CompositeKeys/CompositeKeyTests.cs | 6 +- .../ContentNegotiation/AcceptHeaderTests.cs | 16 +- .../ContentTypeHeaderTests.cs | 54 ++--- .../CustomExtensionsAcceptHeaderTests.cs | 8 +- .../CustomExtensionsContentTypeTests.cs | 27 ++- .../ActionResultTests.cs | 2 +- .../ApiControllerAttributeTests.cs | 6 +- .../CustomRoutes/CustomRouteTests.cs | 16 +- .../EagerLoading/EagerLoadingTests.cs | 66 +++--- .../HostingInIIS/HostingTests.cs | 28 +-- .../IdObfuscation/IdObfuscationTests.cs | 14 +- .../ModelState/ModelStateValidationTests.cs | 40 ++-- .../ModelState/NoModelStateValidationTests.cs | 4 +- .../RequestBody/WorkflowTests.cs | 6 +- .../Links/AbsoluteLinksWithNamespaceTests.cs | 80 +++---- .../AbsoluteLinksWithoutNamespaceTests.cs | 80 +++---- .../Links/DocumentDescriptionLinkTests.cs | 6 +- .../Links/LinkInclusionIncludeTests.cs | 6 +- .../Links/LinkInclusionTests.cs | 42 ++-- .../Links/RelativeLinksWithNamespaceTests.cs | 80 +++---- .../RelativeLinksWithoutNamespaceTests.cs | 80 +++---- .../Meta/ResourceMetaTests.cs | 2 +- .../FireForgetTests.Group.cs | 12 +- .../FireForgetTests.User.cs | 16 +- .../OutboxTests.Group.cs | 12 +- .../OutboxTests.User.cs | 16 +- .../MultiTenancy/MultiTenancyTests.cs | 20 +- .../NamingConventions/KebabCasingTests.cs | 25 ++- .../NamingConventions/PascalCasingTests.cs | 25 ++- .../NonJsonApiControllerTests.cs | 12 +- .../IsUpperCaseFilterParseTests.cs | 2 +- .../StringLength/LengthFilterParseTests.cs | 2 +- .../StringLength/LengthSortParseTests.cs | 2 +- .../Sum/SumFilterParseTests.cs | 2 +- .../TimeOffset/TimeOffsetTests.cs | 10 +- .../Filtering/FilterDataTypeTests.cs | 26 +-- .../Filtering/FilterDepthTests.cs | 6 +- .../Filtering/FilterOperatorTests.cs | 52 +++-- .../QueryStrings/Filtering/FilterTests.cs | 10 +- .../QueryStrings/Includes/IncludeTests.cs | 112 +++++----- .../PaginationWithTotalCountTests.cs | 38 ++-- .../PaginationWithoutTotalCountTests.cs | 12 +- .../Pagination/RangeValidationTests.cs | 6 +- .../RangeValidationWithMaximumTests.cs | 6 +- .../QueryStrings/QueryStringTests.cs | 4 +- .../SerializerIgnoreConditionTests.cs | 2 +- .../QueryStrings/Sorting/SortTests.cs | 16 +- .../SparseFieldSets/SparseFieldSetTests.cs | 160 +++++++------- .../ReadWrite/Creating/CreateResourceTests.cs | 116 +++++----- ...reateResourceWithClientGeneratedIdTests.cs | 44 ++-- ...eateResourceWithToManyRelationshipTests.cs | 72 +++--- ...reateResourceWithToOneRelationshipTests.cs | 68 +++--- .../ReadWrite/Deleting/DeleteResourceTests.cs | 4 +- .../Fetching/FetchRelationshipTests.cs | 2 +- .../ReadWrite/Fetching/FetchResourceTests.cs | 46 ++-- .../AddToToManyRelationshipTests.cs | 34 +-- .../RemoveFromToManyRelationshipTests.cs | 34 +-- .../ReplaceToManyRelationshipTests.cs | 32 +-- .../UpdateToOneRelationshipTests.cs | 40 ++-- .../ReplaceToManyRelationshipTests.cs | 58 ++--- .../Updating/Resources/UpdateResourceTests.cs | 88 ++++---- .../Resources/UpdateToOneRelationshipTests.cs | 64 +++--- .../DefaultBehaviorTests.cs | 10 +- .../ResourceInjectionTests.cs | 14 +- .../Reading/ResourceDefinitionReadTests.cs | 22 +- .../ResourceDefinitionSerializationTests.cs | 50 ++--- .../AtomicOperationTests.cs | 4 +- .../ResourceInheritanceChangeTrackerTests.cs | 2 +- .../ResourceInheritanceReadTests.cs | 146 +++++++------ .../ResourceInheritanceWriteTests.cs | 66 +++--- .../ResourceTypeCaptureStore.cs | 5 +- .../DisableQueryStringTests.cs | 6 +- .../Serialization/ETagTests.cs | 10 +- .../SoftDeletion/SoftDeletionTests.cs | 2 +- .../ZeroKeys/EmptyGuidAsKeyTests.cs | 30 +-- .../ZeroKeys/WhiteSpaceAsKeyTests.cs | 30 +-- .../ZeroKeys/ZeroAsKeyTests.cs | 34 +-- .../UnitTests/Links/LinkInclusionTests.cs | 25 +-- .../Middleware/JsonApiMiddlewareTests.cs | 7 +- .../ModelStateValidationTests.cs | 4 +- .../QueryStringParameters/FilterParseTests.cs | 4 +- .../IncludeParseTests.cs | 2 +- .../LegacyFilterParseTests.cs | 5 +- .../PaginationParseTests.cs | 4 +- .../QueryStringParameters/SortParseTests.cs | 4 +- .../SparseFieldSetParseTests.cs | 4 +- .../CreateSortExpressionFromLambdaTests.cs | 1 - .../ResourceGraph/HasManyAttributeTests.cs | 1 - .../ResourceObjectConverterTests.cs | 12 +- .../SourcePointerInExceptionTests.cs | 5 +- .../Serialization/InputConversionTests.cs | 7 +- test/NoEntityFrameworkTests/PersonTests.cs | 2 +- test/NoEntityFrameworkTests/TagTests.cs | 2 +- test/NoEntityFrameworkTests/TodoItemTests.cs | 6 +- .../FluentAssertionsExtensions.cs | 49 +++++ test/TestBuildingBlocks/FluentExtensions.cs | 15 -- .../NullabilityAssertionExtensions.cs | 23 -- .../ResourceDescriptorAssemblyCacheTests.cs | 1 - test/UnitTests/Graph/TypeLocatorTests.cs | 5 +- .../ResourceConstructionExpressionTests.cs | 3 +- 141 files changed, 2073 insertions(+), 2068 deletions(-) create mode 100644 test/TestBuildingBlocks/FluentAssertionsExtensions.cs delete mode 100644 test/TestBuildingBlocks/FluentExtensions.cs delete mode 100644 test/TestBuildingBlocks/NullabilityAssertionExtensions.cs diff --git a/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs index d82cf6bbfb..64acaaa57f 100644 --- a/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs +++ b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs @@ -170,18 +170,18 @@ public async Task Can_use_multiple_operations() responseDocument.Results.Should().HaveCount(7); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people")); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people")); - responseDocument.Results[2].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("tags")); - responseDocument.Results[3].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("todoItems")); + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("people"); + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("people"); + responseDocument.Results[2].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("tags"); + responseDocument.Results[3].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("todoItems"); responseDocument.Results[4].Data.Value.Should().BeNull(); - responseDocument.Results[5].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("todoItems")); + responseDocument.Results[5].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("todoItems"); responseDocument.Results[6].Data.Value.Should().BeNull(); - long newOwnerId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - long newAssigneeId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); - long newTagId = long.Parse(responseDocument.Results[2].Data.SingleValue!.Id.ShouldNotBeNull()); - long newTodoItemId = long.Parse(responseDocument.Results[3].Data.SingleValue!.Id.ShouldNotBeNull()); + long newOwnerId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + long newAssigneeId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + long newTagId = long.Parse(responseDocument.Results[2].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + long newTodoItemId = long.Parse(responseDocument.Results[3].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -203,7 +203,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.CreatedAt.Should().Be(DapperTestContext.FrozenTime); todoItemInDatabase.LastModifiedAt.Should().Be(DapperTestContext.FrozenTime); - todoItemInDatabase.Owner.ShouldNotBeNull(); + todoItemInDatabase.Owner.Should().NotBeNull(); todoItemInDatabase.Owner.Id.Should().Be(newOwnerId); todoItemInDatabase.Assignee.Should().BeNull(); todoItemInDatabase.Tags.Should().HaveCount(1); @@ -475,7 +475,7 @@ public async Task Can_rollback_on_error() error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("A related resource does not exist."); error.Detail.Should().Be($"Related resource of type 'todoItems' with ID '{unknownTodoItemId}' in relationship 'assignedTodoItems' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -509,7 +509,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => """)); command.Parameters.Should().HaveCount(1); - command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull(); + command.Parameters.Should().ContainKey("@p1").WhoseValue.Should().NotBeNull(); }); store.SqlCommands[2].With(command => @@ -522,7 +522,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => """)); command.Parameters.Should().HaveCount(1); - command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull(); + command.Parameters.Should().ContainKey("@p1").WhoseValue.Should().NotBeNull(); }); store.SqlCommands[3].With(command => @@ -534,7 +534,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => """)); command.Parameters.Should().HaveCount(2); - command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull(); + command.Parameters.Should().ContainKey("@p1").WhoseValue.Should().NotBeNull(); command.Parameters.Should().Contain("@p2", unknownTodoItemId); }); diff --git a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs index 1a49ad1bcc..77805ee1b5 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs @@ -62,21 +62,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { relationships.Should().ContainKey("owner").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("people"); value.Data.SingleValue.Id.Should().Be(todoItems[0].Owner.StringId); }); relationships.Should().ContainKey("assignee").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.SingleValue.Should().BeNull(); }); relationships.Should().ContainKey("tags").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(2); value.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); value.Data.ManyValue[0].Id.Should().Be(todoItems[0].Tags.ElementAt(0).StringId); @@ -90,23 +90,23 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { relationships.Should().ContainKey("owner").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("people"); value.Data.SingleValue.Id.Should().Be(todoItems[1].Owner.StringId); }); relationships.Should().ContainKey("assignee").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("people"); value.Data.SingleValue.Id.Should().Be(todoItems[1].Assignee!.StringId); }); relationships.Should().ContainKey("tags").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(2); value.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); value.Data.ManyValue[0].Id.Should().Be(todoItems[1].Tags.ElementAt(0).StringId); diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs index d479eb821e..b2e0c68f8c 100644 --- a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs +++ b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs @@ -51,22 +51,22 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems"); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(2); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItem.DurationInHours)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.Should().Be(todoItem.Description); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().Be(todoItem.DurationInHours); responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("owner").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("people"); value.Data.SingleValue.Id.Should().Be(todoItem.Owner.StringId); }); responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("assignee").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("people"); value.Data.SingleValue.Id.Should().Be(todoItem.Assignee.StringId); }); @@ -76,12 +76,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Id.Should().Be(todoItem.Owner.StringId); responseDocument.Included[0].Attributes.Should().HaveCount(1); - responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.LastName)); + responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(todoItem.Owner.LastName); responseDocument.Included[0].Relationships.Should().BeNull(); responseDocument.Included[1].Id.Should().Be(todoItem.Assignee.StringId); responseDocument.Included[1].Attributes.Should().HaveCount(1); - responseDocument.Included[1].Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Assignee.LastName)); + responseDocument.Included[1].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(todoItem.Assignee.LastName); responseDocument.Included[1].Relationships.Should().BeNull(); store.SqlCommands.Should().HaveCount(2); @@ -134,11 +134,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(todoItem.Description); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); store.SqlCommands.Should().HaveCount(1); @@ -189,7 +189,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("color").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); @@ -246,7 +246,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(person.StringId); responseDocument.Data.SingleValue.Attributes.Should().BeNull(); @@ -290,7 +290,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(person.StringId); responseDocument.Data.SingleValue.Attributes.Should().BeNull(); @@ -334,11 +334,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(person.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(person.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(person.DisplayName); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); store.SqlCommands.Should().HaveCount(1); @@ -381,11 +381,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(todoItem.Description); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); responseDocument.Included.Should().HaveCount(2); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs index dced9876cd..d4703dc99a 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs @@ -46,7 +46,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.Owner.StringId); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs index a6320bcc6a..bab60bf29b 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs @@ -475,7 +475,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase = await dbContext.People.Include(person => person.Account).FirstWithIdAsync(existingPerson.Id); - personInDatabase.Account.ShouldNotBeNull(); + personInDatabase.Account.Should().NotBeNull(); personInDatabase.Account.Id.Should().Be(existingLoginAccount.Id); }); @@ -562,7 +562,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => LoginAccount loginAccountInDatabase = await dbContext.LoginAccounts.Include(loginAccount => loginAccount.Person).FirstWithIdAsync(existingLoginAccount.Id); - loginAccountInDatabase.Person.ShouldNotBeNull(); + loginAccountInDatabase.Person.Should().NotBeNull(); loginAccountInDatabase.Person.Id.Should().Be(existingPerson.Id); }); @@ -635,7 +635,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { TodoItem todoItemInDatabase = await dbContext.TodoItems.Include(todoItem => todoItem.Assignee).FirstWithIdAsync(existingTodoItem.Id); - todoItemInDatabase.Assignee.ShouldNotBeNull(); + todoItemInDatabase.Assignee.Should().NotBeNull(); todoItemInDatabase.Assignee.Id.Should().Be(existingPerson.Id); }); @@ -711,7 +711,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Person personInDatabase1 = await dbContext.People.Include(person => person.Account).FirstWithIdAsync(existingPerson1.Id); - personInDatabase1.Account.ShouldNotBeNull(); + personInDatabase1.Account.Should().NotBeNull(); personInDatabase1.Account.Id.Should().Be(existingPerson2.Account.Id); Person personInDatabase2 = await dbContext.People.Include(person => person.Account).FirstWithIdAsync(existingPerson2.Id); @@ -805,7 +805,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => LoginAccount loginAccountInDatabase1 = await dbContext.LoginAccounts.Include(loginAccount => loginAccount.Person).FirstWithIdAsync(existingLoginAccount1.Id); - loginAccountInDatabase1.Person.ShouldNotBeNull(); + loginAccountInDatabase1.Person.Should().NotBeNull(); loginAccountInDatabase1.Person.Id.Should().Be(existingLoginAccount2.Person.Id); LoginAccount loginAccountInDatabase2 = @@ -898,7 +898,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => LoginAccount loginAccountInDatabase1 = await dbContext.LoginAccounts.Include(loginAccount => loginAccount.Recovery).FirstWithIdAsync(existingLoginAccount1.Id); - loginAccountInDatabase1.Recovery.ShouldNotBeNull(); + loginAccountInDatabase1.Recovery.Should().NotBeNull(); loginAccountInDatabase1.Recovery.Id.Should().Be(existingLoginAccount2.Recovery.Id); LoginAccount? loginAccountInDatabase2 = await dbContext.LoginAccounts.Include(loginAccount => loginAccount.Recovery) @@ -989,7 +989,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => AccountRecovery accountRecoveryInDatabase1 = await dbContext.AccountRecoveries.Include(recovery => recovery.Account).FirstWithIdAsync(existingAccountRecovery1.Id); - accountRecoveryInDatabase1.Account.ShouldNotBeNull(); + accountRecoveryInDatabase1.Account.Should().NotBeNull(); accountRecoveryInDatabase1.Account.Id.Should().Be(existingAccountRecovery2.Account.Id); AccountRecovery accountRecoveryInDatabase2 = @@ -1081,7 +1081,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { TodoItem todoItemInDatabase1 = await dbContext.TodoItems.Include(todoItem => todoItem.Assignee).FirstWithIdAsync(existingTodoItem1.Id); - todoItemInDatabase1.Assignee.ShouldNotBeNull(); + todoItemInDatabase1.Assignee.Should().NotBeNull(); todoItemInDatabase1.Assignee.Id.Should().Be(existingTodoItem2.Assignee.Id); }); @@ -1155,7 +1155,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { TodoItem todoItemInDatabase1 = await dbContext.TodoItems.Include(todoItem => todoItem.Owner).FirstWithIdAsync(existingTodoItem1.Id); - todoItemInDatabase1.Owner.ShouldNotBeNull(); + todoItemInDatabase1.Owner.Should().NotBeNull(); todoItemInDatabase1.Owner.Id.Should().Be(existingTodoItem2.Owner.Id); }); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs index e2e050bac2..ce74e99839 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs @@ -92,17 +92,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(newTodoItem.DurationInHours)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newTodoItem.Description); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(newTodoItem.Priority); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().Be(newTodoItem.DurationInHours); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(DapperTestContext.FrozenTime); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); - long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); httpResponse.Headers.Location.Should().Be($"/todoItems/{newTodoItemId}"); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -125,9 +125,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.CreatedAt.Should().Be(DapperTestContext.FrozenTime); todoItemInDatabase.LastModifiedAt.Should().BeNull(); - todoItemInDatabase.Owner.ShouldNotBeNull(); + todoItemInDatabase.Owner.Should().NotBeNull(); todoItemInDatabase.Owner.Id.Should().Be(existingPerson.Id); - todoItemInDatabase.Assignee.ShouldNotBeNull(); + todoItemInDatabase.Assignee.Should().NotBeNull(); todoItemInDatabase.Assignee.Id.Should().Be(existingPerson.Id); todoItemInDatabase.Tags.Should().HaveCount(1); todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(existingTag.Id); @@ -228,16 +228,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newTodoItem.Description); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(newTodoItem.Priority); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().BeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(DapperTestContext.FrozenTime); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); - long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -259,7 +259,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.CreatedAt.Should().Be(DapperTestContext.FrozenTime); todoItemInDatabase.LastModifiedAt.Should().BeNull(); - todoItemInDatabase.Owner.ShouldNotBeNull(); + todoItemInDatabase.Owner.Should().NotBeNull(); todoItemInDatabase.Owner.Id.Should().Be(existingPerson.Id); todoItemInDatabase.Assignee.Should().BeNull(); todoItemInDatabase.Tags.Should().BeEmpty(); @@ -330,21 +330,21 @@ public async Task Cannot_create_resource_without_required_fields() error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The Owner field is required."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/data/relationships/owner/data"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The Priority field is required."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/data/attributes/priority"); ErrorObject error3 = responseDocument.Errors[2]; error3.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error3.Title.Should().Be("Input validation failed."); error3.Detail.Should().Be("The Description field is required."); - error3.Source.ShouldNotBeNull(); + error3.Source.Should().NotBeNull(); error3.Source.Pointer.Should().Be("/data/attributes/description"); store.SqlCommands.Should().BeEmpty(); @@ -407,13 +407,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("loginAccounts"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("userName").WhoseValue.With(value => value.Should().Be(newUserName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(newUserName); responseDocument.Data.SingleValue.Attributes.Should().NotContainKey("lastUsedAt"); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("recovery", "person"); - long newLoginAccountId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newLoginAccountId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -431,9 +431,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => loginAccountInDatabase.UserName.Should().Be(newUserName); loginAccountInDatabase.LastUsedAt.Should().BeNull(); - loginAccountInDatabase.Recovery.ShouldNotBeNull(); + loginAccountInDatabase.Recovery.Should().NotBeNull(); loginAccountInDatabase.Recovery.Id.Should().Be(existingAccountRecovery.Id); - loginAccountInDatabase.Person.ShouldNotBeNull(); + loginAccountInDatabase.Person.Should().NotBeNull(); loginAccountInDatabase.Person.Id.Should().Be(existingPerson.Id); }); @@ -520,14 +520,14 @@ public async Task Can_create_resource_with_calculated_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(newPerson.FirstName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(newPerson.LastName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(newPerson.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(newPerson.FirstName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(newPerson.LastName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(newPerson.DisplayName); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); - long newPersonId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newPersonId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -623,7 +623,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => colorInDatabase.Green.Should().Be(newColor.Green); colorInDatabase.Blue.Should().Be(newColor.Blue); - colorInDatabase.Tag.ShouldNotBeNull(); + colorInDatabase.Tag.Should().NotBeNull(); colorInDatabase.Tag.Id.Should().Be(existingTag.Id); }); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs index 0bf6a09ce7..bd7139e5c4 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs @@ -53,19 +53,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("todoItems")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItems[1].StringId); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItems[1].Description)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(todoItems[1].Priority)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItems[1].DurationInHours)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(todoItems[1].CreatedAt)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(todoItems[1].LastModifiedAt)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.Should().Be(todoItems[1].Description); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(todoItems[1].Priority); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().Be(todoItems[1].DurationInHours); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(todoItems[1].CreatedAt); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("modifiedAt").WhoseValue.Should().Be(todoItems[1].LastModifiedAt); responseDocument.Data.ManyValue[0].Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItems[0].StringId); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItems[0].Description)); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(todoItems[0].Priority)); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItems[0].DurationInHours)); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(todoItems[0].CreatedAt)); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(todoItems[0].LastModifiedAt)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("description").WhoseValue.Should().Be(todoItems[0].Description); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(todoItems[0].Priority); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().Be(todoItems[0].DurationInHours); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(todoItems[0].CreatedAt); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("modifiedAt").WhoseValue.Should().Be(todoItems[0].LastModifiedAt); responseDocument.Data.ManyValue[1].Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Meta.Should().ContainTotal(2); @@ -118,14 +118,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(todoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItem.DurationInHours)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(todoItem.CreatedAt)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(todoItem.LastModifiedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(todoItem.Description); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(todoItem.Priority); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().Be(todoItem.DurationInHours); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(todoItem.CreatedAt); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.Should().Be(todoItem.LastModifiedAt); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); responseDocument.Meta.Should().BeNull(); @@ -215,11 +215,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().AllSatisfy(resource => resource.Type.Should().Be("tags")); responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.Tags.ElementAt(0).StringId); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(todoItem.Tags.ElementAt(0).Name)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItem.Tags.ElementAt(0).Name); responseDocument.Data.ManyValue[0].Relationships.Should().OnlyContainKeys("todoItem", "color"); responseDocument.Data.ManyValue[1].Id.Should().Be(todoItem.Tags.ElementAt(1).StringId); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(todoItem.Tags.ElementAt(1).Name)); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItem.Tags.ElementAt(1).Name); responseDocument.Data.ManyValue[1].Relationships.Should().OnlyContainKeys("todoItem", "color"); responseDocument.Meta.Should().ContainTotal(2); @@ -278,12 +278,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be(todoItem.Owner.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.FirstName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.LastName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.DisplayName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(todoItem.Owner.FirstName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(todoItem.Owner.LastName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(todoItem.Owner.DisplayName); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems"); responseDocument.Meta.Should().BeNull(); diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs index 4b559712c8..dc8bccf5ee 100644 --- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs +++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs @@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Tag tagInDatabase = await dbContext.Tags.Include(tag => tag.Color).FirstWithIdAsync(existingTag.Id); tagInDatabase.Name.Should().Be(existingTag.Name); - tagInDatabase.Color.ShouldNotBeNull(); + tagInDatabase.Color.Should().NotBeNull(); tagInDatabase.Color.Id.Should().Be(existingTag.Color.Id); }); @@ -143,14 +143,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingTodoItem.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newDescription)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(existingTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(newDurationInHours)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(existingTodoItem.CreatedAt)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newDescription); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(existingTodoItem.Priority); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().Be(newDurationInHours); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(existingTodoItem.CreatedAt); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.Should().Be(DapperTestContext.FrozenTime); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -173,9 +173,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.CreatedAt.Should().Be(existingTodoItem.CreatedAt); todoItemInDatabase.LastModifiedAt.Should().Be(DapperTestContext.FrozenTime); - todoItemInDatabase.Owner.ShouldNotBeNull(); + todoItemInDatabase.Owner.Should().NotBeNull(); todoItemInDatabase.Owner.Id.Should().Be(existingTodoItem.Owner.Id); - todoItemInDatabase.Assignee.ShouldNotBeNull(); + todoItemInDatabase.Assignee.Should().NotBeNull(); todoItemInDatabase.Assignee.Id.Should().Be(existingTodoItem.Assignee.Id); todoItemInDatabase.Tags.Should().HaveCount(1); todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(existingTodoItem.Tags.ElementAt(0).Id); @@ -300,14 +300,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("todoItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingTodoItem.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(newTodoItem.DurationInHours)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(existingTodoItem.CreatedAt)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newTodoItem.Description); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(newTodoItem.Priority); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.Should().Be(newTodoItem.DurationInHours); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.Should().Be(existingTodoItem.CreatedAt); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.Should().Be(DapperTestContext.FrozenTime); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags"); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -330,9 +330,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => todoItemInDatabase.CreatedAt.Should().Be(existingTodoItem.CreatedAt); todoItemInDatabase.LastModifiedAt.Should().Be(DapperTestContext.FrozenTime); - todoItemInDatabase.Owner.ShouldNotBeNull(); + todoItemInDatabase.Owner.Should().NotBeNull(); todoItemInDatabase.Owner.Id.Should().Be(existingPerson1.Id); - todoItemInDatabase.Assignee.ShouldNotBeNull(); + todoItemInDatabase.Assignee.Should().NotBeNull(); todoItemInDatabase.Assignee.Id.Should().Be(existingPerson2.Id); todoItemInDatabase.Tags.Should().HaveCount(1); todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(existingTag.Id); diff --git a/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs b/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs index e4f16dbb1f..eeca3cdb89 100644 --- a/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs +++ b/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs @@ -8,7 +8,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using TestBuildingBlocks; using Xunit; namespace DiscoveryTests; @@ -37,10 +36,10 @@ public void Can_add_resources_from_assembly_to_graph() var resourceGraph = serviceProvider.GetRequiredService(); ResourceType? personType = resourceGraph.FindResourceType(typeof(Person)); - personType.ShouldNotBeNull(); + personType.Should().NotBeNull(); ResourceType? todoItemType = resourceGraph.FindResourceType(typeof(TodoItem)); - todoItemType.ShouldNotBeNull(); + todoItemType.Should().NotBeNull(); } [Fact] @@ -57,7 +56,7 @@ public void Can_add_resource_from_current_assembly_to_graph() var resourceGraph = serviceProvider.GetRequiredService(); ResourceType? resourceType = resourceGraph.FindResourceType(typeof(PrivateResource)); - resourceType.ShouldNotBeNull(); + resourceType.Should().NotBeNull(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs index cb9f7b80c6..97506ec5d6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs @@ -44,9 +44,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(broadcast.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(broadcast.ArchivedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().Be(broadcast.ArchivedAt); } [Fact] @@ -70,9 +70,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(broadcast.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -99,7 +99,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(broadcasts[1].StringId); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -126,10 +126,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(broadcasts[0].StringId); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(broadcasts[0].ArchivedAt)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().Be(broadcasts[0].ArchivedAt); responseDocument.Data.ManyValue[1].Id.Should().Be(broadcasts[1].StringId); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -154,12 +154,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(station.StringId); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -184,14 +184,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(station.StringId); responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(station.Broadcasts.ElementAt(0).StringId); - responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(station.Broadcasts.ElementAt(0).ArchivedAt)); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().Be(station.Broadcasts.ElementAt(0).ArchivedAt); responseDocument.Included[1].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Included[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Included[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -215,9 +215,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.AppliesTo.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(comment.AppliesTo.ArchivedAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().Be(comment.AppliesTo.ArchivedAt); } [Fact] @@ -244,7 +244,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -273,10 +273,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); responseDocument.Data.ManyValue[0].Id.Should().Be(station.Broadcasts.ElementAt(0).StringId); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(archivedAt0)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().Be(archivedAt0); responseDocument.Data.ManyValue[1].Id.Should().Be(station.Broadcasts.ElementAt(1).StringId); - responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -307,7 +307,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(1).StringId); - responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -340,9 +340,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(0).StringId); - responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().Be(archivedAt0)); + responseDocument.Included[0].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().Be(archivedAt0); responseDocument.Included[1].Id.Should().Be(network.Stations.ElementAt(0).Broadcasts.ElementAt(1).StringId); - responseDocument.Included[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Included[1].Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] @@ -425,10 +425,10 @@ public async Task Can_create_unarchived_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newBroadcast.Title)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("airedAt").WhoseValue.With(value => value.Should().Be(newBroadcast.AiredAt)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newBroadcast.Title); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("airedAt").WhoseValue.Should().Be(newBroadcast.AiredAt); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("archivedAt").WhoseValue.Should().BeNull(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs index b7bf3cf9cd..b515ff7c13 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicCustomConstrainedOperationsControllerTests.cs @@ -104,7 +104,7 @@ public async Task Cannot_create_resource_for_inaccessible_operation() error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("The requested operation is not accessible."); error.Detail.Should().Be("The 'add' resource operation is not accessible for resource type 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -153,7 +153,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("The requested operation is not accessible."); error.Detail.Should().Be("The 'update' resource operation is not accessible for resource type 'musicTracks'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -209,7 +209,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("The requested operation is not accessible."); error.Detail.Should().Be("The 'add' relationship operation is not accessible for relationship 'performers' on resource type 'musicTracks'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs index a6bc81eeb6..bec1bdc883 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/AtomicDefaultConstrainedOperationsControllerTests.cs @@ -61,7 +61,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("The requested operation is not accessible."); error.Detail.Should().Be("The 'remove' resource operation is not accessible for resource type 'textLanguages'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -153,21 +153,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error1.StatusCode.Should().Be(HttpStatusCode.Forbidden); error1.Title.Should().Be("The requested operation is not accessible."); error1.Detail.Should().Be("The 'update' relationship operation is not accessible for relationship 'lyrics' on resource type 'textLanguages'."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.Forbidden); error2.Title.Should().Be("The requested operation is not accessible."); error2.Detail.Should().Be("The 'add' relationship operation is not accessible for relationship 'lyrics' on resource type 'textLanguages'."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[1]"); ErrorObject error3 = responseDocument.Errors[2]; error3.StatusCode.Should().Be(HttpStatusCode.Forbidden); error3.Title.Should().Be("The requested operation is not accessible."); error3.Detail.Should().Be("The 'remove' relationship operation is not accessible for relationship 'lyrics' on resource type 'textLanguages'."); - error3.Source.ShouldNotBeNull(); + error3.Source.Should().NotBeNull(); error3.Source.Pointer.Should().Be("/atomic:operations[2]"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs index ab13c192f2..c4f70fe60d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs @@ -67,15 +67,15 @@ public async Task Can_create_resource() responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); - resource.Attributes.Should().ContainKey("bornAt").WhoseValue.With(value => value.Should().Be(newBornAt)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newArtistName); + resource.Attributes.Should().ContainKey("bornAt").WhoseValue.Should().Be(newBornAt); resource.Relationships.Should().BeNull(); }); - int newPerformerId = int.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + int newPerformerId = int.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -132,23 +132,20 @@ public async Task Can_create_resources() for (int index = 0; index < elementCount; index++) { - responseDocument.Results[index].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[index].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.ShouldNotBeNull(); + resource.Should().NotBeNull(); resource.Type.Should().Be("musicTracks"); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTracks[index].Title)); - - resource.Attributes.Should().ContainKey("lengthInSeconds").WhoseValue - .With(value => value.As().Should().BeApproximately(newTracks[index].LengthInSeconds)); - - resource.Attributes.Should().ContainKey("genre").WhoseValue.With(value => value.Should().Be(newTracks[index].Genre)); - resource.Attributes.Should().ContainKey("releasedAt").WhoseValue.With(value => value.Should().Be(newTracks[index].ReleasedAt)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTracks[index].Title); + resource.Attributes.Should().ContainKey("lengthInSeconds").WhoseValue.As().Should().BeApproximately(newTracks[index].LengthInSeconds); + resource.Attributes.Should().ContainKey("genre").WhoseValue.Should().Be(newTracks[index].Genre); + resource.Attributes.Should().ContainKey("releasedAt").WhoseValue.Should().Be(newTracks[index].ReleasedAt); resource.Relationships.Should().NotBeEmpty(); }); } - Guid[] newTrackIds = responseDocument.Results.Select(result => Guid.Parse(result.Data.SingleValue!.Id.ShouldNotBeNull())).ToArray(); + Guid[] newTrackIds = responseDocument.Results.Select(result => Guid.Parse(result.Data.SingleValue!.Id.Should().NotBeNull().And.Subject)).ToArray(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -203,15 +200,15 @@ public async Task Can_create_resource_without_attributes_or_relationships() responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().BeNull()); - resource.Attributes.Should().ContainKey("bornAt").WhoseValue.With(value => value.Should().Be(default(DateTimeOffset))); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().BeNull(); + resource.Attributes.Should().ContainKey("bornAt").WhoseValue.Should().Be(default(DateTimeOffset)); resource.Relationships.Should().BeNull(); }); - int newPerformerId = int.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + int newPerformerId = int.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -262,9 +259,9 @@ public async Task Cannot_create_resource_with_unknown_attribute() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown attribute found."); error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'playlists'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -306,14 +303,14 @@ public async Task Can_create_resource_with_unknown_attribute() responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("playlists"); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newName); resource.Relationships.Should().NotBeEmpty(); }); - long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -367,9 +364,9 @@ public async Task Cannot_create_resource_with_unknown_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'lyrics'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -421,20 +418,20 @@ public async Task Can_create_resource_with_unknown_relationship() responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("lyrics"); resource.Attributes.Should().NotBeEmpty(); resource.Relationships.Should().NotBeEmpty(); }); - long newLyricId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + long newLyricId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { Lyric lyricInDatabase = await dbContext.Lyrics.FirstWithIdAsync(newLyricId); - lyricInDatabase.ShouldNotBeNull(); + lyricInDatabase.Should().NotBeNull(); }); } @@ -479,9 +476,9 @@ public async Task Cannot_create_resource_with_client_generated_ID() error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("Failed to deserialize request body: The use of client-generated IDs is disabled."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -514,9 +511,9 @@ public async Task Cannot_create_resource_for_href_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'href' element is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -552,9 +549,9 @@ public async Task Cannot_create_resource_for_ref_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'relationship' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -586,9 +583,9 @@ public async Task Cannot_create_resource_for_missing_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -621,9 +618,9 @@ public async Task Cannot_create_resource_for_null_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -668,9 +665,9 @@ public async Task Cannot_create_resource_for_array_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -708,9 +705,9 @@ public async Task Cannot_create_resource_for_missing_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -746,9 +743,9 @@ public async Task Cannot_create_resource_for_unknown_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -791,9 +788,9 @@ public async Task Cannot_create_resource_with_readonly_attribute() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute is read-only."); error.Detail.Should().Be("Attribute 'isArchived' on resource type 'playlists' is read-only."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -833,9 +830,9 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible attribute value found."); error.Detail.Should().Be("Failed to convert attribute 'bornAt' with value '12345' of type 'Number' to type 'DateTimeOffset'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -913,14 +910,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTitle); resource.Relationships.Should().NotBeEmpty(); }); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -938,10 +935,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTitle); - trackInDatabase.Lyric.ShouldNotBeNull(); + trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); trackInDatabase.Performers.Should().HaveCount(1); @@ -986,8 +983,8 @@ public async Task Cannot_assign_attribute_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute value cannot be assigned when creating resource."); error.Detail.Should().Be("The attribute 'createdAt' on resource type 'lyrics' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs index 0bd7e2ad1d..8675f54c3d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs @@ -75,10 +75,10 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("textLanguages"); - resource.Attributes.Should().ContainKey("isoCode").WhoseValue.With(value => value.Should().Be(isoCode)); + resource.Attributes.Should().ContainKey("isoCode").WhoseValue.Should().Be(isoCode); resource.Attributes.Should().NotContainKey("isRightToLeft"); resource.Relationships.Should().NotBeEmpty(); }); @@ -185,14 +185,14 @@ public async Task Can_create_resource_for_missing_client_generated_ID_having_sid responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("textLanguages"); - resource.Attributes.Should().ContainKey("isoCode").WhoseValue.With(value => value.Should().Be(isoCode)); + resource.Attributes.Should().ContainKey("isoCode").WhoseValue.Should().Be(isoCode); resource.Relationships.Should().NotBeEmpty(); }); - Guid newLanguageId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newLanguageId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -245,9 +245,9 @@ public async Task Cannot_create_resource_for_missing_client_generated_ID(ClientI error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] @@ -305,7 +305,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Another resource with the specified ID already exists."); error.Detail.Should().Be($"Another resource of type 'textLanguages' with ID '{languageToCreate.StringId}' already exists."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -354,9 +354,9 @@ public async Task Cannot_create_resource_for_incompatible_ID(ClientIdGenerationM error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible 'id' value found."); error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int32'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] @@ -399,14 +399,14 @@ public async Task Can_create_resource_with_local_ID(ClientIdGenerationMode mode) responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTitle); resource.Relationships.Should().BeNull(); }); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -454,9 +454,9 @@ public async Task Cannot_create_resource_with_local_ID(ClientIdGenerationMode mo error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'lid' element cannot be used because a client-generated ID is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] @@ -499,8 +499,8 @@ public async Task Cannot_create_resource_for_ID_and_local_ID(ClientIdGenerationM error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs index e7c91381d6..775b6d2197 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs @@ -85,14 +85,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Attributes.Should().NotBeEmpty(); resource.Relationships.Should().NotBeEmpty(); }); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -170,14 +170,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("playlists"); resource.Attributes.Should().NotBeEmpty(); resource.Relationships.Should().NotBeEmpty(); }); - long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -236,9 +236,9 @@ public async Task Cannot_create_for_missing_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -288,9 +288,9 @@ public async Task Cannot_create_for_unknown_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -339,9 +339,9 @@ public async Task Cannot_create_for_missing_relationship_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -405,7 +405,7 @@ public async Task Cannot_create_for_unknown_relationship_IDs() error1.StatusCode.Should().Be(HttpStatusCode.NotFound); error1.Title.Should().Be("A related resource does not exist."); error1.Detail.Should().Be($"Related resource of type 'performers' with ID '{performerId1}' in relationship 'performers' does not exist."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]"); error1.Meta.Should().NotContainKey("requestBody"); @@ -413,7 +413,7 @@ public async Task Cannot_create_for_unknown_relationship_IDs() error2.StatusCode.Should().Be(HttpStatusCode.NotFound); error2.Title.Should().Be("A related resource does not exist."); error2.Detail.Should().Be($"Related resource of type 'performers' with ID '{performerId2}' in relationship 'performers' does not exist."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]"); error2.Meta.Should().NotContainKey("requestBody"); } @@ -465,9 +465,9 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -531,14 +531,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Attributes.Should().NotBeEmpty(); resource.Relationships.Should().NotBeEmpty(); }); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -588,9 +588,9 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -633,9 +633,9 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -680,9 +680,9 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -732,8 +732,8 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs index 78825741da..ff60ccbf87 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToOneRelationshipTests.cs @@ -79,20 +79,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("lyrics"); resource.Attributes.Should().NotBeEmpty(); resource.Relationships.Should().NotBeEmpty(); }); - long newLyricId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + long newLyricId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { Lyric lyricInDatabase = await dbContext.Lyrics.Include(lyric => lyric.Track).FirstWithIdAsync(newLyricId); - lyricInDatabase.Track.ShouldNotBeNull(); + lyricInDatabase.Track.Should().NotBeNull(); lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); }); } @@ -150,20 +150,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Attributes.Should().NotBeEmpty(); resource.Relationships.Should().NotBeEmpty(); }); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Lyric).FirstWithIdAsync(newTrackId); - trackInDatabase.Lyric.ShouldNotBeNull(); + trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); }); } @@ -229,14 +229,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => for (int index = 0; index < elementCount; index++) { - responseDocument.Results[index].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[index].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitles[index])); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitles[index]); }); } - Guid[] newTrackIds = responseDocument.Results.Select(result => Guid.Parse(result.Data.SingleValue!.Id.ShouldNotBeNull())).ToArray(); + Guid[] newTrackIds = responseDocument.Results.Select(result => Guid.Parse(result.Data.SingleValue!.Id.Should().NotBeNull().And.Subject)).ToArray(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -259,7 +259,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitles[index]); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); } }); @@ -302,9 +302,9 @@ public async Task Cannot_create_for_null_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -346,9 +346,9 @@ public async Task Cannot_create_for_missing_data_in_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -398,9 +398,9 @@ public async Task Cannot_create_for_array_data_in_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object or 'null', instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -446,9 +446,9 @@ public async Task Cannot_create_for_missing_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -495,9 +495,9 @@ public async Task Cannot_create_for_unknown_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -543,9 +543,9 @@ public async Task Cannot_create_for_missing_relationship_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -600,7 +600,7 @@ public async Task Cannot_create_with_unknown_relationship_ID() error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("A related resource does not exist."); error.Detail.Should().Be($"Related resource of type 'lyrics' with ID '{lyricId}' in relationship 'lyric' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -649,9 +649,9 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -717,20 +717,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Attributes.Should().NotBeEmpty(); resource.Relationships.Should().NotBeEmpty(); }); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.OwnedBy).FirstWithIdAsync(newTrackId); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); }); } @@ -779,8 +779,8 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/language"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs index bbd9cf8080..c8c00b1a54 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs @@ -319,7 +319,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => MusicTrack? trackInDatabase = await dbContext.MusicTracks.FirstWithIdOrDefaultAsync(existingPlaylist.Tracks[0].Id); - trackInDatabase.ShouldNotBeNull(); + trackInDatabase.Should().NotBeNull(); }); } @@ -353,9 +353,9 @@ public async Task Cannot_delete_resource_for_href_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'href' element is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -387,9 +387,9 @@ public async Task Cannot_delete_resource_for_missing_ref_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'ref' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -425,9 +425,9 @@ public async Task Cannot_delete_resource_for_missing_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -464,9 +464,9 @@ public async Task Cannot_delete_resource_for_unknown_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -502,9 +502,9 @@ public async Task Cannot_delete_resource_for_missing_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -543,7 +543,7 @@ public async Task Cannot_delete_resource_for_unknown_ID() error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("The requested resource does not exist."); error.Detail.Should().Be($"Resource of type 'performers' with ID '{performerId}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -584,9 +584,9 @@ public async Task Cannot_delete_resource_for_incompatible_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible 'id' value found."); error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int64'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -624,8 +624,8 @@ public async Task Cannot_delete_resource_for_ID_and_local_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs index c23fb387c1..24423438bc 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs @@ -82,35 +82,35 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { string languageLink = $"{HostPrefix}/textLanguages/{existingLanguage.StringId}"; - resource.ShouldNotBeNull(); - resource.Links.ShouldNotBeNull(); + resource.Should().NotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(languageLink); resource.Relationships.Should().ContainKey("lyrics").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{languageLink}/relationships/lyrics"); value.Links.Related.Should().Be($"{languageLink}/lyrics"); }); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { string companyLink = $"{HostPrefix}/recordCompanies/{existingCompany.StringId}"; - resource.ShouldNotBeNull(); - resource.Links.ShouldNotBeNull(); + resource.Should().NotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(companyLink); resource.Relationships.Should().ContainKey("tracks").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{companyLink}/relationships/tracks"); value.Links.Related.Should().Be($"{companyLink}/tracks"); }); @@ -158,9 +158,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.ShouldNotBeNull(); + resource.Should().NotBeNull(); resource.Links.Should().BeNull(); resource.Relationships.Should().BeNull(); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs index 16a6ed61fb..6d5bd1797e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs @@ -75,37 +75,37 @@ public async Task Create_resource_with_side_effects_returns_relative_links() responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull(); + responseDocument.Results[0].Data.SingleValue.Should().NotBeNull(); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - string languageLink = $"/api/textLanguages/{Guid.Parse(resource.Id.ShouldNotBeNull())}"; + string languageLink = $"/api/textLanguages/{Guid.Parse(resource.Id.Should().NotBeNull().And.Subject)}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(languageLink); resource.Relationships.Should().ContainKey("lyrics").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{languageLink}/relationships/lyrics"); value.Links.Related.Should().Be($"{languageLink}/lyrics"); }); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull(); + responseDocument.Results[1].Data.SingleValue.Should().NotBeNull(); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - string companyLink = $"/api/recordCompanies/{short.Parse(resource.Id.ShouldNotBeNull())}"; + string companyLink = $"/api/recordCompanies/{short.Parse(resource.Id.Should().NotBeNull().And.Subject)}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(companyLink); resource.Relationships.Should().ContainKey("tracks").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{companyLink}/relationships/tracks"); value.Links.Related.Should().Be($"{companyLink}/tracks"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs index fe97aa6d1a..fb02b6df3f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/LocalIds/AtomicLocalIdTests.cs @@ -82,23 +82,23 @@ public async Task Can_create_resource_with_ManyToOne_relationship_using_local_ID responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("recordCompanies"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompany.Name)); - resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(newCompany.CountryOfResidence)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newCompany.Name); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.Should().Be(newCompany.CountryOfResidence); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - short newCompanyId = short.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + short newCompanyId = short.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -106,7 +106,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(newCompanyId); trackInDatabase.OwnedBy.Name.Should().Be(newCompany.Name); trackInDatabase.OwnedBy.CountryOfResidence.Should().Be(newCompany.CountryOfResidence); @@ -179,23 +179,23 @@ public async Task Can_create_resource_with_OneToMany_relationship_using_local_ID responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newPerformer.ArtistName)); - resource.Attributes.Should().ContainKey("bornAt").WhoseValue.With(value => value.Should().Be(newPerformer.BornAt)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newPerformer.ArtistName); + resource.Attributes.Should().ContainKey("bornAt").WhoseValue.Should().Be(newPerformer.BornAt); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - int newPerformerId = int.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + int newPerformerId = int.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -275,22 +275,22 @@ public async Task Can_create_resource_with_ManyToMany_relationship_using_local_I responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newPlaylistName); }); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - long newPlaylistId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + long newPlaylistId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -366,7 +366,7 @@ public async Task Cannot_consume_local_ID_that_is_assigned_in_same_operation() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Local ID cannot be both defined and used within the same operation."); error.Detail.Should().Be("Local ID 'company-1' cannot be both defined and used within the same operation."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); } @@ -433,7 +433,7 @@ public async Task Cannot_reassign_local_ID() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Another local ID with the same name is already defined at this point."); error.Detail.Should().Be("Another local ID with name 'playlist-1' is already defined at this point."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[2]"); } @@ -489,17 +489,17 @@ public async Task Can_update_resource_using_local_ID() responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); - resource.Attributes.Should().ContainKey("genre").WhoseValue.With(value => value.Should().BeNull()); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); + resource.Attributes.Should().ContainKey("genre").WhoseValue.Should().BeNull(); }); responseDocument.Results[1].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -609,32 +609,32 @@ public async Task Can_update_resource_with_relationships_using_local_ID() responseDocument.Results.Should().HaveCount(4); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newArtistName); }); - responseDocument.Results[2].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[2].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("recordCompanies"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanyName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newCompanyName); }); responseDocument.Results[3].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); - short newCompanyId = short.Parse(responseDocument.Results[2].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + short newCompanyId = short.Parse(responseDocument.Results[2].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -651,7 +651,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(newCompanyId); trackInDatabase.Performers.Should().HaveCount(1); @@ -728,24 +728,24 @@ public async Task Can_create_ManyToOne_relationship_using_local_ID() responseDocument.Results.Should().HaveCount(3); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("recordCompanies"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanyName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newCompanyName); }); responseDocument.Results[2].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - short newCompanyId = short.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + short newCompanyId = short.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -753,7 +753,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(newTrackTitle); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(newCompanyId); trackInDatabase.OwnedBy.Name.Should().Be(newCompanyName); }); @@ -830,24 +830,24 @@ public async Task Can_create_OneToMany_relationship_using_local_ID() responseDocument.Results.Should().HaveCount(3); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newArtistName); }); responseDocument.Results[2].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -932,24 +932,24 @@ public async Task Can_create_ManyToMany_relationship_using_local_ID() responseDocument.Results.Should().HaveCount(3); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newPlaylistName); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); responseDocument.Results[2].Data.Value.Should().BeNull(); - long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1056,24 +1056,24 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(3); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newArtistName); }); responseDocument.Results[2].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1180,24 +1180,24 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(3); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newPlaylistName); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); responseDocument.Results[2].Data.Value.Should().BeNull(); - long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1304,24 +1304,24 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(3); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newArtistName); }); responseDocument.Results[2].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + int newPerformerId = int.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1450,26 +1450,26 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(4); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("playlists"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newPlaylistName)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newPlaylistName); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); responseDocument.Results[2].Data.Value.Should().BeNull(); responseDocument.Results[3].Data.Value.Should().BeNull(); - long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); - Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull()); + long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); + Guid newTrackId = Guid.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1607,30 +1607,30 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(4); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName1)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newArtistName1); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("performers"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("artistName").WhoseValue.With(value => value.Should().Be(newArtistName2)); + resource.Attributes.Should().ContainKey("artistName").WhoseValue.Should().Be(newArtistName2); }); - responseDocument.Results[2].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[2].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); responseDocument.Results[3].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[2].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[2].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1745,11 +1745,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(4); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); responseDocument.Results[1].Data.Value.Should().BeNull(); @@ -1814,16 +1814,16 @@ public async Task Can_delete_resource_using_local_ID() responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("musicTracks"); resource.Lid.Should().BeNull(); - resource.Attributes.Should().ContainKey("title").WhoseValue.With(value => value.Should().Be(newTrackTitle)); + resource.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTrackTitle); }); responseDocument.Results[1].Data.Value.Should().BeNull(); - Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1876,7 +1876,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Server-generated value for local ID is not available at this point."); error.Detail.Should().Be($"Server-generated value for local ID '{Unknown.LocalId}' is not available at this point."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); } @@ -1926,7 +1926,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_data_element() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Server-generated value for local ID is not available at this point."); error.Detail.Should().Be($"Server-generated value for local ID '{Unknown.LocalId}' is not available at this point."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); } @@ -1990,7 +1990,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Server-generated value for local ID is not available at this point."); error.Detail.Should().Be($"Server-generated value for local ID '{Unknown.LocalId}' is not available at this point."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); } @@ -2053,7 +2053,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_relationship_data_elemen error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Server-generated value for local ID is not available at this point."); error.Detail.Should().Be($"Server-generated value for local ID '{Unknown.LocalId}' is not available at this point."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); } @@ -2119,7 +2119,7 @@ public async Task Cannot_consume_unassigned_local_ID_in_relationship_data_array( error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Server-generated value for local ID is not available at this point."); error.Detail.Should().Be($"Server-generated value for local ID '{Unknown.LocalId}' is not available at this point."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); } @@ -2184,7 +2184,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_same_operation() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Incompatible type in Local ID usage."); error.Detail.Should().Be("Local ID 'track-1' belongs to resource type 'musicTracks' instead of 'recordCompanies'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); } @@ -2248,7 +2248,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Incompatible type in Local ID usage."); error.Detail.Should().Be("Local ID 'company-1' belongs to resource type 'recordCompanies' instead of 'musicTracks'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[2]"); } @@ -2309,7 +2309,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_data_element() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Incompatible type in Local ID usage."); error.Detail.Should().Be("Local ID 'performer-1' belongs to resource type 'performers' instead of 'playlists'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[2]"); } @@ -2390,7 +2390,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Incompatible type in Local ID usage."); error.Detail.Should().Be("Local ID 'company-1' belongs to resource type 'recordCompanies' instead of 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[2]"); } @@ -2469,7 +2469,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_relationship_data error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Incompatible type in Local ID usage."); error.Detail.Should().Be("Local ID 'playlist-1' belongs to resource type 'playlists' instead of 'recordCompanies'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[2]"); } @@ -2545,7 +2545,7 @@ public async Task Cannot_consume_local_ID_of_different_type_in_relationship_data error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Incompatible type in Local ID usage."); error.Detail.Should().Be("Local ID 'performer-1' belongs to resource type 'performers' instead of 'musicTracks'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[2]"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs index 6d4fe2adbd..1ab1d848ac 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs @@ -85,7 +85,7 @@ public async Task Returns_resource_meta_in_create_resource_with_side_effects() responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Meta.Should().HaveCount(1); @@ -96,7 +96,7 @@ public async Task Returns_resource_meta_in_create_resource_with_side_effects() }); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Meta.Should().HaveCount(1); @@ -157,7 +157,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Meta.Should().HaveCount(1); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs index 0ea4fb0b65..1662f9387f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicLoggingTests.cs @@ -73,7 +73,7 @@ public async Task Logs_unhandled_exception_at_Error_level() error.StatusCode.Should().Be(HttpStatusCode.InternalServerError); error.Title.Should().Be("An unhandled error occurred while processing an operation in this request."); error.Detail.Should().Be("Simulated failure."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); IReadOnlyList logMessages = loggerProvider.GetMessages(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs index ed04dc74e3..e4d67f457f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicRequestBodyTests.cs @@ -30,7 +30,7 @@ public async Task Cannot_process_for_missing_request_body() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.AtomicOperations.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -64,7 +64,7 @@ public async Task Cannot_process_for_null_request_body() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -117,7 +117,7 @@ public async Task Cannot_process_for_missing_operations_array() error.Title.Should().Be("Failed to deserialize request body: No operations found."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -144,7 +144,7 @@ public async Task Cannot_process_empty_operations_array() error.Title.Should().Be("Failed to deserialize request body: No operations found."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -173,9 +173,9 @@ public async Task Cannot_process_null_operation() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs index 41a9792e37..0173e1c6d4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/MaximumOperationsPerRequestTests.cs @@ -71,9 +71,9 @@ public async Task Cannot_process_more_operations_than_maximum() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Too many operations in request."); error.Detail.Should().Be("The number of operations in this request (3) is higher than the maximum of 2."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs index 237716e238..18e7640d22 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs @@ -57,14 +57,14 @@ public async Task Cannot_create_resource_with_multiple_violations() error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The Title field is required."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/title"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The field LengthInSeconds must be between 1 and 1440."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/lengthInSeconds"); } @@ -110,7 +110,7 @@ public async Task Cannot_create_resource_when_violation_from_custom_ValidationAt error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("ReleasedAt must be in the past."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/releasedAt"); } @@ -170,7 +170,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().Id.ShouldNotBeNull()); + long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -228,14 +228,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The Title field is required."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/title"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The field LengthInSeconds must be between 1 and 1440."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/lengthInSeconds"); } @@ -402,7 +402,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.OwnedBy).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); }); } @@ -515,14 +515,14 @@ public async Task Validates_all_operations_before_execution_starts() error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The Name field is required."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/name"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The field LengthInSeconds must be between 1 and 1440."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[1]/data/attributes/lengthInSeconds"); } @@ -605,14 +605,14 @@ public async Task Does_not_exceed_MaxModelValidationErrors() error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The Name field is required."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/name"); ErrorObject error3 = responseDocument.Errors[2]; error3.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error3.Title.Should().Be("Input validation failed."); error3.Detail.Should().Be("The Name field is required."); - error3.Source.ShouldNotBeNull(); + error3.Source.Should().NotBeNull(); error3.Source.Pointer.Should().Be("/atomic:operations[1]/data/attributes/name"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs index cbda80ebb2..a635e12fb6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs @@ -59,7 +59,7 @@ public async Task Cannot_include_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'include' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("include"); } @@ -99,7 +99,7 @@ public async Task Cannot_filter_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'filter' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -139,7 +139,7 @@ public async Task Cannot_sort_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'sort' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("sort"); } @@ -179,7 +179,7 @@ public async Task Cannot_use_pagination_number_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'page[number]' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -219,7 +219,7 @@ public async Task Cannot_use_pagination_size_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'page[size]' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[size]"); } @@ -259,7 +259,7 @@ public async Task Cannot_use_sparse_fieldset_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'fields[recordCompanies]' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("fields[recordCompanies]"); } @@ -336,7 +336,7 @@ public async Task Cannot_use_Queryable_handler_at_operations_endpoint() error.Detail.Should().Be("Query string parameter 'isRecentlyReleased' is unknown. " + "Set 'AllowUnknownQueryStringParameters' to 'true' in options to ignore unknown parameters."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("isRecentlyReleased"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs index d4d7fbefa0..cb0325882e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs @@ -90,20 +90,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanies[0].Name.ToUpperInvariant())); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newCompanies[0].Name.ToUpperInvariant()); string countryOfResidence = newCompanies[0].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.Should().Be(countryOfResidence); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newCompanies[1].Name.ToUpperInvariant())); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newCompanies[1].Name.ToUpperInvariant()); string countryOfResidence = newCompanies[1].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.Should().Be(countryOfResidence); }); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -242,20 +242,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(existingCompanies[0].Name)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(existingCompanies[0].Name); string countryOfResidence = existingCompanies[0].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.Should().Be(countryOfResidence); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(existingCompanies[1].Name)); + resource.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(existingCompanies[1].Name); string countryOfResidence = existingCompanies[1].CountryOfResidence!.ToUpperInvariant(); - resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.With(value => value.Should().Be(countryOfResidence)); + resource.Attributes.Should().ContainKey("countryOfResidence").WhoseValue.Should().Be(countryOfResidence); }); await _testContext.RunOnDatabaseAsync(async dbContext => diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs index 9e09b1014c..9263d1ec32 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/SparseFieldSets/AtomicSparseFieldSetResourceDefinitionTests.cs @@ -88,15 +88,15 @@ public async Task Hides_text_in_create_resource_with_side_effects() responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(newLyrics[0].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.Should().Be(newLyrics[0].Format); resource.Attributes.Should().NotContainKey("text"); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(newLyrics[1].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.Should().Be(newLyrics[1].Format); resource.Attributes.Should().NotContainKey("text"); }); @@ -167,15 +167,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(2); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(existingLyrics[0].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.Should().Be(existingLyrics[0].Format); resource.Attributes.Should().NotContainKey("text"); }); - responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { - resource.Attributes.Should().ContainKey("format").WhoseValue.With(value => value.Should().Be(existingLyrics[1].Format)); + resource.Attributes.Should().ContainKey("format").WhoseValue.Should().Be(existingLyrics[1].Format); resource.Attributes.Should().NotContainKey("text"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs index f4030857f3..f27e6c4a93 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs @@ -94,7 +94,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("A related resource does not exist."); error.Detail.Should().Be($"Related resource of type 'performers' with ID '{unknownPerformerId}' in relationship 'performers' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -174,7 +174,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("A related resource does not exist."); error.Detail.Should().Be($"Related resource of type 'performers' with ID '{unknownPerformerId}' in relationship 'performers' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[1]"); await _testContext.RunOnDatabaseAsync(async dbContext => diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs index e4feb21a18..14cfc466a0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicTransactionConsistencyTests.cs @@ -70,7 +70,7 @@ public async Task Cannot_use_non_transactional_repository() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Unsupported resource type in atomic:operations request."); error.Detail.Should().Be("Operations on resources of type 'performers' cannot be used because transaction support is unavailable."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -113,7 +113,7 @@ public async Task Cannot_use_transactional_repository_without_active_transaction error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Unsupported combination of resource types in atomic:operations request."); error.Detail.Should().Be("All operations need to participate in a single shared transaction, which is not the case for this request."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -156,7 +156,7 @@ public async Task Cannot_use_distributed_transaction() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Unsupported combination of resource types in atomic:operations request."); error.Detail.Should().Be("All operations need to participate in a single shared transaction, which is not the case for this request."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs index b1e5794220..5ddc0d55fd 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs @@ -68,9 +68,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this operation."); error.Detail.Should().Be("Relationship 'ownedBy' is not a to-many relationship."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -263,9 +263,9 @@ public async Task Cannot_add_for_href_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'href' element is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -302,9 +302,9 @@ public async Task Cannot_add_for_missing_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -342,9 +342,9 @@ public async Task Cannot_add_for_unknown_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -381,9 +381,9 @@ public async Task Cannot_add_for_missing_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("The requested resource does not exist."); error.Detail.Should().Be($"Resource of type 'recordCompanies' with ID '{companyId}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -480,9 +480,9 @@ public async Task Cannot_add_for_ID_and_local_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -519,9 +519,9 @@ public async Task Cannot_add_for_missing_relationship_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'relationship' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -559,9 +559,9 @@ public async Task Cannot_add_for_unknown_relationship_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -607,9 +607,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -656,9 +656,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -707,9 +707,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -754,9 +754,9 @@ public async Task Cannot_add_for_missing_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -802,9 +802,9 @@ public async Task Cannot_add_for_unknown_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -849,9 +849,9 @@ public async Task Cannot_add_for_missing_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -898,9 +898,9 @@ public async Task Cannot_add_for_ID_and_local_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -965,14 +965,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error1.StatusCode.Should().Be(HttpStatusCode.NotFound); error1.Title.Should().Be("A related resource does not exist."); error1.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[0]}' in relationship 'tracks' does not exist."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.NotFound); error2.Title.Should().Be("A related resource does not exist."); error2.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[1]}' in relationship 'tracks' does not exist."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -1027,9 +1027,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1130,8 +1130,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be added to."); error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be added to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs index 975d0f99db..a914e59ac3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs @@ -68,9 +68,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this operation."); error.Detail.Should().Be("Relationship 'ownedBy' is not a to-many relationship."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -262,9 +262,9 @@ public async Task Cannot_remove_for_href_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'href' element is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -301,9 +301,9 @@ public async Task Cannot_remove_for_missing_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -341,9 +341,9 @@ public async Task Cannot_remove_for_unknown_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -380,9 +380,9 @@ public async Task Cannot_remove_for_missing_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -438,7 +438,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("The requested resource does not exist."); error.Detail.Should().Be($"Resource of type 'recordCompanies' with ID '{companyId}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -479,9 +479,9 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -519,9 +519,9 @@ public async Task Cannot_remove_for_unknown_relationship_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -567,9 +567,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -616,9 +616,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -667,9 +667,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -714,9 +714,9 @@ public async Task Cannot_remove_for_missing_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -762,9 +762,9 @@ public async Task Cannot_remove_for_unknown_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -809,9 +809,9 @@ public async Task Cannot_remove_for_missing_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -858,9 +858,9 @@ public async Task Cannot_remove_for_ID_and_local_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -925,14 +925,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error1.StatusCode.Should().Be(HttpStatusCode.NotFound); error1.Title.Should().Be("A related resource does not exist."); error1.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[0]}' in relationship 'tracks' does not exist."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.NotFound); error2.Title.Should().Be("A related resource does not exist."); error2.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[1]}' in relationship 'tracks' does not exist."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -987,9 +987,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1091,8 +1091,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be removed from."); error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be removed from."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs index b8326ce56a..38d2d1aac0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs @@ -297,9 +297,9 @@ public async Task Cannot_replace_for_href_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'href' element is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -336,9 +336,9 @@ public async Task Cannot_replace_for_missing_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -376,9 +376,9 @@ public async Task Cannot_replace_for_unknown_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -415,9 +415,9 @@ public async Task Cannot_replace_for_missing_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -473,7 +473,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("The requested resource does not exist."); error.Detail.Should().Be($"Resource of type 'recordCompanies' with ID '{companyId}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -531,9 +531,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible 'id' value found."); error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int16'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -572,9 +572,9 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -612,9 +612,9 @@ public async Task Cannot_replace_for_unknown_relationship_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -660,9 +660,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -709,9 +709,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -760,9 +760,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -807,9 +807,9 @@ public async Task Cannot_replace_for_missing_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -855,9 +855,9 @@ public async Task Cannot_replace_for_unknown_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -902,9 +902,9 @@ public async Task Cannot_replace_for_missing_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -951,9 +951,9 @@ public async Task Cannot_replace_for_ID_and_local_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1018,14 +1018,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error1.StatusCode.Should().Be(HttpStatusCode.NotFound); error1.Title.Should().Be("A related resource does not exist."); error1.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[0]}' in relationship 'tracks' does not exist."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.NotFound); error2.Title.Should().Be("A related resource does not exist."); error2.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[1]}' in relationship 'tracks' does not exist."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -1080,9 +1080,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible 'id' value found."); error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1136,9 +1136,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1189,8 +1189,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs index e1d39724dd..3d543a15f6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs @@ -227,7 +227,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Lyric lyricInDatabase = await dbContext.Lyrics.Include(lyric => lyric.Track).FirstWithIdAsync(existingLyric.Id); - lyricInDatabase.Track.ShouldNotBeNull(); + lyricInDatabase.Track.Should().NotBeNull(); lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); }); } @@ -281,7 +281,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Lyric).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Lyric.ShouldNotBeNull(); + trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); }); } @@ -335,7 +335,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.OwnedBy).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); }); } @@ -392,7 +392,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Lyric lyricInDatabase = await dbContext.Lyrics.Include(lyric => lyric.Track).FirstWithIdAsync(existingLyric.Id); - lyricInDatabase.Track.ShouldNotBeNull(); + lyricInDatabase.Track.Should().NotBeNull(); lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); @@ -452,7 +452,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Lyric).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Lyric.ShouldNotBeNull(); + trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); List lyricsInDatabase = await dbContext.Lyrics.ToListAsync(); @@ -512,7 +512,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.OwnedBy).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); @@ -550,9 +550,9 @@ public async Task Cannot_create_for_href_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'href' element is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -589,9 +589,9 @@ public async Task Cannot_create_for_missing_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -629,9 +629,9 @@ public async Task Cannot_create_for_unknown_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -668,9 +668,9 @@ public async Task Cannot_create_for_missing_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -723,7 +723,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("The requested resource does not exist."); error.Detail.Should().Be($"Resource of type 'musicTracks' with ID '{trackId}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -776,9 +776,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible 'id' value found."); error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -817,9 +817,9 @@ public async Task Cannot_create_for_ID_and_local_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -857,9 +857,9 @@ public async Task Cannot_create_for_unknown_relationship_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -905,9 +905,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -961,9 +961,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object or 'null', instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1005,9 +1005,9 @@ public async Task Cannot_create_for_missing_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1050,9 +1050,9 @@ public async Task Cannot_create_for_unknown_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1094,9 +1094,9 @@ public async Task Cannot_create_for_missing_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1140,9 +1140,9 @@ public async Task Cannot_create_for_ID_and_local_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1195,7 +1195,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("A related resource does not exist."); error.Detail.Should().Be($"Related resource of type 'lyrics' with ID '{lyricId}' in relationship 'lyric' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -1248,9 +1248,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible 'id' value found."); error.Detail.Should().Be("Failed to convert 'invalid-guid' of type 'String' to type 'Guid'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1301,9 +1301,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1354,8 +1354,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/relationship"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs index fc752a80f3..31a2b61512 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs @@ -335,9 +335,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -389,9 +389,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -445,9 +445,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -497,9 +497,9 @@ public async Task Cannot_replace_for_missing_type_in_relationship_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -550,9 +550,9 @@ public async Task Cannot_replace_for_unknown_type_in_relationship_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -602,9 +602,9 @@ public async Task Cannot_replace_for_missing_ID_in_relationship_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -656,9 +656,9 @@ public async Task Cannot_replace_for_ID_and_local_ID_relationship_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -728,14 +728,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error1.StatusCode.Should().Be(HttpStatusCode.NotFound); error1.Title.Should().Be("A related resource does not exist."); error1.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[0]}' in relationship 'tracks' does not exist."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/atomic:operations[0]"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.NotFound); error2.Title.Should().Be("A related resource does not exist."); error2.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[1]}' in relationship 'tracks' does not exist."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/atomic:operations[0]"); } @@ -795,9 +795,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -856,8 +856,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs index 7b8a1f4f1d..2e97812c19 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs @@ -153,7 +153,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(existingTrack.Title); trackInDatabase.Genre.Should().Be(existingTrack.Genre); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingTrack.OwnedBy.Id); }); } @@ -206,9 +206,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown attribute found."); error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'musicTracks'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -319,9 +319,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'musicTracks'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -431,7 +431,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Genre.Should().Be(newGenre); trackInDatabase.ReleasedAt.Should().Be(existingTrack.ReleasedAt); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingTrack.OwnedBy.Id); }); } @@ -496,7 +496,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Genre.Should().Be(newGenre); trackInDatabase.ReleasedAt.Should().Be(newReleasedAt); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingTrack.OwnedBy.Id); }); } @@ -546,10 +546,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string isoCode = $"{newIsoCode}{ImplicitlyChangingTextLanguageDefinition.Suffix}"; - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("textLanguages"); - resource.Attributes.Should().ContainKey("isoCode").WhoseValue.With(value => value.Should().Be(isoCode)); + resource.Attributes.Should().ContainKey("isoCode").WhoseValue.Should().Be(isoCode); resource.Attributes.Should().NotContainKey("isRightToLeft"); resource.Relationships.Should().NotBeEmpty(); }); @@ -600,7 +600,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Relationships.Should().NotBeEmpty(); resource.Relationships.Values.Should().OnlyContain(value => value != null && value.Data.Value == null); @@ -637,9 +637,9 @@ public async Task Cannot_update_resource_for_href_element() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'href' element is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/href"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -743,9 +743,9 @@ public async Task Cannot_update_resource_for_missing_type_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -792,9 +792,9 @@ public async Task Cannot_update_resource_for_missing_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -843,9 +843,9 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_ref() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -877,9 +877,9 @@ public async Task Cannot_update_resource_for_missing_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -912,9 +912,9 @@ public async Task Cannot_update_resource_for_null_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -966,9 +966,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1010,9 +1010,9 @@ public async Task Cannot_update_resource_for_missing_type_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1054,9 +1054,9 @@ public async Task Cannot_update_resource_for_missing_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1100,9 +1100,9 @@ public async Task Cannot_update_resource_for_ID_and_local_ID_in_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1150,9 +1150,9 @@ public async Task Cannot_update_on_resource_type_mismatch_between_ref_and_data() error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1203,9 +1203,9 @@ public async Task Cannot_update_on_resource_ID_mismatch_between_ref_and_data() error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Conflicting 'id' values found."); error.Detail.Should().Be($"Expected '{performerId1}' instead of '{performerId2}'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1253,9 +1253,9 @@ public async Task Cannot_update_on_resource_local_ID_mismatch_between_ref_and_da error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Conflicting 'lid' values found."); error.Detail.Should().Be("Expected 'local-1' instead of 'local-2'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1305,9 +1305,9 @@ public async Task Cannot_update_on_mixture_of_ID_and_local_ID_between_ref_and_da error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1357,9 +1357,9 @@ public async Task Cannot_update_on_mixture_of_local_ID_and_ID_between_ref_and_da error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1402,9 +1402,9 @@ public async Task Cannot_update_resource_for_unknown_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1449,7 +1449,7 @@ public async Task Cannot_update_resource_for_unknown_ID() error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("The requested resource does not exist."); error.Detail.Should().Be($"Resource of type 'performers' with ID '{performerId}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -1498,9 +1498,9 @@ public async Task Cannot_update_resource_for_incompatible_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible 'id' value found."); error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int32'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1549,9 +1549,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute is read-only."); error.Detail.Should().Be("Attribute 'isArchived' on resource type 'playlists' is read-only."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1600,9 +1600,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Resource ID is read-only."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1651,9 +1651,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible attribute value found."); error.Detail.Should().Be("Failed to convert attribute 'bornAt' with value '123.45' of type 'Number' to type 'DateTimeOffset'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1754,10 +1754,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => trackInDatabase.Title.Should().Be(existingTrack.Title); trackInDatabase.Genre.Should().Be(newGenre); - trackInDatabase.Lyric.ShouldNotBeNull(); + trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); trackInDatabase.Performers.Should().HaveCount(1); @@ -1811,8 +1811,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute value cannot be assigned when updating resource."); error.Detail.Should().Be("The attribute 'createdAt' on resource type 'lyrics' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs index 4e9c0bc75d..00133e29ea 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs @@ -247,7 +247,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Lyric lyricInDatabase = await dbContext.Lyrics.Include(lyric => lyric.Track).FirstWithIdAsync(existingLyric.Id); - lyricInDatabase.Track.ShouldNotBeNull(); + lyricInDatabase.Track.Should().NotBeNull(); lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); }); } @@ -306,7 +306,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Lyric).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Lyric.ShouldNotBeNull(); + trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); }); } @@ -365,7 +365,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.OwnedBy).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); }); } @@ -427,7 +427,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Lyric lyricInDatabase = await dbContext.Lyrics.Include(lyric => lyric.Track).FirstWithIdAsync(existingLyric.Id); - lyricInDatabase.Track.ShouldNotBeNull(); + lyricInDatabase.Track.Should().NotBeNull(); lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); List tracksInDatabase = await dbContext.MusicTracks.ToListAsync(); @@ -492,7 +492,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Lyric).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.Lyric.ShouldNotBeNull(); + trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); List lyricsInDatabase = await dbContext.Lyrics.ToListAsync(); @@ -557,7 +557,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.OwnedBy).FirstWithIdAsync(existingTrack.Id); - trackInDatabase.OwnedBy.ShouldNotBeNull(); + trackInDatabase.OwnedBy.Should().NotBeNull(); trackInDatabase.OwnedBy.Id.Should().Be(existingCompany.Id); List companiesInDatabase = await dbContext.RecordCompanies.ToListAsync(); @@ -611,9 +611,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -664,9 +664,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -725,9 +725,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object or 'null', instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -774,9 +774,9 @@ public async Task Cannot_create_for_missing_type_in_relationship_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/track/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -824,9 +824,9 @@ public async Task Cannot_create_for_unknown_type_in_relationship_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -873,9 +873,9 @@ public async Task Cannot_create_for_missing_ID_in_relationship_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' or 'lid' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -924,9 +924,9 @@ public async Task Cannot_create_for_ID_and_local_ID_in_relationship_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' and 'lid' element are mutually exclusive."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -984,7 +984,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.NotFound); error.Title.Should().Be("A related resource does not exist."); error.Detail.Should().Be($"Related resource of type 'lyrics' with ID '{lyricId}' in relationship 'lyric' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]"); error.Meta.Should().NotContainKey("requestBody"); } @@ -1042,9 +1042,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'playlists' is not convertible to type 'lyrics' of relationship 'lyric'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1100,8 +1100,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'language' on resource type 'lyrics' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/language"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs index 8a8c5d39ce..d8834ce7fa 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeOperationsTests.cs @@ -92,7 +92,7 @@ public async Task Cannot_create_resources_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:genres write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -143,7 +143,7 @@ public async Task Cannot_create_resource_with_read_scope() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:genres."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -201,7 +201,7 @@ public async Task Cannot_update_resources_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -259,7 +259,7 @@ public async Task Cannot_update_resource_with_relationships_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -306,7 +306,7 @@ public async Task Cannot_delete_resources_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:genres."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -346,7 +346,7 @@ public async Task Cannot_update_ToOne_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:genres write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -386,7 +386,7 @@ public async Task Cannot_update_ToMany_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -426,7 +426,7 @@ public async Task Cannot_add_to_ToMany_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -466,7 +466,7 @@ public async Task Cannot_remove_from_ToMany_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs index a00682d446..91530044df 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeReadTests.cs @@ -40,7 +40,7 @@ public async Task Cannot_get_primary_resources_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -64,7 +64,7 @@ public async Task Cannot_get_primary_resources_with_incorrect_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -177,7 +177,7 @@ public async Task Cannot_get_primary_resource_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:actors."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -199,7 +199,7 @@ public async Task Cannot_get_secondary_resource_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:genres read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -221,7 +221,7 @@ public async Task Cannot_get_secondary_resources_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:genres read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -243,7 +243,7 @@ public async Task Cannot_get_ToOne_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:genres read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -265,7 +265,7 @@ public async Task Cannot_get_ToMany_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:genres read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -289,7 +289,7 @@ public async Task Cannot_include_with_insufficient_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:actors read:genres read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -313,7 +313,7 @@ public async Task Cannot_filter_with_insufficient_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:actors read:genres read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -337,7 +337,7 @@ public async Task Cannot_sort_with_insufficient_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: read:actors read:genres read:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs index 914a0605b7..ef1e7d5aca 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/ScopeWriteTests.cs @@ -54,7 +54,7 @@ public async Task Cannot_create_resource_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -114,7 +114,7 @@ public async Task Cannot_create_resource_with_relationships_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:genres write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -177,7 +177,7 @@ public async Task Cannot_create_resource_with_relationships_with_read_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:genres write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -214,7 +214,7 @@ public async Task Cannot_update_resource_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -273,7 +273,7 @@ public async Task Cannot_update_resource_with_relationships_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:genres write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -295,7 +295,7 @@ public async Task Cannot_delete_resource_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -326,7 +326,7 @@ public async Task Cannot_update_ToOne_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:genres write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -360,7 +360,7 @@ public async Task Cannot_update_ToMany_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -394,7 +394,7 @@ public async Task Cannot_add_to_ToMany_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } @@ -428,7 +428,7 @@ public async Task Cannot_remove_from_ToMany_relationship_without_scopes() error.StatusCode.Should().Be(HttpStatusCode.Unauthorized); error.Title.Should().Be("Insufficient permissions to perform this request."); error.Detail.Should().Be("Performing this request requires the following scopes: write:actors write:movies."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be(ScopeHeaderName); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs index 326578213e..3716c56214 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs @@ -42,12 +42,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(container.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(container.FileName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().Equal(container.Data)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().With(value => value.Should().Equal(container.Thumbnail)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.Should().Be(container.FileName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().Should().Equal(container.Data); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().Should().Equal(container.Thumbnail); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -79,14 +79,14 @@ public async Task Can_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(newContainer.FileName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().Equal(newContainer.Data)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().With(value => value.Should().Equal(newContainer.Thumbnail)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.Should().Be(newContainer.FileName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().Should().Equal(newContainer.Data); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().Should().Equal(newContainer.Thumbnail); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); - long newContainerId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newContainerId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -135,10 +135,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(existingContainer.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(existingContainer.FileName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.Should().Be(existingContainer.FileName); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().Equal(newData)); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.As().With(value => value.Should().Equal(newThumbnail)); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); @@ -186,10 +186,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(existingContainer.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(existingContainer.FileName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.Should().Be(existingContainer.FileName); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("data").WhoseValue.As().With(value => value.Should().BeEmpty()); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); @@ -235,11 +235,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("imageContainers"); responseDocument.Data.SingleValue.Id.Should().Be(existingContainer.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.With(value => value.Should().Be(existingContainer.FileName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("fileName").WhoseValue.Should().Be(existingContainer.FileName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("thumbnail").WhoseValue.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs index 51e3beee7a..3ea92e7c17 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs @@ -74,7 +74,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(car.StringId); } @@ -181,7 +181,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Car? carInDatabase = await dbContext.Cars.FirstOrDefaultAsync(car => car.RegionId == newCar.RegionId && car.LicensePlate == newCar.LicensePlate); - carInDatabase.ShouldNotBeNull(); + carInDatabase.Should().NotBeNull(); carInDatabase.Id.Should().Be($"{newCar.RegionId}:{newCar.LicensePlate}"); }); } @@ -234,7 +234,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Engine engineInDatabase = await dbContext.Engines.Include(engine => engine.Car).FirstWithIdAsync(existingEngine.Id); - engineInDatabase.Car.ShouldNotBeNull(); + engineInDatabase.Car.Should().NotBeNull(); engineInDatabase.Car.Id.Should().Be(existingCar.StringId); }); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs index 0a7cdcb61a..d7b1616501 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/AcceptHeaderTests.cs @@ -38,7 +38,7 @@ public async Task Permits_global_wildcard_in_Accept_headers() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -60,7 +60,7 @@ public async Task Permits_application_wildcard_in_Accept_headers() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -85,7 +85,7 @@ public async Task Permits_JsonApi_without_parameters_in_Accept_headers() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -131,7 +131,7 @@ public async Task Prefers_JsonApi_with_AtomicOperations_extension_in_Accept_head // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.AtomicOperations.ToString()); } @@ -177,7 +177,7 @@ public async Task Prefers_JsonApi_with_relaxed_AtomicOperations_extension_in_Acc // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.RelaxedAtomicOperations.ToString()); } @@ -208,7 +208,7 @@ public async Task Denies_JsonApi_with_parameters_in_Accept_headers() error.StatusCode.Should().Be(HttpStatusCode.NotAcceptable); error.Title.Should().Be("The specified Accept header value does not contain any supported media types."); error.Detail.Should().Be($"Include '{JsonApiMediaType.Default}' in the Accept header values."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Accept"); } @@ -255,7 +255,7 @@ public async Task Denies_no_Accept_headers_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.NotAcceptable); error.Title.Should().Be("The specified Accept header value does not contain any supported media types."); error.Detail.Should().Be($"Include '{JsonApiMediaType.AtomicOperations}' or '{JsonApiMediaType.RelaxedAtomicOperations}' in the Accept header values."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Accept"); } @@ -301,7 +301,7 @@ public async Task Denies_JsonApi_in_Accept_headers_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.NotAcceptable); error.Title.Should().Be("The specified Accept header value does not contain any supported media types."); error.Detail.Should().Be($"Include '{JsonApiMediaType.AtomicOperations}' or '{JsonApiMediaType.RelaxedAtomicOperations}' in the Accept header values."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Accept"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs index 1fa82874b1..5627265ea6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/ContentTypeHeaderTests.cs @@ -32,7 +32,7 @@ public async Task Returns_JsonApi_ContentType_header() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -67,7 +67,7 @@ public async Task Returns_JsonApi_ContentType_header_with_AtomicOperations_exten // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.AtomicOperations.ToString()); } @@ -106,7 +106,7 @@ public async Task Returns_JsonApi_ContentType_header_with_relaxed_AtomicOperatio // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.RelaxedAtomicOperations.ToString()); } @@ -135,7 +135,7 @@ public async Task Denies_unknown_ContentType_header() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -144,7 +144,7 @@ public async Task Denies_unknown_ContentType_header() error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be($"Use '{JsonApiMediaType.Default}' instead of 'text/html' for the Content-Type header value."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -180,7 +180,7 @@ public async Task Denies_unknown_ContentType_header_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -192,7 +192,7 @@ public async Task Denies_unknown_ContentType_header_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be(detail); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -221,7 +221,7 @@ public async Task Permits_JsonApi_ContentType_header() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -250,7 +250,7 @@ public async Task Permits_JsonApi_ContentType_header_in_upper_case() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -285,7 +285,7 @@ public async Task Permits_JsonApi_ContentType_header_with_AtomicOperations_exten // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.AtomicOperations.ToString()); } @@ -321,7 +321,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -333,7 +333,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be(detail); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -372,7 +372,7 @@ public async Task Permits_JsonApi_ContentType_header_with_relaxed_AtomicOperatio // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.RelaxedAtomicOperations.ToString()); } @@ -401,7 +401,7 @@ public async Task Denies_JsonApi_ContentType_header_with_unknown_extension() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -410,7 +410,7 @@ public async Task Denies_JsonApi_ContentType_header_with_unknown_extension() error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be($"Use '{JsonApiMediaType.Default}' instead of '{contentType}' for the Content-Type header value."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -439,7 +439,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -448,7 +448,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be($"Use '{JsonApiMediaType.Default}' instead of '{contentType}' for the Content-Type header value."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -477,7 +477,7 @@ public async Task Denies_JsonApi_ContentType_header_with_relaxed_AtomicOperation // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -486,7 +486,7 @@ public async Task Denies_JsonApi_ContentType_header_with_relaxed_AtomicOperation error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be($"Use '{JsonApiMediaType.Default}' instead of '{contentType}' for the Content-Type header value."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -515,7 +515,7 @@ public async Task Denies_JsonApi_ContentType_header_with_profile() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -524,7 +524,7 @@ public async Task Denies_JsonApi_ContentType_header_with_profile() error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be($"Use '{JsonApiMediaType.Default}' instead of '{contentType}' for the Content-Type header value."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -553,7 +553,7 @@ public async Task Denies_JsonApi_ContentType_header_with_CharSet() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -562,7 +562,7 @@ public async Task Denies_JsonApi_ContentType_header_with_CharSet() error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be($"Use '{JsonApiMediaType.Default}' instead of '{contentType}' for the Content-Type header value."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -591,7 +591,7 @@ public async Task Denies_JsonApi_ContentType_header_with_unknown_parameter() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -600,7 +600,7 @@ public async Task Denies_JsonApi_ContentType_header_with_unknown_parameter() error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be($"Use '{JsonApiMediaType.Default}' instead of '{contentType}' for the Content-Type header value."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -636,7 +636,7 @@ public async Task Denies_JsonApi_ContentType_header_at_operations_endpoint() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -648,7 +648,7 @@ public async Task Denies_JsonApi_ContentType_header_at_operations_endpoint() error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be(detail); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs index 7e78ddbdc6..d1c859aaea 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsAcceptHeaderTests.cs @@ -54,7 +54,7 @@ public async Task Permits_JsonApi_without_parameters_in_Accept_headers() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -78,7 +78,7 @@ public async Task Prefers_first_match_from_GetPossibleMediaTypes_with_largest_nu // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.ServerTime.ToString()); } @@ -101,7 +101,7 @@ public async Task Prefers_quality_factor_over_largest_number_of_extensions() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -150,7 +150,7 @@ public async Task Denies_extensions_mismatch_between_ContentType_and_Accept_head error.StatusCode.Should().Be(HttpStatusCode.NotAcceptable); error.Title.Should().Be("The specified Accept header value does not contain any supported media types."); error.Detail.Should().Be(detail); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Accept"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs index 66130068ab..261f7b5149 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs @@ -74,7 +74,7 @@ public async Task Permits_JsonApi_ContentType_header() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); } @@ -111,10 +111,11 @@ public async Task Permits_JsonApi_ContentType_header_with_ServerTime_extension() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.ServerTime.ToString()); - responseDocument.Meta.Should().ContainKey("localServerTime").WhoseValue.ShouldNotBeNull().ToString().Should().Be("2025-01-01T06:53:40.0000000+09:00"); + responseDocument.Meta.Should().ContainKey("localServerTime").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should() + .Be("2025-01-01T06:53:40.0000000+09:00"); } [Fact] @@ -146,10 +147,11 @@ public async Task Permits_JsonApi_ContentType_header_with_relaxed_ServerTime_ext // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.RelaxedServerTime.ToString()); - responseDocument.Meta.Should().ContainKey("utcServerTime").WhoseValue.ShouldNotBeNull().ToString().Should().Be("2024-12-31T21:53:40.0000000Z"); + responseDocument.Meta.Should().ContainKey("utcServerTime").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should() + .Be("2024-12-31T21:53:40.0000000Z"); } [Fact] @@ -188,10 +190,11 @@ public async Task Permits_JsonApi_ContentType_header_with_AtomicOperations_and_S // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.AtomicOperationsWithServerTime.ToString()); - responseDocument.Meta.Should().ContainKey("utcServerTime").WhoseValue.ShouldNotBeNull().ToString().Should().Be("2024-12-31T21:53:40.0000000Z"); + responseDocument.Meta.Should().ContainKey("utcServerTime").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should() + .Be("2024-12-31T21:53:40.0000000Z"); } [Fact] @@ -235,7 +238,7 @@ public async Task Permits_JsonApi_ContentType_header_with_relaxed_AtomicOperatio // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(ServerTimeMediaTypes.RelaxedAtomicOperationsWithRelaxedServerTime.ToString()); responseDocument.Meta.Should().ContainKey("localServerTime"); @@ -266,7 +269,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -278,7 +281,7 @@ public async Task Denies_JsonApi_ContentType_header_with_AtomicOperations_extens error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be(detail); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } @@ -314,7 +317,7 @@ public async Task Denies_JsonApi_ContentType_header_with_relaxed_ServerTime_at_o // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.UnsupportedMediaType); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -327,7 +330,7 @@ public async Task Denies_JsonApi_ContentType_header_with_relaxed_ServerTime_at_o error.StatusCode.Should().Be(HttpStatusCode.UnsupportedMediaType); error.Title.Should().Be("The specified Content-Type header value is not supported."); error.Detail.Should().Be(detail); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("Content-Type"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs index 3686eaa63a..fe047449f1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ControllerActionResults/ActionResultTests.cs @@ -37,7 +37,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(toothbrush.StringId); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs index 8fd2509f78..731401137b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs @@ -32,7 +32,7 @@ public async Task ApiController_attribute_transforms_NotFound_action_result_with responseDocument.Errors.Should().HaveCount(1); ErrorObject error = responseDocument.Errors[0]; - error.Links.ShouldNotBeNull(); + error.Links.Should().NotBeNull(); error.Links.About.Should().StartWith("https://tools.ietf.org/html/rfc"); } @@ -65,7 +65,7 @@ public async Task ProblemDetails_from_invalid_ModelState_is_translated_into_erro ErrorObject error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.BadRequest); - error1.Links.ShouldNotBeNull(); + error1.Links.Should().NotBeNull(); error1.Links.About.Should().StartWith("https://tools.ietf.org/html/rfc"); error1.Title.Should().Be("One or more validation errors occurred."); error1.Detail.Should().Be("The Name field is required."); @@ -73,7 +73,7 @@ public async Task ProblemDetails_from_invalid_ModelState_is_translated_into_erro ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.BadRequest); - error2.Links.ShouldNotBeNull(); + error2.Links.Should().NotBeNull(); error2.Links.About.Should().StartWith("https://tools.ietf.org/html/rfc"); error2.Title.Should().Be("One or more validation errors occurred."); error2.Detail.Should().Be("The field YearOfBirth must be between 1900 and 2050."); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs index 88c3be1071..eb74e50fb4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/CustomRouteTests.cs @@ -42,7 +42,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("towns"); responseDocument.Data.SingleValue.Id.Should().Be(town.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(town.Name); @@ -51,15 +51,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("civilians").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{HostPrefix}{route}/relationships/civilians"); value.Links.Related.Should().Be($"{HostPrefix}{route}/civilians"); }); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); } @@ -85,8 +85,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(5); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "towns"); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.ShouldNotBeNull().Count > 0); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.ShouldNotBeNull().Count > 0); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Type == "towns"); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Attributes != null && resource.Attributes.Count > 0); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships != null && resource.Relationships.Count > 0); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs index d3d984411d..8b64dfcbbf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/EagerLoadingTests.cs @@ -51,12 +51,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(building.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("number").WhoseValue.With(value => value.Should().Be(building.Number)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowCount").WhoseValue.With(value => value.Should().Be(4)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("primaryDoorColor").WhoseValue.With(value => value.Should().Be(building.PrimaryDoor.Color)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("secondaryDoorColor").WhoseValue.With(value => value.Should().Be(building.SecondaryDoor.Color)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("number").WhoseValue.Should().Be(building.Number); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowCount").WhoseValue.Should().Be(4); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("primaryDoorColor").WhoseValue.Should().Be(building.PrimaryDoor.Color); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("secondaryDoorColor").WhoseValue.Should().Be(building.SecondaryDoor.Color); } [Fact] @@ -87,12 +87,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(street.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(street.Name)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("buildingCount").WhoseValue.With(value => value.Should().Be(2)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("doorTotalCount").WhoseValue.With(value => value.Should().Be(3)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(5)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(street.Name); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("buildingCount").WhoseValue.Should().Be(2); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("doorTotalCount").WhoseValue.Should().Be(3); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowTotalCount").WhoseValue.Should().Be(5); } [Fact] @@ -118,10 +118,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(street.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(3)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowTotalCount").WhoseValue.Should().Be(3); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -150,21 +150,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(state.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(state.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(state.Name); responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Type.Should().Be("cities"); responseDocument.Included[0].Id.Should().Be(state.Cities[0].StringId); - responseDocument.Included[0].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(state.Cities[0].Name)); + responseDocument.Included[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(state.Cities[0].Name); responseDocument.Included[1].Type.Should().Be("streets"); responseDocument.Included[1].Id.Should().Be(state.Cities[0].Streets[0].StringId); - responseDocument.Included[1].Attributes.Should().ContainKey("buildingCount").WhoseValue.With(value => value.Should().Be(1)); - responseDocument.Included[1].Attributes.Should().ContainKey("doorTotalCount").WhoseValue.With(value => value.Should().Be(1)); - responseDocument.Included[1].Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(3)); + responseDocument.Included[1].Attributes.Should().ContainKey("buildingCount").WhoseValue.Should().Be(1); + responseDocument.Included[1].Attributes.Should().ContainKey("doorTotalCount").WhoseValue.Should().Be(1); + responseDocument.Included[1].Attributes.Should().ContainKey("windowTotalCount").WhoseValue.Should().Be(3); } [Fact] @@ -196,15 +196,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(state.Cities[0].StringId); responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(state.Cities[0].Name)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(state.Cities[0].Name); responseDocument.Data.ManyValue[0].Relationships.Should().BeNull(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("streets"); responseDocument.Included[0].Id.Should().Be(state.Cities[0].Streets[0].StringId); responseDocument.Included[0].Attributes.Should().HaveCount(2); - responseDocument.Included[0].Attributes.Should().ContainKey("doorTotalCount").WhoseValue.With(value => value.Should().Be(2)); - responseDocument.Included[0].Attributes.Should().ContainKey("windowTotalCount").WhoseValue.With(value => value.Should().Be(1)); + responseDocument.Included[0].Attributes.Should().ContainKey("doorTotalCount").WhoseValue.Should().Be(2); + responseDocument.Included[0].Attributes.Should().ContainKey("windowTotalCount").WhoseValue.Should().Be(1); responseDocument.Included[0].Relationships.Should().BeNull(); } @@ -234,13 +234,13 @@ public async Task Can_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("number").WhoseValue.With(value => value.Should().Be(newBuilding.Number)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowCount").WhoseValue.With(value => value.Should().Be(0)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("primaryDoorColor").WhoseValue.With(value => value.Should().Be("(unspecified)")); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("secondaryDoorColor").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("number").WhoseValue.Should().Be(newBuilding.Number); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("windowCount").WhoseValue.Should().Be(0); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("primaryDoorColor").WhoseValue.Should().Be("(unspecified)"); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("secondaryDoorColor").WhoseValue.Should().BeNull(); - int newBuildingId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newBuildingId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -256,9 +256,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - buildingInDatabase.ShouldNotBeNull(); + buildingInDatabase.Should().NotBeNull(); buildingInDatabase.Number.Should().Be(newBuilding.Number); - buildingInDatabase.PrimaryDoor.ShouldNotBeNull(); + buildingInDatabase.PrimaryDoor.Should().NotBeNull(); buildingInDatabase.PrimaryDoor.Color.Should().Be("(unspecified)"); buildingInDatabase.SecondaryDoor.Should().BeNull(); buildingInDatabase.Windows.Should().BeEmpty(); @@ -321,11 +321,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - buildingInDatabase.ShouldNotBeNull(); + buildingInDatabase.Should().NotBeNull(); buildingInDatabase.Number.Should().Be(newBuildingNumber); - buildingInDatabase.PrimaryDoor.ShouldNotBeNull(); + buildingInDatabase.PrimaryDoor.Should().NotBeNull(); buildingInDatabase.PrimaryDoor.Color.Should().Be(newPrimaryDoorColor); - buildingInDatabase.SecondaryDoor.ShouldNotBeNull(); + buildingInDatabase.SecondaryDoor.Should().NotBeNull(); buildingInDatabase.Windows.Should().HaveCount(2); }); } @@ -370,7 +370,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("The PrimaryDoorColor field is required."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/primaryDoorColor"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs index 563dd1aad6..d3ab6edd78 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/HostingTests.cs @@ -43,7 +43,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -57,13 +57,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string galleryLink = $"{HostPrefix}/iis-application-virtual-directory/public-api/artGalleries/{gallery.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(galleryLink); resource.Relationships.Should().ContainKey("paintings").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{galleryLink}/relationships/paintings"); value.Links.Related.Should().Be($"{galleryLink}/paintings"); }); @@ -75,13 +75,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].With(resource => { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(paintingLink); resource.Relationships.Should().ContainKey("exposedAt").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{paintingLink}/relationships/exposedAt"); value.Links.Related.Should().Be($"{paintingLink}/exposedAt"); }); @@ -110,7 +110,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -124,13 +124,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string paintingLink = $"{HostPrefix}/iis-application-virtual-directory/custom/path/to/paintings-of-the-world/{painting.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(paintingLink); resource.Relationships.Should().ContainKey("exposedAt").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{paintingLink}/relationships/exposedAt"); value.Links.Related.Should().Be($"{paintingLink}/exposedAt"); }); @@ -142,13 +142,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string galleryLink = $"{HostPrefix}/iis-application-virtual-directory/public-api/artGalleries/{painting.ExposedAt.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(galleryLink); resource.Relationships.Should().ContainKey("paintings").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{galleryLink}/relationships/paintings"); value.Links.Related.Should().Be($"{galleryLink}/paintings"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs index 5859cb029c..e5383f3f7d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs @@ -64,7 +64,7 @@ public async Task Cannot_filter_equality_for_invalid_ID() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"The value 'not-a-hex-value' is not a valid hexadecimal value. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -135,7 +135,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(card.StringId); } @@ -186,7 +186,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); responseDocument.Included.Should().HaveCount(1); @@ -265,9 +265,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("ownerName").WhoseValue.With(value => value.Should().Be(newCard.OwnerName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("pinCode").WhoseValue.With(value => value.Should().Be(newCard.PinCode)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("ownerName").WhoseValue.Should().Be(newCard.OwnerName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("pinCode").WhoseValue.Should().Be(newCard.PinCode); var codec = new HexadecimalCodec(); int newCardId = codec.Decode(responseDocument.Data.SingleValue.Id); @@ -279,7 +279,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => cardInDatabase.OwnerName.Should().Be(newCard.OwnerName); cardInDatabase.PinCode.Should().Be(newCard.PinCode); - cardInDatabase.Account.ShouldNotBeNull(); + cardInDatabase.Account.Should().NotBeNull(); cardInDatabase.Account.Id.Should().Be(existingAccount.Id); cardInDatabase.Account.StringId.Should().Be(existingAccount.StringId); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs index 66dc592322..7cedc98f5e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs @@ -49,7 +49,7 @@ public async Task Cannot_create_resource_with_omitted_required_attribute() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("The Name field is required."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/directoryName"); } @@ -84,7 +84,7 @@ public async Task Cannot_create_resource_with_null_for_required_attribute_value( error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("The Name field is required."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/directoryName"); } @@ -119,7 +119,7 @@ public async Task Cannot_create_resource_with_invalid_attribute_value() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be(@"The field Name must match the regular expression '^[\w\s]+$'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/directoryName"); } @@ -159,14 +159,14 @@ public async Task Cannot_create_resource_with_invalid_DateOnly_TimeOnly_attribut error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().StartWith("The field CreatedAt must be between "); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/data/attributes/createdAt"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().StartWith("The field CreatedOn must be between "); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/data/attributes/createdOn"); } @@ -197,9 +197,9 @@ public async Task Can_create_resource_with_valid_attribute_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.With(value => value.Should().Be(newDirectory.Name)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isCaseSensitive").WhoseValue.With(value => value.Should().Be(newDirectory.IsCaseSensitive)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.Should().Be(newDirectory.Name); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isCaseSensitive").WhoseValue.Should().Be(newDirectory.IsCaseSensitive); } [Fact] @@ -231,14 +231,14 @@ public async Task Cannot_create_resource_with_multiple_violations() error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The Name field is required."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/data/attributes/directoryName"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The IsCaseSensitive field is required."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/data/attributes/isCaseSensitive"); } @@ -277,14 +277,14 @@ public async Task Does_not_exceed_MaxModelValidationErrors() error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The FileName field is required."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/data/attributes/fileName"); ErrorObject error3 = responseDocument.Errors[2]; error3.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error3.Title.Should().Be("Input validation failed."); error3.Detail.Should().Be("The Attributes field is required."); - error3.Source.ShouldNotBeNull(); + error3.Source.Should().NotBeNull(); error3.Source.Pointer.Should().Be("/data/attributes/attributes"); } @@ -359,9 +359,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.With(value => value.Should().Be(newDirectory.Name)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isCaseSensitive").WhoseValue.With(value => value.Should().Be(newDirectory.IsCaseSensitive)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.Should().Be(newDirectory.Name); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isCaseSensitive").WhoseValue.Should().Be(newDirectory.IsCaseSensitive); } [Fact] @@ -478,14 +478,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The Name field is required."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/data/attributes/directoryName"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The IsCaseSensitive field is required."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/data/attributes/isCaseSensitive"); } @@ -528,7 +528,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be(@"The field Name must match the regular expression '^[\w\s]+$'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/directoryName"); } @@ -573,14 +573,14 @@ public async Task Cannot_update_resource_with_invalid_ID() error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The field Id must match the regular expression '^[0-9]+$'."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/data/id"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The field Id must match the regular expression '^[0-9]+$'."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/data/relationships/subdirectories/data[0]/id"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs index e007759a9d..4245ff2fc1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/NoModelStateValidationTests.cs @@ -46,8 +46,8 @@ public async Task Can_create_resource_with_invalid_attribute_value() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.With(value => value.Should().Be("!@#$%^&*().-")); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("directoryName").WhoseValue.Should().Be("!@#$%^&*().-"); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs index c8c13bb65c..9b8fd9cbc9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowTests.cs @@ -44,7 +44,7 @@ public async Task Can_create_in_valid_stage() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); } [Fact] @@ -77,7 +77,7 @@ public async Task Cannot_create_in_invalid_stage() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Invalid workflow stage."); error.Detail.Should().Be("Initial stage of workflow must be 'Created'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/stage"); } @@ -123,7 +123,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Invalid workflow stage."); error.Detail.Should().Be("Cannot transition from 'OnHold' to 'Succeeded'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/stage"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs index 9f07879b2e..688ef470b8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -60,14 +60,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{HostPrefix}{route}/relationships/photos"); value.Links.Related.Should().Be($"{HostPrefix}{route}/photos"); }); @@ -95,7 +95,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -110,13 +110,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -128,13 +128,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -162,7 +162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -173,14 +173,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{photo.Album.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -222,13 +222,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -256,7 +256,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photos/{photo.StringId}/album"); responseDocument.Links.First.Should().BeNull(); @@ -265,7 +265,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -291,7 +291,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}/photos"); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -353,7 +353,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -362,8 +362,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{responseDocument.Data.SingleValue.Id}"; @@ -371,8 +371,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -383,13 +383,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -450,14 +450,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -468,13 +468,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{existingAlbum.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs index f732c018a8..5098e9d34f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -60,14 +60,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{HostPrefix}{route}/relationships/photos"); value.Links.Related.Should().Be($"{HostPrefix}{route}/photos"); }); @@ -95,7 +95,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -110,13 +110,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -128,13 +128,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -162,7 +162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -173,14 +173,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{photo.Album.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -222,13 +222,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -256,7 +256,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photos/{photo.StringId}/album"); responseDocument.Links.First.Should().BeNull(); @@ -265,7 +265,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -291,7 +291,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}/photos"); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -353,7 +353,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -362,8 +362,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{responseDocument.Data.SingleValue.Id}"; @@ -371,8 +371,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -383,13 +383,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -450,14 +450,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -468,13 +468,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{existingAlbum.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/DocumentDescriptionLinkTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/DocumentDescriptionLinkTests.cs index a2183247e5..99da94cb2c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/DocumentDescriptionLinkTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/DocumentDescriptionLinkTests.cs @@ -40,7 +40,7 @@ public async Task Get_primary_resource_by_ID_converts_relative_documentation_lin // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.DescribedBy.Should().Be("http://localhost/description/json-schema?version=v1.0"); } @@ -62,7 +62,7 @@ public async Task Get_primary_resource_by_ID_converts_absolute_documentation_lin // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.DescribedBy.Should().Be("description/json-schema?version=v1.0"); } @@ -84,7 +84,7 @@ public async Task Get_primary_resource_by_ID_cannot_convert_absolute_documentati // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.DescribedBy.Should().Be("https://docs.api.com/description/json-schema?version=v1.0"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs index d927722b5a..bfaac74209 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionIncludeTests.cs @@ -40,12 +40,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photo").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); }); responseDocument.Included.Should().HaveCount(2); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs index 736902fcf4..32fecc526c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/LinkInclusionTests.cs @@ -44,20 +44,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photo").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().BeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Links.Should().BeNull(); }); @@ -65,29 +65,29 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].With(resource => { - resource.Links.ShouldNotBeNull(); - resource.Links.Self.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); + resource.Links.Self.Should().NotBeNull(); resource.Relationships.Should().ContainKey("location").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); }); responseDocument.Included[1].With(resource => { - resource.Links.ShouldNotBeNull(); - resource.Links.Self.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); + resource.Links.Self.Should().NotBeNull(); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); }); } @@ -115,15 +115,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photo").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().BeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Data.SingleValue.Relationships.Should().NotContainKey("album"); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs index 04040d235b..60471032e6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -60,14 +60,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{HostPrefix}{route}/relationships/photos"); value.Links.Related.Should().Be($"{HostPrefix}{route}/photos"); }); @@ -95,7 +95,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -110,13 +110,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -128,13 +128,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -162,7 +162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -173,14 +173,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{photo.Album.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -222,13 +222,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -256,7 +256,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photos/{photo.StringId}/album"); responseDocument.Links.First.Should().BeNull(); @@ -265,7 +265,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -291,7 +291,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}/photos"); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -353,7 +353,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -362,8 +362,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{responseDocument.Data.SingleValue.Id}"; @@ -371,8 +371,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -383,13 +383,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -450,14 +450,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -468,13 +468,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{existingAlbum.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs index 9a1178de0a..bbb95668d8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -60,14 +60,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{HostPrefix}{route}/relationships/photos"); value.Links.Related.Should().Be($"{HostPrefix}{route}/photos"); }); @@ -95,7 +95,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -110,13 +110,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -128,13 +128,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -162,7 +162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -173,14 +173,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{photo.Album.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(albumLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -222,13 +222,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{album.Photos.ElementAt(0).StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -256,7 +256,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photos/{photo.StringId}/album"); responseDocument.Links.First.Should().BeNull(); @@ -265,7 +265,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); } @@ -291,7 +291,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().Be($"{HostPrefix}{PathPrefix}/photoAlbums/{album.StringId}/photos"); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -353,7 +353,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -362,8 +362,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Links.Next.Should().BeNull(); responseDocument.Links.DescribedBy.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{responseDocument.Data.SingleValue.Id}"; @@ -371,8 +371,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); @@ -383,13 +383,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(photoLink); resource.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -439,7 +439,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().BeNull(); @@ -450,14 +450,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string photoLink = $"{HostPrefix}{PathPrefix}/photos/{existingPhoto.StringId}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be(photoLink); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("album").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{photoLink}/relationships/album"); value.Links.Related.Should().Be($"{photoLink}/album"); }); @@ -468,13 +468,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string albumLink = $"{HostPrefix}{PathPrefix}/photoAlbums/{existingAlbum.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(albumLink); resource.Relationships.Should().ContainKey("photos").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{albumLink}/relationships/photos"); value.Links.Related.Should().Be($"{albumLink}/photos"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs index d2cff1888b..f160c21068 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ResourceMetaTests.cs @@ -94,7 +94,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Meta.Should().ContainKey("hasHighPriority"); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs index f3f4797bae..a412d64d96 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.Group.cs @@ -39,8 +39,8 @@ public async Task Create_group_sends_messages() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newGroupName); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -51,7 +51,7 @@ public async Task Create_group_sends_messages() messageBroker.SentMessages.Should().HaveCount(1); - Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); var content = messageBroker.SentMessages[0].GetContentAs(); content.GroupId.Should().Be(newGroupId); @@ -117,8 +117,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newGroupName); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -130,7 +130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => messageBroker.SentMessages.Should().HaveCount(3); - Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.GroupId.Should().Be(newGroupId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs index 0c52832658..e8687d9993 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs @@ -41,9 +41,9 @@ public async Task Create_user_sends_messages() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(newDisplayName)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.Should().Be(newLoginName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(newDisplayName); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -54,7 +54,7 @@ public async Task Create_user_sends_messages() messageBroker.SentMessages.Should().HaveCount(1); - Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); var content = messageBroker.SentMessages[0].GetContentAs(); content.UserId.Should().Be(newUserId); @@ -110,9 +110,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.Should().Be(newLoginName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().BeNull(); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -124,7 +124,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => messageBroker.SentMessages.Should().HaveCount(2); - Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); var content1 = messageBroker.SentMessages[0].GetContentAs(); content1.UserId.Should().Be(newUserId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs index 88ab57fa2a..47c5698e38 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.Group.cs @@ -44,8 +44,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newGroupName); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -54,7 +54,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -126,8 +126,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroupName)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newGroupName); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -137,7 +137,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainGroup), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs index 1c1eaf9358..006ba19764 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs @@ -46,9 +46,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(newDisplayName)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.Should().Be(newLoginName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(newDisplayName); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -57,7 +57,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -119,9 +119,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.With(value => value.Should().Be(newLoginName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("loginName").WhoseValue.Should().Be(newLoginName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().BeNull(); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => (typeof(DomainUser), ResourceDefinitionExtensibilityPoints.OnWriteSucceededAsync) }, options => options.WithStrictOrdering()); - Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newUserId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs index 4fa2e50eb9..cca888a7a1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/MultiTenancyTests.cs @@ -306,11 +306,11 @@ public async Task Can_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("url").WhoseValue.Should().Be(newShopUrl); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeNull(); - int newShopId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newShopId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1008,7 +1008,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().BeNull(); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); @@ -1022,13 +1022,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string shopLink = $"/nld/shops/{shop.StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(shopLink); resource.Relationships.Should().ContainKey("products").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{shopLink}/relationships/products"); value.Links.Related.Should().Be($"{shopLink}/products"); }); @@ -1040,13 +1040,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { string productLink = $"/nld/products/{shop.Products[0].StringId}"; - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be(productLink); resource.Relationships.Should().ContainKey("shop").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{productLink}/relationships/shop"); value.Links.Related.Should().Be($"{productLink}/shop"); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs index 3e69a7197a..afa1bdfcd0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs @@ -42,19 +42,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "swimming-pools"); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.Should().ContainKey("is-indoor").WhoseValue != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("water-slides").WhoseValue != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("diving-boards").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Type == "swimming-pools"); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey2("is-indoor").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.Should().ContainKey2("water-slides").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.Should().ContainKey2("diving-boards").WhoseValue != null); decimal height = pools[1].DivingBoards[0].HeightInMeters; + string link = $"/public-api/diving-boards/{pools[1].DivingBoards[0].StringId}"; responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("diving-boards"); responseDocument.Included[0].Id.Should().Be(pools[1].DivingBoards[0].StringId); responseDocument.Included[0].Attributes.Should().ContainKey("height-in-meters").WhoseValue.As().Should().BeApproximately(height); responseDocument.Included[0].Relationships.Should().BeNull(); - responseDocument.Included[0].Links.ShouldNotBeNull().Self.Should().Be($"/public-api/diving-boards/{pools[1].DivingBoards[0].StringId}"); + responseDocument.Included[0].Links.RefShould().NotBeNull().And.Subject.Self.Should().Be(link); responseDocument.Meta.Should().ContainTotal(2); } @@ -115,25 +116,25 @@ public async Task Can_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("swimming-pools"); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("is-indoor").WhoseValue.Should().Be(newPool.IsIndoor); - int newPoolId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newPoolId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); string poolLink = $"{route}/{newPoolId}"; responseDocument.Data.SingleValue.Relationships.Should().ContainKey("water-slides").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{poolLink}/relationships/water-slides"); value.Links.Related.Should().Be($"{poolLink}/water-slides"); }); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("diving-boards").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{poolLink}/relationships/diving-boards"); value.Links.Related.Should().Be($"{poolLink}/diving-boards"); }); @@ -207,7 +208,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("The field HeightInMeters must be between 1 and 20."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/height-in-meters"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs index 3498e72eaa..1b630cdc92 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs @@ -43,19 +43,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Type == "SwimmingPools"); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Attributes.Should().ContainKey("IsIndoor").WhoseValue != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("WaterSlides").WhoseValue != null); - responseDocument.Data.ManyValue.Should().OnlyContain(resourceObject => resourceObject.Relationships.Should().ContainKey("DivingBoards").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Type == "SwimmingPools"); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey2("IsIndoor").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.Should().ContainKey2("WaterSlides").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.Should().ContainKey2("DivingBoards").WhoseValue != null); decimal height = pools[1].DivingBoards[0].HeightInMeters; + string link = $"/PublicApi/DivingBoards/{pools[1].DivingBoards[0].StringId}"; responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Type.Should().Be("DivingBoards"); responseDocument.Included[0].Id.Should().Be(pools[1].DivingBoards[0].StringId); responseDocument.Included[0].Attributes.Should().ContainKey("HeightInMeters").WhoseValue.As().Should().BeApproximately(height); responseDocument.Included[0].Relationships.Should().BeNull(); - responseDocument.Included[0].Links.ShouldNotBeNull().Self.Should().Be($"/PublicApi/DivingBoards/{pools[1].DivingBoards[0].StringId}"); + responseDocument.Included[0].Links.RefShould().NotBeNull().And.Subject.Self.Should().Be(link); responseDocument.Meta.Should().ContainKey("Total").WhoseValue.With(value => { @@ -119,25 +120,25 @@ public async Task Can_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("SwimmingPools"); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("IsIndoor").WhoseValue.Should().Be(newPool.IsIndoor); - int newPoolId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newPoolId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); string poolLink = $"{route}/{newPoolId}"; responseDocument.Data.SingleValue.Relationships.Should().ContainKey("WaterSlides").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{poolLink}/relationships/WaterSlides"); value.Links.Related.Should().Be($"{poolLink}/WaterSlides"); }); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("DivingBoards").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"{poolLink}/relationships/DivingBoards"); value.Links.Related.Should().Be($"{poolLink}/DivingBoards"); }); @@ -211,7 +212,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("The field HeightInMeters must be between 1 and 20."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/HeightInMeters"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/NonJsonApiControllers/NonJsonApiControllerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/NonJsonApiControllers/NonJsonApiControllerTests.cs index bd5029736b..7c0c50cfc6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/NonJsonApiControllers/NonJsonApiControllerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/NonJsonApiControllers/NonJsonApiControllerTests.cs @@ -31,7 +31,7 @@ public async Task Get_skips_middleware_and_formatters() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be("application/json; charset=utf-8"); string responseText = await httpResponse.Content.ReadAsStringAsync(); @@ -60,7 +60,7 @@ public async Task Post_skips_middleware_and_formatters() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be("text/plain; charset=utf-8"); string responseText = await httpResponse.Content.ReadAsStringAsync(); @@ -81,7 +81,7 @@ public async Task Post_skips_error_handler() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be("text/plain; charset=utf-8"); string responseText = await httpResponse.Content.ReadAsStringAsync(); @@ -110,7 +110,7 @@ public async Task Put_skips_middleware_and_formatters() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be("text/plain; charset=utf-8"); string responseText = await httpResponse.Content.ReadAsStringAsync(); @@ -131,7 +131,7 @@ public async Task Patch_skips_middleware_and_formatters() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be("text/plain; charset=utf-8"); string responseText = await httpResponse.Content.ReadAsStringAsync(); @@ -152,7 +152,7 @@ public async Task Delete_skips_middleware_and_formatters() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be("text/plain; charset=utf-8"); string responseText = await httpResponse.Content.ReadAsStringAsync(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs index 062517f564..05265f3e46 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/IsUpperCase/IsUpperCaseFilterParseTests.cs @@ -57,7 +57,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs index 7000ae1da8..92c104f5a4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthFilterParseTests.cs @@ -57,7 +57,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs index 58257e837c..9e55ecb901 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/StringLength/LengthSortParseTests.cs @@ -53,7 +53,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs index 0b82a4a6b9..853ac7ac4d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/Sum/SumFilterParseTests.cs @@ -64,7 +64,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs index c05707f627..329af80475 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs @@ -99,7 +99,7 @@ public async Task Cannot_filter_comparison_on_missing_relative_time() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Time offset between quotes expected. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -122,7 +122,7 @@ public async Task Cannot_filter_comparison_on_invalid_relative_time() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Failed to convert '*' of type 'String' to type 'TimeSpan'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -145,7 +145,7 @@ public async Task Cannot_filter_comparison_on_relative_time_at_left_side() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"The 'timeOffset' function can only be used at the right side of comparisons. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -168,7 +168,7 @@ public async Task Cannot_filter_any_on_relative_time() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Value between quotes expected. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -191,7 +191,7 @@ public async Task Cannot_filter_text_match_on_relative_time() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Attribute of type 'String' expected. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs index 3ff1b7b074..2022505e0d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDataTypeTests.cs @@ -72,7 +72,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.With(value => value.Should().Be(value)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.Should().Be(propertyValue); } [Fact] @@ -100,7 +100,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDecimal").WhoseValue.With(value => value.Should().Be(resource.SomeDecimal)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDecimal").WhoseValue.Should().Be(resource.SomeDecimal); } [Fact] @@ -128,7 +128,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someGuid").WhoseValue.With(value => value.Should().Be(resource.SomeGuid)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someGuid").WhoseValue.Should().Be(resource.SomeGuid); } [Fact] @@ -157,8 +157,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInLocalZone").WhoseValue - .With(value => value.Should().Be(resource.SomeDateTimeInLocalZone)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInLocalZone").WhoseValue.Should().Be(resource.SomeDateTimeInLocalZone); } [Fact] @@ -187,8 +186,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInUtcZone").WhoseValue - .With(value => value.Should().Be(resource.SomeDateTimeInUtcZone)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInUtcZone").WhoseValue.Should().Be(resource.SomeDateTimeInUtcZone); } [Fact] @@ -216,7 +214,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeOffset").WhoseValue.With(value => value.Should().Be(resource.SomeDateTimeOffset)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeOffset").WhoseValue.Should().Be(resource.SomeDateTimeOffset); } [Fact] @@ -244,7 +242,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeSpan").WhoseValue.With(value => value.Should().Be(resource.SomeTimeSpan)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeSpan").WhoseValue.Should().Be(resource.SomeTimeSpan); } [Fact] @@ -272,7 +270,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateOnly").WhoseValue.With(value => value.Should().Be(resource.SomeDateOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateOnly").WhoseValue.Should().Be(resource.SomeDateOnly); } [Fact] @@ -300,7 +298,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeOnly").WhoseValue.With(value => value.Should().Be(resource.SomeTimeOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeOnly").WhoseValue.Should().Be(resource.SomeTimeOnly); } [Fact] @@ -334,7 +332,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Failed to convert 'ABC' of type 'String' to type 'Int32'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -393,7 +391,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.Should().BeNull(); } [Theory] @@ -447,6 +445,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.With(value => value.Should().NotBeNull()); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey(attributeName).WhoseValue.Should().NotBeNull(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs index 84d972efd1..cf8f696929 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs @@ -80,7 +80,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"{CollectionErrorMessage} Failed at position 1: ^filter"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -137,7 +137,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"{CollectionErrorMessage} Failed at position 1: ^filter"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -340,7 +340,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(blog.Owner.Posts[1].StringId); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs index 82e0558411..791c5ad18b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterOperatorTests.cs @@ -84,9 +84,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.With(value => value.Should().Be(resource.SomeString)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.Should().Be(resource.SomeString); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be("http://localhost/filterableResources?filter=equals(someString,'This%2c+that+%26+more+%2b+some')"); responseDocument.Links.First.Should().Be("http://localhost/filterableResources?filter=equals(someString,%27This,%20that%20%26%20more%20%2B%20some%27)"); } @@ -123,8 +123,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("otherInt32").WhoseValue.With(value => value.Should().Be(resource.OtherInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.Should().Be(resource.SomeInt32); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("otherInt32").WhoseValue.Should().Be(resource.OtherInt32); } [Fact] @@ -159,8 +159,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.With(value => value.Should().Be(resource.SomeNullableInt32)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("otherNullableInt32").WhoseValue.With(value => value.Should().Be(resource.OtherNullableInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.Should().Be(resource.SomeNullableInt32); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("otherNullableInt32").WhoseValue.Should().Be(resource.OtherNullableInt32); } [Fact] @@ -195,8 +195,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.With(value => value.Should().Be(resource.SomeNullableInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.Should().Be(resource.SomeInt32); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.Should().Be(resource.SomeNullableInt32); } [Fact] @@ -231,8 +231,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.With(value => value.Should().Be(resource.SomeNullableInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.Should().Be(resource.SomeInt32); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someNullableInt32").WhoseValue.Should().Be(resource.SomeNullableInt32); } [Fact] @@ -267,8 +267,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someUnsignedInt64").WhoseValue.With(value => value.Should().Be(resource.SomeUnsignedInt64)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.Should().Be(resource.SomeInt32); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someUnsignedInt64").WhoseValue.Should().Be(resource.SomeUnsignedInt64); } [Fact] @@ -331,7 +331,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.With(value => value.Should().Be(resource.SomeInt32)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someInt32").WhoseValue.Should().Be(resource.SomeInt32); } [Theory] @@ -373,7 +373,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDouble").WhoseValue.With(value => value.Should().Be(resource.SomeDouble)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDouble").WhoseValue.Should().Be(resource.SomeDouble); } [Theory] @@ -424,8 +424,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInLocalZone").WhoseValue - .With(value => value.Should().Be(resource.SomeDateTimeInLocalZone)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInLocalZone").WhoseValue.Should().Be(resource.SomeDateTimeInLocalZone); } [Theory] @@ -476,8 +475,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInUtcZone").WhoseValue - .With(value => value.Should().Be(resource.SomeDateTimeInUtcZone)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeInUtcZone").WhoseValue.Should().Be(resource.SomeDateTimeInUtcZone); } [Theory] @@ -528,7 +526,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeOffset").WhoseValue.With(value => value.Should().Be(resource.SomeDateTimeOffset)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateTimeOffset").WhoseValue.Should().Be(resource.SomeDateTimeOffset); } [Theory] @@ -569,7 +567,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeSpan").WhoseValue.With(value => value.Should().Be(resource.SomeTimeSpan)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeSpan").WhoseValue.Should().Be(resource.SomeTimeSpan); } [Theory] @@ -618,7 +616,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateOnly").WhoseValue.With(value => value.Should().Be(resource.SomeDateOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someDateOnly").WhoseValue.Should().Be(resource.SomeDateOnly); } [Theory] @@ -659,7 +657,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeOnly").WhoseValue.With(value => value.Should().Be(resource.SomeTimeOnly)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someTimeOnly").WhoseValue.Should().Be(resource.SomeTimeOnly); } [Theory] @@ -697,7 +695,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.With(value => value.Should().Be(resource.SomeString)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.Should().Be(resource.SomeString); } [Fact] @@ -719,7 +717,7 @@ public async Task Cannot_filter_text_match_on_non_string_value() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Attribute of type 'String' expected. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -742,7 +740,7 @@ public async Task Cannot_filter_text_match_on_nested_non_string_value() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Attribute of type 'String' expected. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -779,7 +777,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); responseDocument.Data.ManyValue.Should().HaveCount(1); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.With(value => value.Should().Be(resource.SomeString)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("someString").WhoseValue.Should().Be(resource.SomeString); } [Fact] @@ -948,7 +946,7 @@ public async Task Cannot_filter_on_count_with_incompatible_value() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Failed to convert 'ABC' of type 'String' to type 'Int32'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs index 91b56df83c..2f6c468f08 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterTests.cs @@ -43,7 +43,7 @@ public async Task Cannot_filter_in_unknown_scope() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Field '{Unknown.Relationship}' does not exist on resource type 'webAccounts'. {parameterName}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName.Text); } @@ -66,7 +66,7 @@ public async Task Cannot_filter_in_unknown_nested_scope() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Field '{Unknown.Relationship}' does not exist on resource type 'blogPosts'. {parameterName}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName.Text); } @@ -89,7 +89,7 @@ public async Task Cannot_filter_on_attribute_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Filtering on attribute 'dateOfBirth' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -112,7 +112,7 @@ public async Task Cannot_filter_on_ToMany_relationship_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"Filtering on relationship 'appointments' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("filter"); } @@ -139,6 +139,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(accounts[0].StringId); - responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("userName").WhoseValue.With(value => value.Should().Be(accounts[0].UserName)); + responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("userName").WhoseValue.Should().Be(accounts[0].UserName); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs index 4ec5b8115b..3038ae9817 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Includes/IncludeTests.cs @@ -80,7 +80,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); @@ -112,7 +112,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(blog.Owner.DisplayName); @@ -176,7 +176,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Text); @@ -212,7 +212,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); @@ -245,7 +245,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); @@ -310,7 +310,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Text); @@ -353,7 +353,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(blog.Title); @@ -394,7 +394,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(comment.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(comment.Text); @@ -445,12 +445,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); @@ -463,15 +463,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("webAccounts"); value.Data.SingleValue.Id.Should().Be(blog.Posts[0].Author!.StringId); }); responseDocument.Included[0].Relationships.Should().ContainKey("comments").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("comments"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).StringId); @@ -482,15 +482,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("accountPreferences"); value.Data.SingleValue.Id.Should().Be(blog.Posts[0].Author!.Preferences!.StringId); }); responseDocument.Included[1].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); @@ -502,8 +502,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[3].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("webAccounts"); value.Data.SingleValue.Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).Author!.StringId); }); @@ -513,7 +513,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[4].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].Comments.ElementAt(0).Author!.Posts[0].StringId); @@ -521,7 +521,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[4].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); @@ -530,13 +530,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[5].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); responseDocument.Included[5].Relationships.Should().ContainKey("comments").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); @@ -545,7 +545,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[5].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); } @@ -595,16 +595,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("webAccounts"); value.Data.SingleValue.Id.Should().Be(author.StringId); }); responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("reviewer").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("webAccounts"); value.Data.SingleValue.Id.Should().Be(reviewer.StringId); }); @@ -614,16 +614,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("webAccounts"); value.Data.SingleValue.Id.Should().Be(person.StringId); }); responseDocument.Data.ManyValue[1].Relationships.Should().ContainKey("reviewer").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("webAccounts"); value.Data.SingleValue.Id.Should().Be(person.StringId); }); @@ -635,15 +635,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("accountPreferences"); value.Data.SingleValue.Id.Should().Be(author.Preferences.StringId); }); responseDocument.Included[0].Relationships.Should().ContainKey("loginAttempts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); @@ -655,13 +655,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[2].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); }); responseDocument.Included[2].Relationships.Should().ContainKey("loginAttempts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("loginAttempts"); value.Data.ManyValue[0].Id.Should().Be(reviewer.LoginAttempts[0].StringId); @@ -675,15 +675,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[4].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("accountPreferences"); value.Data.SingleValue.Id.Should().Be(person.Preferences.StringId); }); responseDocument.Included[4].Relationships.Should().ContainKey("loginAttempts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("loginAttempts"); value.Data.ManyValue[0].Id.Should().Be(person.LoginAttempts[0].StringId); @@ -720,13 +720,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); @@ -739,8 +739,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("webAccounts"); value.Data.SingleValue.Id.Should().Be(blog.Posts[0].Author!.StringId); }); @@ -750,7 +750,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().NotBeEmpty(); value.Data.ManyValue[0].Type.Should().Be("blogPosts"); value.Data.ManyValue[0].Id.Should().Be(blog.Posts[0].StringId); @@ -781,7 +781,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); @@ -844,7 +844,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().BeEmpty(); } @@ -868,7 +868,7 @@ public async Task Cannot_include_unknown_relationship() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified include is invalid."); error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'webAccounts'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("include"); } @@ -891,7 +891,7 @@ public async Task Cannot_include_unknown_nested_relationship() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified include is invalid."); error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'blogPosts'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("include"); } @@ -914,7 +914,7 @@ public async Task Cannot_include_relationship_when_inclusion_blocked() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified include is invalid."); error.Detail.Should().Be($"Including the relationship 'parent' on 'blogPosts' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("include"); } @@ -937,7 +937,7 @@ public async Task Cannot_include_relationship_when_nested_inclusion_blocked() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified include is invalid."); error.Detail.Should().Be($"Including the relationship 'parent' on 'blogPosts' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("include"); } @@ -962,7 +962,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("calendars"); responseDocument.Data.SingleValue.Id.Should().Be(calendar.StringId); @@ -1001,14 +1001,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("calendars"); responseDocument.Data.SingleValue.Id.Should().Be(calendar.StringId); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("mostRecentAppointment").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("appointments"); value.Data.SingleValue.Id.Should().Be(calendar.MostRecentAppointment.StringId); }); @@ -1044,7 +1044,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(2); - responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.Should().ContainKey("reviewer").WhoseValue != null); + responseDocument.Data.ManyValue.Should().OnlyContain(resource => resource.Relationships.Should().ContainKey2("reviewer").WhoseValue != null); ResourceObject[] postWithReviewer = responseDocument.Data.ManyValue .Where(resource => resource.Relationships!.First(pair => pair.Key == "reviewer").Value!.Data.SingleValue != null).ToArray(); @@ -1110,7 +1110,7 @@ public async Task Cannot_exceed_configured_maximum_inclusion_depth() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified include is invalid."); error.Detail.Should().Be($"Including 'posts.comments' exceeds the maximum inclusion depth of 1. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("include"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs index c80c2e260e..64255c0b54 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs @@ -57,7 +57,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(posts[1].StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogPosts?page%5Bsize%5D=1"); responseDocument.Links.Last.Should().Be($"{HostPrefix}/blogPosts?page%5Bnumber%5D=2&page%5Bsize%5D=1"); @@ -91,7 +91,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"{CollectionErrorMessage} Failed at position 1: ^page[number]"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -122,7 +122,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[2].StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogs/{blog.StringId}/posts?page%5Bsize%5D=1"); responseDocument.Links.Last.Should().Be($"{HostPrefix}/blogs/{blog.StringId}/posts?page%5Bnumber%5D=5&page%5Bsize%5D=1"); @@ -154,7 +154,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(account.LoginAttempts[1].StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/webAccounts/{account.StringId}/loginAttempts?page%5Bsize%5D=1"); responseDocument.Links.Last.Should().BeNull(); @@ -188,7 +188,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"{CollectionErrorMessage} Failed at position 1: ^page[size]"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[size]"); } @@ -221,7 +221,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Id.Should().Be(blogs[0].Posts[1].StringId); responseDocument.Included[1].Id.Should().Be(blogs[1].Posts[1].StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogs?include=posts&page%5Bsize%5D=2,posts%3A1"); responseDocument.Links.Last.Should().Be($"{HostPrefix}/blogs?include=posts&page%5Bnumber%5D=2&page%5Bsize%5D=2,posts%3A1"); @@ -251,11 +251,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Id.Should().Be(blog.Owner.Posts[1].StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().BeNull(); responseDocument.Links.Last.Should().BeNull(); @@ -287,7 +287,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(blog.Posts[1].StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogs/{blog.StringId}/relationships/posts?page%5Bsize%5D=1"); responseDocument.Links.Last.Should().Be($"{HostPrefix}/blogs/{blog.StringId}/relationships/posts?page%5Bnumber%5D=4&page%5Bsize%5D=1"); @@ -321,7 +321,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string basePath = $"{HostPrefix}/webAccounts/{account.StringId}/relationships/loginAttempts"; - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{basePath}?page%5Bsize%5D=1"); responseDocument.Links.Last.Should().BeNull(); @@ -358,7 +358,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Id.Should().Be(posts[0].Labels.ElementAt(1).StringId); responseDocument.Included[1].Id.Should().Be(posts[1].Labels.ElementAt(1).StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogPosts?include=labels&page%5Bsize%5D=labels%3A1"); responseDocument.Links.Last.Should().Be(responseDocument.Links.First); @@ -391,7 +391,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(1); responseDocument.Data.ManyValue[0].Id.Should().Be(post.Labels.ElementAt(1).StringId); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogPosts/{post.StringId}/relationships/labels?page%5Bsize%5D=1"); responseDocument.Links.Last.Should().Be($"{HostPrefix}/blogPosts/{post.StringId}/relationships/labels?page%5Bnumber%5D=4&page%5Bsize%5D=1"); @@ -440,7 +440,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => const string linkPrefix = $"{HostPrefix}/blogs?include=owner.posts.comments"; - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{linkPrefix}&page%5Bsize%5D=1,owner.posts%3A1,owner.posts.comments%3A1"); responseDocument.Links.Last.Should().Be($"{linkPrefix}&page%5Bsize%5D=1,owner.posts%3A1,owner.posts.comments%3A1&page%5Bnumber%5D=2"); @@ -467,7 +467,7 @@ public async Task Cannot_paginate_in_unknown_scope() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Field '{Unknown.Relationship}' does not exist on resource type 'webAccounts'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -490,7 +490,7 @@ public async Task Cannot_paginate_in_unknown_nested_scope() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Field '{Unknown.Relationship}' does not exist on resource type 'blogPosts'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[size]"); } @@ -525,7 +525,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().HaveCount(4); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be(responseDocument.Links.Self); responseDocument.Links.Last.Should().Be($"{responseDocument.Links.Self}&page%5Bnumber%5D=2"); @@ -559,7 +559,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(25); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().BeNull(); responseDocument.Links.Last.Should().BeNull(); @@ -603,8 +603,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.ShouldNotBeNull(); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Should().NotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); if (firstLink != null) diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs index 57bd6e508b..1bcfb0c6f5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithoutTotalCountTests.cs @@ -44,7 +44,7 @@ public async Task Hides_pagination_links_when_unconstrained_page_size() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().BeNull(); responseDocument.Links.Last.Should().BeNull(); @@ -73,7 +73,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogPosts?page%5Bsize%5D=8&foo=bar"); responseDocument.Links.Last.Should().BeNull(); @@ -99,7 +99,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogPosts?foo=bar"); responseDocument.Links.Last.Should().BeNull(); @@ -130,7 +130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCountLessThan(DefaultPageSize); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogPosts?foo=bar"); responseDocument.Links.Last.Should().BeNull(); @@ -161,7 +161,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(DefaultPageSize); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/blogPosts?foo=bar"); responseDocument.Links.Last.Should().BeNull(); @@ -192,7 +192,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue.Should().HaveCount(DefaultPageSize); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be($"{HostPrefix}{route}"); responseDocument.Links.First.Should().Be($"{HostPrefix}/webAccounts/{account.StringId}/posts?foo=bar"); responseDocument.Links.Last.Should().BeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs index f921ac29b1..687bffdc19 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs @@ -45,7 +45,7 @@ public async Task Cannot_use_negative_page_number() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Page number cannot be negative or zero. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -68,7 +68,7 @@ public async Task Cannot_use_zero_page_number() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Page number cannot be negative or zero. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -128,7 +128,7 @@ public async Task Cannot_use_negative_page_size() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Page size cannot be negative. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[size]"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs index 5ed5105ba1..18141b6758 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs @@ -74,7 +74,7 @@ public async Task Cannot_use_page_number_over_maximum() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Page number cannot be higher than {MaximumPageNumber}. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -97,7 +97,7 @@ public async Task Cannot_use_zero_page_size() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Page size cannot be unconstrained. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[size]"); } @@ -149,7 +149,7 @@ public async Task Cannot_use_page_size_over_maximum() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"Page size cannot be higher than {MaximumPageSize}. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[size]"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs index a0044f6b3a..8bc14467cd 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/QueryStringTests.cs @@ -43,7 +43,7 @@ public async Task Cannot_use_unknown_query_string_parameter() error.Detail.Should().Be("Query string parameter 'foo' is unknown. " + "Set 'AllowUnknownQueryStringParameters' to 'true' in options to ignore unknown parameters."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("foo"); } @@ -106,7 +106,7 @@ public async Task Cannot_use_empty_query_string_parameter_value(string parameter error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Missing query string parameter value."); error.Detail.Should().Be($"Missing value for '{parameterName}' query string parameter."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs index f5787f6363..7fa5aa7fcb 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SerializerIgnoreConditionTests.cs @@ -53,7 +53,7 @@ await RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(1); if (expectNullValueInDocument) diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs index 9041fbaaa2..45cd010379 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs @@ -79,7 +79,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"{CollectionErrorMessage} Failed at position 1: ^sort"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("sort"); } @@ -139,7 +139,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"{CollectionErrorMessage} Failed at position 1: ^sort"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("sort"); } @@ -223,7 +223,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); responseDocument.Included.Should().HaveCount(3); @@ -257,7 +257,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); responseDocument.Included.Should().HaveCount(3); @@ -290,7 +290,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Included.Should().HaveCount(3); @@ -469,7 +469,7 @@ public async Task Cannot_sort_in_unknown_scope() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"Field '{Unknown.Relationship}' does not exist on resource type 'webAccounts'. {parameterName}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName.Text); } @@ -492,7 +492,7 @@ public async Task Cannot_sort_in_unknown_nested_scope() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"Field '{Unknown.Relationship}' does not exist on resource type 'blogPosts'. {parameterName}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName.Text); } @@ -515,7 +515,7 @@ public async Task Cannot_sort_on_attribute_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"Sorting on attribute 'dateOfBirth' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("sort"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs index 71a5d712a3..088c6cc7bf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs @@ -64,11 +64,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; @@ -142,11 +142,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; @@ -186,11 +186,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("labels").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var blogCaptured = (Blog)store.Resources.Should().ContainSingle(resource => resource is Blog).Which; @@ -225,7 +225,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("url").WhoseValue.Should().Be(post.Url); @@ -233,11 +233,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; @@ -269,19 +269,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Id.Should().Be(post.Author.StringId); - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Included.Should().HaveCount(1); @@ -292,18 +292,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.Should().ContainKey("preferences").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; postCaptured.Id.Should().Be(post.Id); postCaptured.Caption.Should().Be(post.Caption); - postCaptured.Author.ShouldNotBeNull(); + postCaptured.Author.Should().NotBeNull(); postCaptured.Author.DisplayName.Should().Be(post.Author.DisplayName); postCaptured.Author.EmailAddress.Should().Be(post.Author.EmailAddress); postCaptured.Author.UserName.Should().BeNull(); @@ -333,18 +333,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(account.DisplayName); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(account.Posts[0].StringId); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Included.Should().HaveCount(1); @@ -354,11 +354,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.Should().ContainKey("labels").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var accountCaptured = (WebAccount)store.Resources.Should().ContainSingle(resource => resource is WebAccount).Which; @@ -395,18 +395,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(blog.Owner.DisplayName); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(blog.Owner.Posts[0].StringId); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Included.Should().HaveCount(1); @@ -416,16 +416,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.Should().ContainKey("comments").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var blogCaptured = (Blog)store.Resources.Should().ContainSingle(resource => resource is Blog).Which; blogCaptured.Id.Should().Be(blog.Id); - blogCaptured.Owner.ShouldNotBeNull(); + blogCaptured.Owner.Should().NotBeNull(); blogCaptured.Owner.DisplayName.Should().Be(blog.Owner.DisplayName); blogCaptured.Owner.Posts.Should().HaveCount(1); @@ -457,18 +457,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("labels").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(post.Labels.ElementAt(0).StringId); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Included.Should().HaveCount(1); @@ -510,7 +510,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); @@ -571,7 +571,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("blogs"); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); @@ -580,12 +580,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("owner").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Id.Should().Be(blog.Owner.StringId); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Included.Should().HaveCount(2); @@ -598,12 +598,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Relationships.Should().ContainKey("posts").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(blog.Owner.Posts[0].StringId); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); responseDocument.Included[1].Type.Should().Be("blogPosts"); @@ -613,11 +613,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Relationships.Should().ContainKey("labels").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var blogCaptured = (Blog)store.Resources.Should().ContainSingle(resource => resource is Blog).Which; @@ -715,7 +715,7 @@ public async Task Cannot_select_on_unknown_resource_type() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified fieldset is invalid."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist. {parameterName}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName.Text); } @@ -740,7 +740,7 @@ public async Task Cannot_select_attribute_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified fieldset is invalid."); error.Detail.Should().Be($"Retrieving the attribute 'password' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("fields[webAccounts]"); } @@ -765,7 +765,7 @@ public async Task Cannot_select_ToOne_relationship_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified fieldset is invalid."); error.Detail.Should().Be($"Retrieving the relationship 'person' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("fields[webAccounts]"); } @@ -790,7 +790,7 @@ public async Task Cannot_select_ToMany_relationship_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified fieldset is invalid."); error.Detail.Should().Be($"Retrieving the relationship 'appointments' is not allowed. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("fields[calendars]"); } @@ -818,7 +818,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(blog.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("showAdvertisements").WhoseValue.Should().Be(blog.ShowAdvertisements); @@ -853,7 +853,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(post.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("caption").WhoseValue.Should().Be(post.Caption); @@ -862,11 +862,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("author").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.Value.Should().BeNull(); - value.Links.ShouldNotBeNull(); - value.Links.Self.ShouldNotBeNull(); - value.Links.Related.ShouldNotBeNull(); + value.Links.Should().NotBeNull(); + value.Links.Self.Should().NotBeNull(); + value.Links.Related.Should().NotBeNull(); }); var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).Which; @@ -896,11 +896,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(account.StringId); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); responseDocument.Included.Should().HaveCount(2); - responseDocument.Included.Should().OnlyContain(resourceObject => resourceObject.Type == "blogPosts"); + responseDocument.Included.Should().OnlyContain(resource => resource.Type == "blogPosts"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs index 63af6ee8cf..de1623fb12 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs @@ -57,15 +57,15 @@ public async Task Sets_location_header_for_created_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - string newWorkItemId = responseDocument.Data.SingleValue.ShouldNotBeNull().Id.ShouldNotBeNull(); + string newWorkItemId = responseDocument.Data.SingleValue.RefShould().NotBeNull().And.Subject.Id.Should().NotBeNull().And.Subject; httpResponse.Headers.Location.Should().Be($"http://localhost/workItems/{newWorkItemId}"); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be("http://localhost/workItems/"); responseDocument.Links.First.Should().BeNull(); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"{httpResponse.Headers.Location}"); } @@ -96,13 +96,13 @@ public async Task Can_create_resource_with_int_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newWorkItem.Description)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(newWorkItem.DueAt)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newWorkItem.Description); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().Be(newWorkItem.DueAt); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -113,7 +113,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(WorkItem).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -144,13 +144,13 @@ public async Task Can_create_resource_with_long_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("userAccounts"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(newUserAccount.FirstName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(newUserAccount.LastName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(newUserAccount.FirstName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(newUserAccount.LastName); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - long newUserAccountId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newUserAccountId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -161,7 +161,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(UserAccount).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -191,12 +191,12 @@ public async Task Can_create_resource_with_guid_ID() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(newGroup.Name)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(newGroup.Name); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + Guid newGroupId = Guid.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -206,7 +206,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -236,13 +236,13 @@ public async Task Can_create_resource_without_attributes_or_relationships() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().BeNull()); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().BeNull()); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().BeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().BeNull(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -286,9 +286,9 @@ public async Task Cannot_create_resource_with_unknown_attribute() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown attribute found."); error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'workItems'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -321,12 +321,12 @@ public async Task Can_create_resource_with_unknown_attribute() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newWorkItem.Description)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newWorkItem.Description); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -373,9 +373,9 @@ public async Task Cannot_create_resource_with_unknown_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'workItems'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -412,18 +412,18 @@ public async Task Can_create_resource_with_unknown_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem? workItemInDatabase = await dbContext.WorkItems.FirstWithIdOrDefaultAsync(newWorkItemId); - workItemInDatabase.ShouldNotBeNull(); + workItemInDatabase.Should().NotBeNull(); }); } @@ -458,9 +458,9 @@ public async Task Cannot_create_resource_with_client_generated_ID() error.StatusCode.Should().Be(HttpStatusCode.Forbidden); error.Title.Should().Be("Failed to deserialize request body: The use of client-generated IDs is disabled."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -477,7 +477,7 @@ public async Task Cannot_create_resource_for_missing_request_body() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -511,7 +511,7 @@ public async Task Cannot_create_resource_for_null_request_body() error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -541,7 +541,7 @@ public async Task Cannot_create_resource_for_missing_data() error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -567,9 +567,9 @@ public async Task Cannot_create_resource_for_null_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -601,9 +601,9 @@ public async Task Cannot_create_resource_for_array_data() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -634,9 +634,9 @@ public async Task Cannot_create_resource_for_missing_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -668,9 +668,9 @@ public async Task Cannot_create_resource_for_unknown_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -726,9 +726,9 @@ public async Task Cannot_create_on_resource_type_mismatch_between_url_and_body() error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'workItems'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -761,9 +761,9 @@ public async Task Cannot_create_resource_with_readonly_attribute() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute is read-only."); error.Detail.Should().Be("Attribute 'isDeprecated' on resource type 'workItemGroups' is read-only."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isDeprecated"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -787,7 +787,7 @@ public async Task Cannot_create_resource_for_broken_JSON_request_body() error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().StartWith("'{' is invalid after a property name."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -820,9 +820,9 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible attribute value found."); error.Detail.Should().Be("Failed to convert attribute 'dueAt' with value 'not-a-valid-time' of type 'String' to type 'Nullable'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/dueAt"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -894,11 +894,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newDescription)); + responseDocument.Data.SingleValue.Should().NotBeNull(); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newDescription); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -916,7 +916,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => workItemInDatabase.Description.Should().Be(newDescription); - workItemInDatabase.Assignee.ShouldNotBeNull(); + workItemInDatabase.Assignee.Should().NotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccounts[0].Id); workItemInDatabase.Subscribers.Should().HaveCount(1); @@ -957,8 +957,8 @@ public async Task Cannot_assign_attribute_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute value cannot be assigned when creating resource."); error.Detail.Should().Be("The attribute 'isImportant' on resource type 'workItems' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isImportant"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs index d7d7353193..5d8e5041c9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs @@ -65,10 +65,10 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ string groupName = $"{newGroup.Name}{ImplicitlyChangingWorkItemGroupDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(newGroup.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(groupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(groupName); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -79,7 +79,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -118,11 +118,11 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_ string groupName = $"{newGroup.Name}{ImplicitlyChangingWorkItemGroupDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(newGroup.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.With(value => value.Should().Be(groupName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(groupName); responseDocument.Data.SingleValue.Relationships.Should().BeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -133,7 +133,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -184,7 +184,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -235,7 +235,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -277,10 +277,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => const string defaultId = AssignIdToRgbColorDefinition.DefaultId; const string defaultName = AssignIdToRgbColorDefinition.DefaultName; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("rgbColors"); responseDocument.Data.SingleValue.Id.Should().Be(defaultId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(defaultName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.Should().Be(defaultName); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => @@ -291,7 +291,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -336,9 +336,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] @@ -379,9 +379,9 @@ public async Task Cannot_create_resource_with_client_generated_zero_guid_ID(Clie error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is invalid."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] @@ -422,9 +422,9 @@ public async Task Cannot_create_resource_with_client_generated_empty_guid_ID(Cli error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is invalid."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] @@ -474,7 +474,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -517,9 +517,9 @@ public async Task Cannot_create_resource_with_client_generated_zero_long_ID(Clie error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is invalid."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] @@ -561,9 +561,9 @@ public async Task Cannot_create_resource_with_client_generated_empty_long_ID(Cli error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is invalid."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Theory] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs index 80441532c4..ef2c3ee216 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToManyRelationshipTests.cs @@ -68,12 +68,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); responseDocument.Included.Should().BeNull(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -132,7 +132,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); @@ -140,11 +140,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().OnlyContain(resource => resource.Type == "userAccounts"); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[1].StringId); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("firstName").WhoseValue != null); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("lastName").WhoseValue != null); - responseDocument.Included.Should().OnlyContain(resource => resource.Relationships.ShouldNotBeNull().Count > 0); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey2("firstName").WhoseValue != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey2("lastName").WhoseValue != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Relationships != null && resource.Relationships.Count > 0); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -203,7 +203,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); @@ -211,11 +211,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().OnlyContain(resource => resource.Type == "userAccounts"); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingUserAccounts[1].StringId); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldNotBeNull().Count == 1); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("firstName").WhoseValue != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes != null && resource.Attributes.Count == 1); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey2("firstName").WhoseValue != null); responseDocument.Included.Should().OnlyContain(resource => resource.Relationships == null); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -285,14 +285,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(newWorkItem.Priority); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("tags").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(3); value.Data.ManyValue[0].Id.Should().Be(existingTags[0].StringId); value.Data.ManyValue[1].Id.Should().Be(existingTags[1].StringId); @@ -304,11 +304,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingTags[0].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingTags[1].StringId); responseDocument.Included.Should().ContainSingle(resource => resource.Id == existingTags[2].StringId); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.ShouldNotBeNull().Count == 1); - responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey("text").WhoseValue != null); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes != null && resource.Attributes.Count == 1); + responseDocument.Included.Should().OnlyContain(resource => resource.Attributes.Should().ContainKey2("text").WhoseValue != null); responseDocument.Included.Should().OnlyContain(resource => resource.Relationships == null); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -360,9 +360,9 @@ public async Task Cannot_create_for_missing_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -405,9 +405,9 @@ public async Task Cannot_create_for_unknown_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -449,9 +449,9 @@ public async Task Cannot_create_for_missing_relationship_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -558,9 +558,9 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'subscribers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -610,7 +610,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); @@ -618,7 +618,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Type.Should().Be("userAccounts"); responseDocument.Included[0].Id.Should().Be(existingUserAccount.StringId); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -661,9 +661,9 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -699,9 +699,9 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -739,9 +739,9 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -787,9 +787,9 @@ public async Task Cannot_create_resource_with_local_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'lid' element is not supported at this endpoint."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/lid"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -832,8 +832,8 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/items"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs index a24fd006ee..362e9ec958 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithToOneRelationshipTests.cs @@ -74,11 +74,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - string newGroupId = responseDocument.Data.SingleValue.Id.ShouldNotBeNull(); + string newGroupId = responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject; await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -86,7 +86,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WorkItemGroup newGroupInDatabase = groupsInDatabase.Single(group => group.StringId == newGroupId); newGroupInDatabase.Name.Should().Be(newGroupName); - newGroupInDatabase.Color.ShouldNotBeNull(); + newGroupInDatabase.Color.Should().NotBeNull(); newGroupInDatabase.Color.Id.Should().Be(existingGroup.Color.Id); WorkItemGroup existingGroupInDatabase = groupsInDatabase.Single(group => group.Id == existingGroup.Id); @@ -150,11 +150,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RgbColor newColorInDatabase = colorsInDatabase.Single(color => color.Id == newColorId); newColorInDatabase.DisplayName.Should().Be(newDisplayName); - newColorInDatabase.Group.ShouldNotBeNull(); + newColorInDatabase.Group.Should().NotBeNull(); newColorInDatabase.Group.Id.Should().Be(existingColor.Group.Id); RgbColor? existingColorInDatabase = colorsInDatabase.SingleOrDefault(color => color.Id == existingColor.Id); - existingColorInDatabase.ShouldNotBeNull(); + existingColorInDatabase.Should().NotBeNull(); existingColorInDatabase.Group.Should().BeNull(); }); } @@ -198,7 +198,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); @@ -209,13 +209,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccount.LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Assignee).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Assignee.ShouldNotBeNull(); + workItemInDatabase.Assignee.Should().NotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccount.Id); }); } @@ -265,15 +265,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(newWorkItem.Description); responseDocument.Data.SingleValue.Relationships.Should().HaveCount(1); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("assignee").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Id.Should().Be(existingUserAccount.StringId); }); @@ -284,7 +284,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccount.LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -292,7 +292,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => workItemInDatabase.Description.Should().Be(newWorkItem.Description); workItemInDatabase.Priority.Should().Be(newWorkItem.Priority); - workItemInDatabase.Assignee.ShouldNotBeNull(); + workItemInDatabase.Assignee.Should().NotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccount.Id); }); } @@ -335,9 +335,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -380,9 +380,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -433,9 +433,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object or 'null', instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -474,9 +474,9 @@ public async Task Cannot_create_for_missing_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -516,9 +516,9 @@ public async Task Cannot_create_for_unknown_relationship_type() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -557,9 +557,9 @@ public async Task Cannot_create_for_missing_relationship_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -642,9 +642,9 @@ public async Task Cannot_create_on_relationship_type_mismatch() error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -696,7 +696,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); @@ -707,13 +707,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(existingUserAccounts[1].LastName); responseDocument.Included[0].Relationships.Should().NotBeEmpty(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Assignee).FirstWithIdAsync(newWorkItemId); - workItemInDatabase.Assignee.ShouldNotBeNull(); + workItemInDatabase.Assignee.Should().NotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccounts[1].Id); }); } @@ -758,9 +758,9 @@ public async Task Cannot_create_resource_with_local_ID() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'lid' element is not supported at this endpoint."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/lid"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -800,8 +800,8 @@ public async Task Cannot_assign_relationship_with_blocked_capability() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/group"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs index 5b942c1904..55f870e6d2 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Deleting/DeleteResourceTests.cs @@ -141,7 +141,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => RgbColor? colorInDatabase = await dbContext.RgbColors.FirstWithIdOrDefaultAsync(existingGroup.Color.Id); - colorInDatabase.ShouldNotBeNull(); + colorInDatabase.Should().NotBeNull(); colorInDatabase.Group.Should().BeNull(); }); } @@ -213,7 +213,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WorkTag? tagInDatabase = await dbContext.WorkTags.FirstWithIdOrDefaultAsync(existingWorkItem.Tags.ElementAt(0).Id); - tagInDatabase.ShouldNotBeNull(); + tagInDatabase.Should().NotBeNull(); }); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs index 9f6ae8fe94..96f3d9a439 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchRelationshipTests.cs @@ -39,7 +39,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("userAccounts"); responseDocument.Data.SingleValue.Id.Should().Be(workItem.Assignee.StringId); responseDocument.Data.SingleValue.Attributes.Should().BeNull(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs index 0f54357f7c..77ec9acbbb 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Fetching/FetchResourceTests.cs @@ -45,16 +45,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItems[0].StringId); item1.Type.Should().Be("workItems"); - item1.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(workItems[0].Description)); - item1.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(workItems[0].DueAt)); - item1.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(workItems[0].Priority)); + item1.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(workItems[0].Description); + item1.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().Be(workItems[0].DueAt); + item1.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(workItems[0].Priority); item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItems[1].StringId); item2.Type.Should().Be("workItems"); - item2.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(workItems[1].Description)); - item2.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(workItems[1].DueAt)); - item2.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(workItems[1].Priority)); + item2.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(workItems[1].Description); + item2.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().Be(workItems[1].DueAt); + item2.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(workItems[1].Priority); item2.Relationships.Should().NotBeEmpty(); } @@ -93,12 +93,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(workItem.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(workItem.Description)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(workItem.DueAt)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(workItem.Priority)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(workItem.Description); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().Be(workItem.DueAt); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(workItem.Priority); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); } @@ -160,11 +160,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("userAccounts"); responseDocument.Data.SingleValue.Id.Should().Be(workItem.Assignee.StringId); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(workItem.Assignee.FirstName)); - responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(workItem.Assignee.LastName)); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(workItem.Assignee.FirstName); + responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(workItem.Assignee.LastName); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); } @@ -216,16 +216,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext => ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == userAccount.AssignedItems.ElementAt(0).StringId); item1.Type.Should().Be("workItems"); - item1.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Description)); - item1.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).DueAt)); - item1.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(0).Priority)); + item1.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(userAccount.AssignedItems.ElementAt(0).Description); + item1.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().Be(userAccount.AssignedItems.ElementAt(0).DueAt); + item1.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(userAccount.AssignedItems.ElementAt(0).Priority); item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == userAccount.AssignedItems.ElementAt(1).StringId); item2.Type.Should().Be("workItems"); - item2.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Description)); - item2.Attributes.Should().ContainKey("dueAt").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).DueAt)); - item2.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(userAccount.AssignedItems.ElementAt(1).Priority)); + item2.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(userAccount.AssignedItems.ElementAt(1).Description); + item2.Attributes.Should().ContainKey("dueAt").WhoseValue.Should().Be(userAccount.AssignedItems.ElementAt(1).DueAt); + item2.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(userAccount.AssignedItems.ElementAt(1).Priority); item2.Relationships.Should().NotBeEmpty(); } @@ -277,14 +277,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => ResourceObject item1 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItem.Tags.ElementAt(0).StringId); item1.Type.Should().Be("workTags"); - item1.Attributes.Should().ContainKey("text").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(0).Text)); - item1.Attributes.Should().ContainKey("isBuiltIn").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(0).IsBuiltIn)); + item1.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(workItem.Tags.ElementAt(0).Text); + item1.Attributes.Should().ContainKey("isBuiltIn").WhoseValue.Should().Be(workItem.Tags.ElementAt(0).IsBuiltIn); item1.Relationships.Should().NotBeEmpty(); ResourceObject item2 = responseDocument.Data.ManyValue.Single(resource => resource.Id == workItem.Tags.ElementAt(1).StringId); item2.Type.Should().Be("workTags"); - item2.Attributes.Should().ContainKey("text").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(1).Text)); - item2.Attributes.Should().ContainKey("isBuiltIn").WhoseValue.With(value => value.Should().Be(workItem.Tags.ElementAt(1).IsBuiltIn)); + item2.Attributes.Should().ContainKey("text").WhoseValue.Should().Be(workItem.Tags.ElementAt(1).Text); + item2.Attributes.Should().ContainKey("isBuiltIn").WhoseValue.Should().Be(workItem.Tags.ElementAt(1).IsBuiltIn); item2.Relationships.Should().NotBeEmpty(); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs index 41081cb01b..e2f3c8933b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/AddToToManyRelationshipTests.cs @@ -58,7 +58,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this endpoint."); error.Detail.Should().Be("Relationship 'assignee' is not a to-many relationship."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -197,7 +197,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -239,7 +239,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -279,9 +279,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -322,9 +322,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -364,9 +364,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -682,9 +682,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -802,7 +802,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -836,9 +836,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -874,9 +874,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1020,6 +1020,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be added to."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be added to."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs index 6af61e1448..c9b948ca34 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/RemoveFromToManyRelationshipTests.cs @@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Only to-many relationships can be targeted through this endpoint."); error.Detail.Should().Be("Relationship 'assignee' is not a to-many relationship."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -309,7 +309,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -351,7 +351,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -392,9 +392,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -435,9 +435,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -477,9 +477,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -795,9 +795,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -917,7 +917,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -951,9 +951,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -989,9 +989,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1138,7 +1138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be removed from."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be removed from."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs index 8c9d3ecae9..7a8c0cfea1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/ReplaceToManyRelationshipTests.cs @@ -226,7 +226,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -268,7 +268,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -308,9 +308,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -351,9 +351,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -393,9 +393,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -708,9 +708,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'userAccounts' is not convertible to type 'workTags' of relationship 'tags'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -795,7 +795,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -829,9 +829,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -867,9 +867,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1099,6 +1099,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs index 69a4316c80..e05fda291f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Relationships/UpdateToOneRelationshipTests.cs @@ -136,7 +136,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => colorInDatabase1.Group.Should().BeNull(); RgbColor colorInDatabase2 = colorsInDatabase.Single(color => color.Id == existingColor.Id); - colorInDatabase2.Group.ShouldNotBeNull(); + colorInDatabase2.Group.Should().NotBeNull(); colorInDatabase2.Group.Id.Should().Be(existingGroup.Id); }); } @@ -182,17 +182,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => groupInDatabase1.Color.Should().BeNull(); WorkItemGroup groupInDatabase2 = groupsInDatabase.Single(group => group.Id == existingGroups[1].Id); - groupInDatabase2.Color.ShouldNotBeNull(); + groupInDatabase2.Color.Should().NotBeNull(); groupInDatabase2.Color.Id.Should().Be(existingGroups[0].Color!.Id); List colorsInDatabase = await dbContext.RgbColors.Include(color => color.Group).ToListAsync(); RgbColor colorInDatabase1 = colorsInDatabase.Single(color => color.Id == existingGroups[0].Color!.Id); - colorInDatabase1.Group.ShouldNotBeNull(); + colorInDatabase1.Group.Should().NotBeNull(); colorInDatabase1.Group.Id.Should().Be(existingGroups[1].Id); RgbColor? colorInDatabase2 = colorsInDatabase.SingleOrDefault(color => color.Id == existingGroups[1].Color!.Id); - colorInDatabase2.ShouldNotBeNull(); + colorInDatabase2.Should().NotBeNull(); colorInDatabase2.Group.Should().BeNull(); }); } @@ -235,7 +235,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WorkItem workItemInDatabase2 = await dbContext.WorkItems.Include(workItem => workItem.Assignee).FirstWithIdAsync(workItemId); - workItemInDatabase2.Assignee.ShouldNotBeNull(); + workItemInDatabase2.Assignee.Should().NotBeNull(); workItemInDatabase2.Assignee.Id.Should().Be(existingUserAccounts[1].Id); }); } @@ -262,7 +262,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -304,7 +304,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -339,7 +339,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -381,9 +381,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object or 'null', instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -420,9 +420,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -460,9 +460,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -499,9 +499,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -733,9 +733,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -812,7 +812,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Parent).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Parent.ShouldNotBeNull(); + workItemInDatabase.Parent.Should().NotBeNull(); workItemInDatabase.Parent.Id.Should().Be(existingWorkItem.Id); }); } @@ -853,6 +853,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty()); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs index 7660963f5c..da33ab6dc5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/ReplaceToManyRelationshipTests.cs @@ -61,7 +61,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -108,7 +108,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -169,7 +169,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -238,7 +238,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -295,7 +295,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.Should().Be(existingWorkItem.Priority); @@ -361,7 +361,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); @@ -370,7 +370,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("tags").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(existingTag.StringId); }); @@ -382,7 +382,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Attributes.Should().ContainKey("text").WhoseValue.Should().Be(existingTag.Text); responseDocument.Included[0].Relationships.Should().BeNull(); - int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newWorkItemId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -441,9 +441,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -495,9 +495,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -548,9 +548,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -695,9 +695,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'subscribers'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers/data[0]/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -751,7 +751,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -803,9 +803,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/subscribers"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -850,9 +850,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -899,9 +899,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an array, instead of an object."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/tags/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -943,7 +943,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -992,7 +992,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1055,7 +1055,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1109,7 +1109,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1181,8 +1181,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'items' on resource type 'workItemGroups' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/items"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs index 3b5b7ea702..ee43e42a0d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs @@ -123,9 +123,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown attribute found."); error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'userAccounts'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -223,9 +223,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown relationship found."); error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'userAccounts'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/doesNotExist"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -310,7 +310,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string groupName = $"{newName}{ImplicitlyChangingWorkItemGroupDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItemGroups"); responseDocument.Data.SingleValue.Id.Should().Be(existingGroup.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(groupName); @@ -326,7 +326,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -374,7 +374,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); - property.ShouldNotBeNull(); + property.Should().NotBeNull(); property.PropertyType.Should().Be(); } @@ -461,7 +461,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string itemDescription = $"{newDescription}{ImplicitlyChangingWorkItemDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(itemDescription); @@ -517,7 +517,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string itemDescription = $"{newDescription}{ImplicitlyChangingWorkItemDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); @@ -574,7 +574,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string itemDescription = $"{newDescription}{ImplicitlyChangingWorkItemDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); @@ -584,7 +584,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("tags").WhoseValue.With(value => { - value.ShouldNotBeNull(); + value.Should().NotBeNull(); value.Data.ManyValue.Should().HaveCount(1); value.Data.ManyValue[0].Id.Should().Be(existingWorkItem.Tags.Single().StringId); }); @@ -636,9 +636,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - responseDocument.Data.SingleValue.Relationships.Values.Should().OnlyContain(value => value.ShouldNotBeNull().Data.Value == null); + responseDocument.Data.SingleValue.Relationships.Values.Should().OnlyContain(value => value != null && value.Data.Value == null); responseDocument.Included.Should().BeNull(); } @@ -664,7 +664,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.BadRequest); - httpResponse.Content.Headers.ContentType.ShouldNotBeNull(); + httpResponse.Content.Headers.ContentType.Should().NotBeNull(); httpResponse.Content.Headers.ContentType.ToString().Should().Be(JsonApiMediaType.Default.ToString()); responseDocument.Errors.Should().HaveCount(1); @@ -706,7 +706,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -744,7 +744,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -778,9 +778,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -821,9 +821,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -860,9 +860,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -900,9 +900,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -939,9 +939,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1044,9 +1044,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'workItems'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1084,9 +1084,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Conflicting 'id' values found."); error.Detail.Should().Be($"Expected '{existingWorkItems[1].StringId}' instead of '{existingWorkItems[0].StringId}'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1128,9 +1128,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute is read-only."); error.Detail.Should().Be("Attribute 'isDeprecated' on resource type 'workItemGroups' is read-only."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isDeprecated"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1162,7 +1162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().StartWith("Expected end of string, but instead reached end of data."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1204,9 +1204,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Resource ID is read-only."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/id"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1248,7 +1248,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.Title.Should().Be("Failed to deserialize request body."); error.Detail.Should().Be($"Failed to convert ID '{existingWorkItem.Id}' of type 'Number' to type 'String'."); error.Source.Should().BeNull(); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1294,9 +1294,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Incompatible attribute value found."); error.Detail.Should().Match("Failed to convert attribute 'dueAt' with value '*start*end*' of type 'Object' to type 'Nullable'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/dueAt"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -1376,7 +1376,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string itemDescription = $"{newDescription}{ImplicitlyChangingWorkItemDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(itemDescription); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); @@ -1396,7 +1396,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => workItemInDatabase.Description.Should().Be(itemDescription); - workItemInDatabase.Assignee.ShouldNotBeNull(); + workItemInDatabase.Assignee.Should().NotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccounts[0].Id); workItemInDatabase.Subscribers.Should().HaveCount(1); @@ -1472,7 +1472,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -1489,7 +1489,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // @formatter:wrap_after_property_in_chained_method_calls restore // @formatter:wrap_chained_method_calls restore - workItemInDatabase.Parent.ShouldNotBeNull(); + workItemInDatabase.Parent.Should().NotBeNull(); workItemInDatabase.Parent.Id.Should().Be(existingWorkItem.Id); workItemInDatabase.Children.Should().HaveCount(1); @@ -1542,8 +1542,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Attribute value cannot be assigned when updating resource."); error.Detail.Should().Be("The attribute 'isImportant' on resource type 'workItems' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/attributes/isImportant"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs index 9dc0907d22..bd0cbd1943 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateToOneRelationshipTests.cs @@ -62,7 +62,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -125,7 +125,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => colorInDatabase1.Group.Should().BeNull(); RgbColor colorInDatabase2 = colorsInDatabase.Single(color => color.Id == existingColor.Id); - colorInDatabase2.Group.ShouldNotBeNull(); + colorInDatabase2.Group.Should().NotBeNull(); colorInDatabase2.Group.Id.Should().Be(existingGroup.Id); }); } @@ -182,17 +182,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext => groupInDatabase1.Color.Should().BeNull(); WorkItemGroup groupInDatabase2 = groupsInDatabase.Single(group => group.Id == existingGroups[1].Id); - groupInDatabase2.Color.ShouldNotBeNull(); + groupInDatabase2.Color.Should().NotBeNull(); groupInDatabase2.Color.Id.Should().Be(existingGroups[0].Color!.Id); List colorsInDatabase = await dbContext.RgbColors.Include(color => color.Group).ToListAsync(); RgbColor colorInDatabase1 = colorsInDatabase.Single(color => color.Id == existingGroups[0].Color!.Id); - colorInDatabase1.Group.ShouldNotBeNull(); + colorInDatabase1.Group.Should().NotBeNull(); colorInDatabase1.Group.Id.Should().Be(existingGroups[1].Id); RgbColor? colorInDatabase2 = colorsInDatabase.SingleOrDefault(color => color.Id == existingGroups[1].Color!.Id); - colorInDatabase2.ShouldNotBeNull(); + colorInDatabase2.Should().NotBeNull(); colorInDatabase2.Group.Should().BeNull(); }); } @@ -285,7 +285,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -293,7 +293,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => WorkItem workItemInDatabase2 = await dbContext.WorkItems.Include(workItem => workItem.Assignee).FirstWithIdAsync(workItemId); - workItemInDatabase2.Assignee.ShouldNotBeNull(); + workItemInDatabase2.Assignee.Should().NotBeNull(); workItemInDatabase2.Assignee.Id.Should().Be(existingUserAccounts[1].Id); }); } @@ -341,7 +341,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string description = $"{existingWorkItem.Description}{ImplicitlyChangingWorkItemDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.Should().Be(description); @@ -358,7 +358,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Assignee).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Assignee.ShouldNotBeNull(); + workItemInDatabase.Assignee.Should().NotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccount.Id); }); } @@ -408,7 +408,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => string description = $"{existingWorkItem.Description}{ImplicitlyChangingWorkItemDefinition.Suffix}"; - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("workItems"); responseDocument.Data.SingleValue.Id.Should().Be(existingWorkItem.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); @@ -417,8 +417,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("assignee").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Id.Should().Be(existingUserAccount.StringId); }); @@ -433,7 +433,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Assignee).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Assignee.ShouldNotBeNull(); + workItemInDatabase.Assignee.Should().NotBeNull(); workItemInDatabase.Assignee.Id.Should().Be(existingUserAccount.Id); }); } @@ -478,9 +478,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object, instead of 'null'."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -525,9 +525,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'data' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -580,9 +580,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Expected an object or 'null', instead of an array."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -630,9 +630,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'type' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -681,9 +681,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Unknown resource type found."); error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -731,9 +731,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -834,9 +834,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'rgbColors' is not convertible to type 'userAccounts' of relationship 'assignee'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/assignee/data/type"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } [Fact] @@ -878,7 +878,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -928,13 +928,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); await _testContext.RunOnDatabaseAsync(async dbContext => { WorkItem workItemInDatabase = await dbContext.WorkItems.Include(workItem => workItem.Parent).FirstWithIdAsync(existingWorkItem.Id); - workItemInDatabase.Parent.ShouldNotBeNull(); + workItemInDatabase.Parent.Should().NotBeNull(); workItemInDatabase.Parent.Id.Should().Be(existingWorkItem.Id); }); } @@ -985,8 +985,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Relationship cannot be assigned."); error.Detail.Should().Be("The relationship 'group' on resource type 'workItems' cannot be assigned to."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/group"); - error.Meta.Should().ContainKey("requestBody").WhoseValue.ShouldNotBeNull().ToString().Should().NotBeEmpty(); + error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty(); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs index 8eb4d23b0e..eab806308e 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/DefaultBehaviorTests.cs @@ -59,14 +59,14 @@ public async Task Cannot_create_dependent_side_of_required_ManyToOne_relationshi error1.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error1.Title.Should().Be("Input validation failed."); error1.Detail.Should().Be("The Customer field is required."); - error1.Source.ShouldNotBeNull(); + error1.Source.Should().NotBeNull(); error1.Source.Pointer.Should().Be("/data/relationships/customer/data"); ErrorObject error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error2.Title.Should().Be("Input validation failed."); error2.Detail.Should().Be("The Shipment field is required."); - error2.Source.ShouldNotBeNull(); + error2.Source.Should().NotBeNull(); error2.Source.Pointer.Should().Be("/data/relationships/shipment/data"); } @@ -102,7 +102,7 @@ public async Task Cannot_create_dependent_side_of_required_OneToOne_relationship error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("The Order field is required."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/order/data"); } @@ -172,7 +172,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => shipmentInDatabase.Should().BeNull(); Customer? customerInDatabase = await dbContext.Customers.FirstWithIdOrDefaultAsync(existingOrder.Customer.Id); - customerInDatabase.ShouldNotBeNull(); + customerInDatabase.Should().NotBeNull(); }); } @@ -220,7 +220,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Input validation failed."); error.Detail.Should().Be("The Customer field is required."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/customer/data"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs index 0ac892c847..02fdf3fc1b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs @@ -55,7 +55,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(certificate.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("issueDate").WhoseValue.Should().Be(certificate.IssueDate); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("hasExpired").WhoseValue.Should().Be(false); @@ -115,7 +115,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(certificate.Issuer.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("isOpen").WhoseValue.Should().Be(true); @@ -169,14 +169,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("issueDate").WhoseValue.Should().Be(newIssueDate); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("hasExpired").WhoseValue.Should().Be(true); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("issuer").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Id.Should().Be(existingOffice.StringId); }); @@ -189,7 +189,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Attributes.Should().ContainKey("isOpen").WhoseValue.Should().Be(false); }); - int newCertificateId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newCertificateId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -198,7 +198,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => certificateInDatabase.IssueDate.Should().Be(newIssueDate); - certificateInDatabase.Issuer.ShouldNotBeNull(); + certificateInDatabase.Issuer.Should().NotBeNull(); certificateInDatabase.Issuer.Id.Should().Be(existingOffice.Id); }); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs index 868b603e8b..64a298555f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs @@ -112,12 +112,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Relationships.Should().ContainKey("isGivenLightBy").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("stars"); value.Data.SingleValue.Id.Should().Be(moon.IsGivenLightBy.StringId); }); @@ -170,7 +170,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(2); @@ -577,11 +577,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("kind").WhoseValue.Should().Be(star.Kind); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeNull(); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -617,7 +617,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(2); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); @@ -658,11 +658,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); responseDocument.Data.SingleValue.Attributes.Should().NotContainKey("isVisibleFromEarth"); - responseDocument.Data.SingleValue.Relationships.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Relationships.Should().NotBeNull(); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] { @@ -698,7 +698,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(star.StringId); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("name").WhoseValue.Should().Be(star.Name); @@ -849,7 +849,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Custom query string parameters cannot be used on nested resource endpoints."); error.Detail.Should().Be("Query string parameter 'isLargerThanTheSun' cannot be used on a nested resource endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("isLargerThanTheSun"); hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs index 6cf6d306db..02d04b03f7 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/ResourceDefinitionSerializationTests.cs @@ -63,7 +63,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(students[0].SocialSecurityNumber); @@ -71,7 +71,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(students[1].SocialSecurityNumber); @@ -116,7 +116,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarships[0].Participants[0].SocialSecurityNumber); @@ -124,7 +124,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarships[0].Participants[1].SocialSecurityNumber); @@ -132,7 +132,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[2].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarships[1].Participants[0].SocialSecurityNumber); @@ -140,7 +140,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[3].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarships[1].Participants[1].SocialSecurityNumber); @@ -178,11 +178,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(student.SocialSecurityNumber); @@ -222,7 +222,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarship.Participants[0].SocialSecurityNumber); @@ -230,7 +230,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarship.Participants[1].SocialSecurityNumber); @@ -267,11 +267,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarship.PrimaryContact.SocialSecurityNumber); @@ -307,13 +307,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(scholarship.PrimaryContact.SocialSecurityNumber); @@ -356,17 +356,17 @@ public async Task Decrypts_on_create_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(newSocialSecurityNumber); }); - int newStudentId = int.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + int newStudentId = int.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -432,13 +432,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(1); responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(existingStudent.SocialSecurityNumber); @@ -488,11 +488,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(newSocialSecurityNumber); @@ -570,13 +570,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Included.Should().HaveCount(2); responseDocument.Included[0].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(existingScholarship.Participants[0].SocialSecurityNumber); @@ -584,7 +584,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Included[1].Attributes.Should().ContainKey("socialSecurityNumber").WhoseValue.With(value => { - string stringValue = value.Should().BeOfType().Subject.ShouldNotBeNull(); + string stringValue = value.Should().BeOfType().Subject.Should().NotBeNull().And.Subject; string socialSecurityNumber = encryptionService.Decrypt(stringValue); socialSecurityNumber.Should().Be(existingScholarship.Participants[2].SocialSecurityNumber); @@ -620,7 +620,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(scholarship.PrimaryContact.StringId); hitCounter.HitExtensibilityPoints.Should().BeEmpty(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs index 44da7fc066..18253c7c7c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/AtomicOperationTests.cs @@ -57,7 +57,7 @@ public async Task When_operation_is_enabled_on_base_type_it_is_implicitly_enable responseDocument.Results.Should().HaveCount(1); - responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => + responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.With(resource => { resource.Type.Should().Be("alwaysMovingTandems"); resource.Attributes.Should().ContainKey("weight").WhoseValue.Should().Be(newMovingTandem.Weight); @@ -66,7 +66,7 @@ public async Task When_operation_is_enabled_on_base_type_it_is_implicitly_enable resource.Relationships.Should().BeNull(); }); - long newMovingTandemId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull()); + long newMovingTandemId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs index 1888a7d972..0e1201bc8f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ChangeTracking/ResourceInheritanceChangeTrackerTests.cs @@ -55,7 +55,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("alwaysMovingTandems"); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("locationToken").WhoseValue.Should().NotBe(existingMovingTandem.LocationToken); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs index dd11f50ac2..04ee189d8a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceReadTests.cs @@ -73,7 +73,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Data.ManyValue.Should().HaveCount(4); @@ -82,7 +82,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(bike.StringId); - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/bikes/{bike.StringId}"); resource.Attributes.Should().HaveCount(3); @@ -94,8 +94,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach ((string name, RelationshipObject? value) in resource.Relationships) { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/bikes/{bike.StringId}/relationships/{name}"); value.Links.Related.Should().Be($"/bikes/{bike.StringId}/{name}"); } @@ -105,7 +105,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(tandem.StringId); - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); resource.Attributes.Should().HaveCount(4); @@ -118,8 +118,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach ((string name, RelationshipObject? value) in resource.Relationships) { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/tandems/{tandem.StringId}/relationships/{name}"); value.Links.Related.Should().Be($"/tandems/{tandem.StringId}/{name}"); } @@ -129,7 +129,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(car.StringId); - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/cars/{car.StringId}"); resource.Attributes.Should().HaveCount(4); @@ -142,8 +142,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach ((string name, RelationshipObject? value) in resource.Relationships) { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/cars/{car.StringId}/relationships/{name}"); value.Links.Related.Should().Be($"/cars/{car.StringId}/{name}"); } @@ -153,7 +153,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(truck.StringId); - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/trucks/{truck.StringId}"); resource.Attributes.Should().HaveCount(4); @@ -166,8 +166,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach ((string name, RelationshipObject? value) in resource.Relationships) { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/trucks/{truck.StringId}/relationships/{name}"); value.Links.Related.Should().Be($"/trucks/{truck.StringId}/{name}"); } @@ -196,7 +196,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Data.ManyValue.Should().HaveCount(2); @@ -205,7 +205,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(bike.StringId); - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/bikes/{bike.StringId}"); resource.Attributes.Should().HaveCount(3); @@ -217,8 +217,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach ((string name, RelationshipObject? value) in resource.Relationships) { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/bikes/{bike.StringId}/relationships/{name}"); value.Links.Related.Should().Be($"/bikes/{bike.StringId}/{name}"); } @@ -228,7 +228,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(tandem.StringId); - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); resource.Attributes.Should().HaveCount(4); @@ -241,8 +241,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach ((string name, RelationshipObject? value) in resource.Relationships) { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/tandems/{tandem.StringId}/relationships/{name}"); value.Links.Related.Should().Be($"/tandems/{tandem.StringId}/{name}"); } @@ -271,7 +271,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Data.ManyValue.Should().HaveCount(1); @@ -280,7 +280,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { resource.Id.Should().Be(tandem.StringId); - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/tandems/{tandem.StringId}"); resource.Attributes.Should().HaveCount(4); @@ -293,8 +293,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach ((string name, RelationshipObject? value) in resource.Relationships) { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/tandems/{tandem.StringId}/relationships/{name}"); value.Links.Related.Should().Be($"/tandems/{tandem.StringId}/{name}"); } @@ -321,11 +321,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.StringId); responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys( + "manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); } [Fact] @@ -348,11 +350,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.StringId); responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys( + "manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); } [Fact] @@ -375,11 +379,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.StringId); responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys( + "manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); } [Fact] @@ -420,11 +426,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("vehicleManufacturers"); responseDocument.Data.SingleValue.Id.Should().Be(manufacturer.StringId); - responseDocument.Included.ShouldNotBeNull(); + responseDocument.Included.Should().NotBeNull(); responseDocument.Included.Where(include => include.Type == "bicycleLights").Should().HaveCount(10); responseDocument.Included.Where(include => include.Type == "genericFeatures").Should().HaveCount(10 * 3); } @@ -450,14 +456,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("gasolineEngines"); responseDocument.Data.SingleValue.Id.Should().Be(car.Engine.StringId); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}"); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(4); @@ -470,8 +476,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("cylinders").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}/relationships/cylinders"); value.Links.Related.Should().Be($"/gasolineEngines/{car.Engine.StringId}/cylinders"); }); @@ -498,10 +504,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("boxes"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.CargoBox.StringId); @@ -536,14 +542,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("gasolineEngines"); responseDocument.Data.SingleValue.Id.Should().Be(car.Engine.StringId); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}"); responseDocument.Data.SingleValue.Attributes.Should().HaveCount(4); @@ -556,8 +562,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.SingleValue.Relationships.Should().ContainKey("cylinders").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/gasolineEngines/{car.Engine.StringId}/relationships/cylinders"); value.Links.Related.Should().Be($"/gasolineEngines/{car.Engine.StringId}/cylinders"); }); @@ -645,7 +651,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Data.ManyValue.Should().HaveCount(4); @@ -657,7 +663,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "chromeWheels")) { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/chromeWheels/{resource.Id}"); resource.Attributes.Should().OnlyContainKeys("radius", "paintColor"); @@ -665,7 +671,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "carbonWheels")) { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/carbonWheels/{resource.Id}"); resource.Attributes.Should().OnlyContainKeys("radius", "hasTube"); @@ -677,8 +683,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Relationships.Should().ContainKey("vehicle").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/{resource.Type}/{resource.Id}/relationships/vehicle"); value.Links.Related.Should().Be($"/{resource.Type}/{resource.Id}/vehicle"); }); @@ -706,7 +712,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Data.ManyValue.Should().HaveCount(4); @@ -725,7 +731,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "chromeWheels")) { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/chromeWheels/{resource.Id}"); resource.Attributes.Should().OnlyContainKeys("radius", "paintColor"); @@ -733,7 +739,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "carbonWheels")) { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/carbonWheels/{resource.Id}"); resource.Attributes.Should().OnlyContainKeys("radius", "hasTube"); @@ -745,8 +751,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Relationships.Should().ContainKey("vehicle").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/{resource.Type}/{resource.Id}/relationships/vehicle"); value.Links.Related.Should().Be($"/{resource.Type}/{resource.Id}/vehicle"); }); @@ -775,7 +781,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Data.ManyValue.Should().HaveCount(4); @@ -787,7 +793,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "chromeWheels")) { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/chromeWheels/{resource.Id}"); resource.Attributes.Should().OnlyContainKeys("radius", "paintColor"); @@ -795,7 +801,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => foreach (ResourceObject resource in responseDocument.Data.ManyValue.Where(value => value.Type == "carbonWheels")) { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be($"/carbonWheels/{resource.Id}"); resource.Attributes.Should().OnlyContainKeys("radius", "hasTube"); @@ -807,8 +813,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => resource.Relationships.Should().ContainKey("vehicle").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Links.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Links.Should().NotBeNull(); value.Links.Self.Should().Be($"/{resource.Type}/{resource.Id}/relationships/vehicle"); value.Links.Related.Should().Be($"/{resource.Type}/{resource.Id}/vehicle"); }); @@ -897,11 +903,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/motorVehicles/{car.StringId}/engine"); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("gasolineEngines"); responseDocument.Data.SingleValue.Id.Should().Be(car.Engine.StringId); responseDocument.Data.SingleValue.Links.Should().BeNull(); @@ -928,11 +934,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/bikes/{tandem.StringId}/cargoBox"); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("boxes"); responseDocument.Data.SingleValue.Id.Should().Be(tandem.CargoBox.StringId); responseDocument.Data.SingleValue.Links.Should().BeNull(); @@ -959,11 +965,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/cars/{car.StringId}/engine"); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("gasolineEngines"); responseDocument.Data.SingleValue.Id.Should().Be(car.Engine.StringId); responseDocument.Data.SingleValue.Links.Should().BeNull(); @@ -1021,7 +1027,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/vehicles/{car.StringId}/wheels"); @@ -1059,7 +1065,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/bikes/{tandem.StringId}/wheels"); @@ -1105,7 +1111,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Links.ShouldNotBeNull(); + responseDocument.Links.Should().NotBeNull(); responseDocument.Links.Self.Should().Be(route); responseDocument.Links.Related.Should().Be($"/cars/{car.StringId}/wheels"); @@ -2463,7 +2469,7 @@ public async Task Cannot_sort_on_ambiguous_derived_attribute() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"Field 'serialCode' is defined on multiple types that derive from resource type 'engines'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("sort"); } @@ -2486,7 +2492,7 @@ public async Task Cannot_sort_on_ambiguous_derived_relationship() error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"Field 'features' is defined on multiple types that derive from resource type 'vehicles'. {parameterValue}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("sort"); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs index c6e3c13d4c..c3a1713947 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceInheritanceWriteTests.cs @@ -103,7 +103,7 @@ public async Task Cannot_create_abstract_resource_at_abstract_endpoint() error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Abstract resource type found."); error.Detail.Should().Be("Resource type 'vehicles' is abstract."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); } @@ -192,12 +192,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("bikes"); responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount"); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights"); - long newBikeId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newBikeId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -219,14 +219,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => bikeInDatabase.RequiresDriverLicense.Should().Be(newBike.RequiresDriverLicense); bikeInDatabase.GearCount.Should().Be(newBike.GearCount); - bikeInDatabase.Manufacturer.ShouldNotBeNull(); + bikeInDatabase.Manufacturer.Should().NotBeNull(); bikeInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); bikeInDatabase.Wheels.Should().HaveCount(1); bikeInDatabase.Wheels.ElementAt(0).Should().BeOfType(); bikeInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); - bikeInDatabase.CargoBox.ShouldNotBeNull(); + bikeInDatabase.CargoBox.Should().NotBeNull(); bikeInDatabase.CargoBox.Id.Should().Be(existingBox.Id); bikeInDatabase.Lights.Should().HaveCount(1); @@ -333,12 +333,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("cars"); responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "licensePlate", "seatCount"); responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "engine", "navigationSystem", "features"); - long newCarId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newCarId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -362,18 +362,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => carInDatabase.LicensePlate.Should().Be(newCar.LicensePlate); carInDatabase.SeatCount.Should().Be(newCar.SeatCount); - carInDatabase.Manufacturer.ShouldNotBeNull(); + carInDatabase.Manufacturer.Should().NotBeNull(); carInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); carInDatabase.Wheels.Should().HaveCount(1); carInDatabase.Wheels.ElementAt(0).Should().BeOfType(); carInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingCarbonWheel.Id); - carInDatabase.Engine.ShouldNotBeNull(); + carInDatabase.Engine.Should().NotBeNull(); carInDatabase.Engine.Should().BeOfType(); carInDatabase.Engine.Id.Should().Be(existingGasolineEngine.Id); - carInDatabase.NavigationSystem.ShouldNotBeNull(); + carInDatabase.NavigationSystem.Should().NotBeNull(); carInDatabase.NavigationSystem.Id.Should().Be(existingNavigationSystem.Id); carInDatabase.Features.Should().HaveCount(1); @@ -483,12 +483,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("tandems"); responseDocument.Data.SingleValue.Attributes.Should().OnlyContainKeys("weight", "requiresDriverLicense", "gearCount", "passengerCount"); - responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); - long newTandemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys( + "manufacturer", "wheels", "cargoBox", "lights", "foldingDimensions", "features"); + + long newTandemId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -512,14 +514,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => tandemInDatabase.GearCount.Should().Be(newTandem.GearCount); tandemInDatabase.PassengerCount.Should().Be(newTandem.PassengerCount); - tandemInDatabase.Manufacturer.ShouldNotBeNull(); + tandemInDatabase.Manufacturer.Should().NotBeNull(); tandemInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); tandemInDatabase.Wheels.Should().HaveCount(1); tandemInDatabase.Wheels.ElementAt(0).Should().BeOfType(); tandemInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); - tandemInDatabase.CargoBox.ShouldNotBeNull(); + tandemInDatabase.CargoBox.Should().NotBeNull(); tandemInDatabase.CargoBox.Id.Should().Be(existingBox.Id); tandemInDatabase.Lights.Should().HaveCount(1); @@ -567,7 +569,7 @@ public async Task Cannot_create_concrete_base_resource_at_concrete_derived_endpo error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'bikes' is not convertible to type 'tandems'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); } @@ -616,7 +618,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Abstract resource type found."); error.Detail.Should().Be("Resource type 'engines' is abstract."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/engine/data/type"); } @@ -661,19 +663,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("carbonWheels"); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - long newCarbonWheelId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newCarbonWheelId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { CarbonWheel carbonWheelInDatabase = await dbContext.CarbonWheels.Include(wheel => wheel.Vehicle).FirstWithIdAsync(newCarbonWheelId); carbonWheelInDatabase.Should().BeOfType(); - carbonWheelInDatabase.Vehicle.ShouldNotBeNull(); + carbonWheelInDatabase.Vehicle.Should().NotBeNull(); carbonWheelInDatabase.Vehicle.Should().BeOfType(); carbonWheelInDatabase.Vehicle.Id.Should().Be(existingTandem.Id); }); @@ -726,12 +728,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.Created); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("vehicleManufacturers"); responseDocument.Data.SingleValue.Attributes.Should().NotBeEmpty(); responseDocument.Data.SingleValue.Relationships.Should().NotBeEmpty(); - long newManufacturerId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull()); + long newManufacturerId = long.Parse(responseDocument.Data.SingleValue.Id.Should().NotBeNull().And.Subject); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -975,7 +977,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Abstract resource type found."); error.Detail.Should().Be("Resource type 'vehicles' is abstract."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); } @@ -1090,14 +1092,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => bikeInDatabase.RequiresDriverLicense.Should().Be(newBike.RequiresDriverLicense); bikeInDatabase.GearCount.Should().Be(newBike.GearCount); - bikeInDatabase.Manufacturer.ShouldNotBeNull(); + bikeInDatabase.Manufacturer.Should().NotBeNull(); bikeInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); bikeInDatabase.Wheels.Should().HaveCount(1); bikeInDatabase.Wheels.ElementAt(0).Should().BeOfType(); bikeInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); - bikeInDatabase.CargoBox.ShouldNotBeNull(); + bikeInDatabase.CargoBox.Should().NotBeNull(); bikeInDatabase.CargoBox.Id.Should().Be(existingBox.Id); bikeInDatabase.Lights.Should().HaveCount(1); @@ -1219,14 +1221,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => tandemInDatabase.RequiresDriverLicense.Should().Be(newBike.RequiresDriverLicense); tandemInDatabase.GearCount.Should().Be(newBike.GearCount); - tandemInDatabase.Manufacturer.ShouldNotBeNull(); + tandemInDatabase.Manufacturer.Should().NotBeNull(); tandemInDatabase.Manufacturer.Id.Should().Be(existingManufacturer.Id); tandemInDatabase.Wheels.Should().HaveCount(1); tandemInDatabase.Wheels.ElementAt(0).Should().BeOfType(); tandemInDatabase.Wheels.ElementAt(0).Id.Should().Be(existingChromeWheel.Id); - tandemInDatabase.CargoBox.ShouldNotBeNull(); + tandemInDatabase.CargoBox.Should().NotBeNull(); tandemInDatabase.CargoBox.Id.Should().Be(existingBox.Id); tandemInDatabase.Lights.Should().HaveCount(1); @@ -1278,7 +1280,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.Conflict); error.Title.Should().Be("Failed to deserialize request body: Incompatible resource type found."); error.Detail.Should().Be("Type 'bikes' is not convertible to type 'tandems'."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/type"); } @@ -1332,7 +1334,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Failed to deserialize request body: Abstract resource type found."); error.Detail.Should().Be("Resource type 'engines' is abstract."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relationships/engine/data/type"); } @@ -1388,7 +1390,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => CarbonWheel carbonWheelInDatabase = await dbContext.CarbonWheels.Include(wheel => wheel.Vehicle).FirstWithIdAsync(existingCarbonWheel.Id); carbonWheelInDatabase.Should().BeOfType(); - carbonWheelInDatabase.Vehicle.ShouldNotBeNull(); + carbonWheelInDatabase.Vehicle.Should().NotBeNull(); carbonWheelInDatabase.Vehicle.Should().BeOfType(); carbonWheelInDatabase.Vehicle.Id.Should().Be(existingTandem.Id); }); @@ -1780,7 +1782,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => wheelInDatabase.Should().BeOfType(); - wheelInDatabase.Vehicle.ShouldNotBeNull(); + wheelInDatabase.Vehicle.Should().NotBeNull(); wheelInDatabase.Vehicle.Should().BeOfType(); wheelInDatabase.Vehicle.Id.Should().Be(existingTandem.Id); }); @@ -1885,7 +1887,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => wheelInDatabase.Should().BeOfType(); - wheelInDatabase.Vehicle.ShouldNotBeNull(); + wheelInDatabase.Vehicle.Should().NotBeNull(); wheelInDatabase.Vehicle.Should().BeOfType(); wheelInDatabase.Vehicle.Id.Should().Be(existingTandem.Id); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs index 1ffba671a6..355b779779 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs @@ -2,7 +2,6 @@ using FluentAssertions; using JsonApiDotNetCore.Middleware; -using TestBuildingBlocks; namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance; @@ -26,8 +25,8 @@ internal void AssertLeftType() LeftDeclaredType.Should().Be(); LeftReflectedTypeName.Should().Be(typeof(TLeft).Name); - Request.ShouldNotBeNull(); - Request.PrimaryResourceType.ShouldNotBeNull(); + Request.Should().NotBeNull(); + Request.PrimaryResourceType.Should().NotBeNull(); Request.PrimaryResourceType.ClrType.Should().Be(); Request.Relationship?.LeftType.ClrType.Should().Be(); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs index 998e86f3e6..5415d79f14 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/DisableQueryStringTests.cs @@ -44,7 +44,7 @@ public async Task Cannot_sort_if_query_string_parameter_is_blocked_by_controller error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'sort' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("sort"); } @@ -66,7 +66,7 @@ public async Task Cannot_paginate_if_query_string_parameter_is_blocked_by_contro error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'page[number]' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -103,7 +103,7 @@ public async Task Cannot_use_custom_query_string_parameter_if_blocked_by_control error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Usage of one or more query string parameters is not allowed at the requested endpoint."); error.Detail.Should().Be("The parameter 'skipCache' cannot be used at this endpoint."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("skipCache"); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs index 071433deff..1b866d8c48 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/ETagTests.cs @@ -41,7 +41,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Headers.ETag.ShouldNotBeNull(); + httpResponse.Headers.ETag.Should().NotBeNull(); httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); httpResponse.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); @@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Headers.ETag.ShouldNotBeNull(); + httpResponse.Headers.ETag.Should().NotBeNull(); httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); httpResponse.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); @@ -169,7 +169,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => error.StatusCode.Should().Be(HttpStatusCode.PreconditionFailed); error.Title.Should().Be("Detection of mid-air edit collisions using ETags is not supported."); error.Detail.Should().BeNull(); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Header.Should().Be("If-Match"); } @@ -200,7 +200,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse2.ShouldHaveStatusCode(HttpStatusCode.NotModified); - httpResponse2.Headers.ETag.ShouldNotBeNull(); + httpResponse2.Headers.ETag.Should().NotBeNull(); httpResponse2.Headers.ETag.IsWeak.Should().BeFalse(); httpResponse2.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); @@ -230,7 +230,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - httpResponse.Headers.ETag.ShouldNotBeNull(); + httpResponse.Headers.ETag.Should().NotBeNull(); httpResponse.Headers.ETag.IsWeak.Should().BeFalse(); httpResponse.Headers.ETag.Tag.Should().NotBeNullOrEmpty(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs index a2eb7e390e..2badb7e252 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs @@ -1002,7 +1002,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Company companyInDatabase = await dbContext.Companies.IgnoreQueryFilters().FirstWithIdAsync(existingCompany.Id); companyInDatabase.Name.Should().Be(existingCompany.Name); - companyInDatabase.SoftDeletedAt.ShouldNotBeNull(); + companyInDatabase.SoftDeletedAt.Should().NotBeNull(); }); } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs index a9c6a7ea04..e836c049bf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/EmptyGuidAsKeyTests.cs @@ -53,7 +53,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].With(resource => { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be("/maps/00000000-0000-0000-0000-000000000000"); }); } @@ -82,9 +82,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("00000000-0000-0000-0000-000000000000"); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be("/maps/00000000-0000-0000-0000-000000000000"); responseDocument.Included.Should().HaveCount(1); @@ -131,7 +131,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Map mapInDatabase = await dbContext.Maps.FirstWithIdAsync((Guid?)Guid.Empty); - mapInDatabase.ShouldNotBeNull(); + mapInDatabase.Should().NotBeNull(); mapInDatabase.Name.Should().Be(newName); }); } @@ -179,7 +179,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Map mapInDatabase = await dbContext.Maps.FirstWithIdAsync((Guid?)Guid.Empty); - mapInDatabase.ShouldNotBeNull(); + mapInDatabase.Should().NotBeNull(); mapInDatabase.Name.Should().Be(newName); }); } @@ -218,7 +218,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActiveMap).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.ActiveMap.Should().BeNull(); }); } @@ -262,8 +262,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActiveMap).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); - gameInDatabase.ActiveMap.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); + gameInDatabase.ActiveMap.Should().NotBeNull(); gameInDatabase.ActiveMap.Id.Should().Be(Guid.Empty); }); } @@ -308,8 +308,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActiveMap).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); - gameInDatabase.ActiveMap.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); + gameInDatabase.ActiveMap.Should().NotBeNull(); gameInDatabase.ActiveMap.Id.Should().Be(Guid.Empty); }); } @@ -348,7 +348,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Maps.Should().BeEmpty(); }); } @@ -395,7 +395,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Maps.Should().HaveCount(1); gameInDatabase.Maps.ElementAt(0).Id.Should().Be(Guid.Empty); }); @@ -444,7 +444,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Maps.Should().HaveCount(1); gameInDatabase.Maps.ElementAt(0).Id.Should().Be(Guid.Empty); }); @@ -493,7 +493,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Maps.Should().HaveCount(2); gameInDatabase.Maps.Should().ContainSingle(map => map.Id == Guid.Empty); }); @@ -540,7 +540,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Maps).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Maps.Should().HaveCount(1); gameInDatabase.Maps.Should().ContainSingle(map => map.Id != Guid.Empty); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs index 5532bf9032..2ed32314e0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/WhiteSpaceAsKeyTests.cs @@ -72,7 +72,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].With(resource => { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be("/players/%20"); }); } @@ -101,9 +101,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be(SingleSpace); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be("/players/%20"); responseDocument.Included.Should().HaveCount(1); @@ -150,7 +150,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.FirstWithIdAsync((string?)SingleSpace); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.EmailAddress.Should().Be(newEmailAddress); }); } @@ -198,7 +198,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.FirstWithIdAsync((string?)SingleSpace); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.EmailAddress.Should().Be(newEmailAddress); }); } @@ -237,7 +237,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Host).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Host.Should().BeNull(); }); } @@ -281,8 +281,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Host).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); - gameInDatabase.Host.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); + gameInDatabase.Host.Should().NotBeNull(); gameInDatabase.Host.Id.Should().Be(SingleSpace); }); } @@ -327,8 +327,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.Host).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); - gameInDatabase.Host.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); + gameInDatabase.Host.Should().NotBeNull(); gameInDatabase.Host.Id.Should().Be(SingleSpace); }); } @@ -367,7 +367,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.ActivePlayers.Should().BeEmpty(); }); } @@ -414,7 +414,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.ActivePlayers.Should().HaveCount(1); gameInDatabase.ActivePlayers.ElementAt(0).Id.Should().Be(SingleSpace); }); @@ -463,7 +463,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.ActivePlayers.Should().HaveCount(1); gameInDatabase.ActivePlayers.ElementAt(0).Id.Should().Be(SingleSpace); }); @@ -512,7 +512,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.ActivePlayers.Should().HaveCount(2); gameInDatabase.ActivePlayers.Should().ContainSingle(player => player.Id == SingleSpace); }); @@ -559,7 +559,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.Include(game => game.ActivePlayers).FirstWithIdAsync(existingGame.Id); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.ActivePlayers.Should().HaveCount(1); gameInDatabase.ActivePlayers.Should().ContainSingle(player => player.Id != SingleSpace); }); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs index 42f92887ba..56b5be0e8c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/ZeroAsKeyTests.cs @@ -53,7 +53,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => responseDocument.Data.ManyValue[0].With(resource => { - resource.Links.ShouldNotBeNull(); + resource.Links.Should().NotBeNull(); resource.Links.Self.Should().Be("/games/0"); }); } @@ -81,9 +81,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("0"); - responseDocument.Data.SingleValue.Links.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Links.Should().NotBeNull(); responseDocument.Data.SingleValue.Links.Self.Should().Be("/games/0"); responseDocument.Included.Should().HaveCount(1); @@ -124,14 +124,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => httpResponse.Headers.Location.Should().Be("/games/0"); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("0"); await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.FirstWithIdAsync((int?)0); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Title.Should().Be(newTitle); }); } @@ -173,7 +173,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("0"); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("title").WhoseValue.Should().Be(newTitle); @@ -181,7 +181,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Game gameInDatabase = await dbContext.Games.FirstWithIdAsync((int?)0); - gameInDatabase.ShouldNotBeNull(); + gameInDatabase.Should().NotBeNull(); gameInDatabase.Title.Should().Be(newTitle); }); } @@ -220,7 +220,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.ActiveGame).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.ActiveGame.Should().BeNull(); }); } @@ -264,8 +264,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.ActiveGame).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); - playerInDatabase.ActiveGame.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); + playerInDatabase.ActiveGame.Should().NotBeNull(); playerInDatabase.ActiveGame.Id.Should().Be(0); }); } @@ -310,8 +310,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.ActiveGame).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); - playerInDatabase.ActiveGame.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); + playerInDatabase.ActiveGame.Should().NotBeNull(); playerInDatabase.ActiveGame.Id.Should().Be(0); }); } @@ -350,7 +350,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.RecentlyPlayed.Should().BeEmpty(); }); } @@ -397,7 +397,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.RecentlyPlayed.Should().HaveCount(1); playerInDatabase.RecentlyPlayed.ElementAt(0).Id.Should().Be(0); }); @@ -446,7 +446,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.RecentlyPlayed.Should().HaveCount(1); playerInDatabase.RecentlyPlayed.ElementAt(0).Id.Should().Be(0); }); @@ -495,7 +495,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.RecentlyPlayed.Should().HaveCount(2); playerInDatabase.RecentlyPlayed.Should().ContainSingle(game => game.Id == 0); }); @@ -542,7 +542,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Player playerInDatabase = await dbContext.Players.Include(player => player.RecentlyPlayed).FirstWithIdAsync(existingPlayer.Id); - playerInDatabase.ShouldNotBeNull(); + playerInDatabase.Should().NotBeNull(); playerInDatabase.RecentlyPlayed.Should().HaveCount(1); playerInDatabase.RecentlyPlayed.Should().ContainSingle(game => game.Id != 0); }); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Links/LinkInclusionTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Links/LinkInclusionTests.cs index 9b8890618a..b6d7c8b618 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Links/LinkInclusionTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Links/LinkInclusionTests.cs @@ -10,7 +10,6 @@ using JsonApiDotNetCore.Serialization.Response; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; -using TestBuildingBlocks; using Xunit; namespace JsonApiDotNetCoreTests.UnitTests.Links; @@ -116,11 +115,11 @@ public void Applies_cascading_settings_for_top_level_links(LinkTypes linksInReso } else { - topLevelLinks.ShouldNotBeNull(); + topLevelLinks.Should().NotBeNull(); if (expected.HasFlag(LinkTypes.Self)) { - topLevelLinks.Self.ShouldNotBeNull(); + topLevelLinks.Self.Should().NotBeNull(); } else { @@ -129,7 +128,7 @@ public void Applies_cascading_settings_for_top_level_links(LinkTypes linksInReso if (expected.HasFlag(LinkTypes.Related)) { - topLevelLinks.Related.ShouldNotBeNull(); + topLevelLinks.Related.Should().NotBeNull(); } else { @@ -138,10 +137,10 @@ public void Applies_cascading_settings_for_top_level_links(LinkTypes linksInReso if (expected.HasFlag(LinkTypes.Pagination)) { - topLevelLinks.First.ShouldNotBeNull(); - topLevelLinks.Last.ShouldNotBeNull(); - topLevelLinks.Prev.ShouldNotBeNull(); - topLevelLinks.Next.ShouldNotBeNull(); + topLevelLinks.First.Should().NotBeNull(); + topLevelLinks.Last.Should().NotBeNull(); + topLevelLinks.Prev.Should().NotBeNull(); + topLevelLinks.Next.Should().NotBeNull(); } else { @@ -198,8 +197,8 @@ public void Applies_cascading_settings_for_resource_links(LinkTypes linksInResou // Assert if (expected == LinkTypes.Self) { - resourceLinks.ShouldNotBeNull(); - resourceLinks.Self.ShouldNotBeNull(); + resourceLinks.Should().NotBeNull(); + resourceLinks.Self.Should().NotBeNull(); } else { @@ -372,11 +371,11 @@ public void Applies_cascading_settings_for_relationship_links(LinkTypes linksInR } else { - relationshipLinks.ShouldNotBeNull(); + relationshipLinks.Should().NotBeNull(); if (expected.HasFlag(LinkTypes.Self)) { - relationshipLinks.Self.ShouldNotBeNull(); + relationshipLinks.Self.Should().NotBeNull(); } else { @@ -385,7 +384,7 @@ public void Applies_cascading_settings_for_relationship_links(LinkTypes linksInR if (expected.HasFlag(LinkTypes.Related)) { - relationshipLinks.Related.ShouldNotBeNull(); + relationshipLinks.Related.Should().NotBeNull(); } else { diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Middleware/JsonApiMiddlewareTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Middleware/JsonApiMiddlewareTests.cs index fbd577d51d..ad1f5df24f 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Middleware/JsonApiMiddlewareTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Middleware/JsonApiMiddlewareTests.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.Extensions.Logging.Abstractions; -using TestBuildingBlocks; using Xunit; #pragma warning disable AV1561 // Signature contains too many parameters @@ -89,7 +88,7 @@ public async Task Sets_request_properties_correctly(string requestMethod, string } else { - request.PrimaryResourceType.ShouldNotBeNull(); + request.PrimaryResourceType.Should().NotBeNull(); request.PrimaryResourceType.PublicName.Should().Be(expectPrimaryResourceType); } @@ -99,7 +98,7 @@ public async Task Sets_request_properties_correctly(string requestMethod, string } else { - request.SecondaryResourceType.ShouldNotBeNull(); + request.SecondaryResourceType.Should().NotBeNull(); request.SecondaryResourceType.PublicName.Should().Be(expectSecondaryResourceType); } @@ -109,7 +108,7 @@ public async Task Sets_request_properties_correctly(string requestMethod, string } else { - request.Relationship.ShouldNotBeNull(); + request.Relationship.Should().NotBeNull(); request.Relationship.PublicName.Should().Be(expectRelationshipName); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs index defca993be..e3a0a26cd9 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs @@ -54,7 +54,7 @@ public void Renders_JSON_path_for_ModelState_key_in_resource_request(string mode } else { - exception.Errors[0].Source.ShouldNotBeNull().With(value => value.Pointer.Should().Be(expectedJsonPath)); + exception.Errors[0].Source.RefShould().NotBeNull().And.Subject.Pointer.Should().Be(expectedJsonPath); } } @@ -102,7 +102,7 @@ public void Renders_JSON_path_for_ModelState_key_in_operations_request(string mo } else { - exception.Errors[0].Source.ShouldNotBeNull().With(value => value.Pointer.Should().Be(expectedJsonPath)); + exception.Errors[0].Source.RefShould().NotBeNull().And.Subject.Pointer.Should().Be(expectedJsonPath); } } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs index 6fab4fbd36..c9de843e56 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/FilterParseTests.cs @@ -88,7 +88,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterNameSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterNameSource.Text); } @@ -165,7 +165,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs index efbbe056c0..49a1027fb6 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/IncludeParseTests.cs @@ -80,7 +80,7 @@ public void Reader_Read_Fails(string parameterName, string parameterValue, strin error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified include is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs index 9570feb346..eae586ebdb 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/LegacyFilterParseTests.cs @@ -9,7 +9,6 @@ using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Serialization.Objects; using JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; -using TestBuildingBlocks; using Xunit; namespace JsonApiDotNetCoreTests.UnitTests.QueryStringParameters; @@ -55,7 +54,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be(errorMessage); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } @@ -84,7 +83,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified filter is invalid."); error.Detail.Should().Be(errorMessage); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs index 929e90e6b2..8020bbb01c 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs @@ -95,7 +95,7 @@ public void Reader_Read_Page_Number_Fails(string parameterValue, string errorMes error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[number]"); } @@ -140,7 +140,7 @@ public void Reader_Read_Page_Size_Fails(string parameterValue, string errorMessa error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified pagination is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be("page[size]"); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs index c6034378de..24832cbc7d 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SortParseTests.cs @@ -80,7 +80,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterNameSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterNameSource.Text); } @@ -132,7 +132,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified sort is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs index ba22b0a101..19991bacae 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/SparseFieldSetParseTests.cs @@ -79,7 +79,7 @@ public void Reader_Read_ParameterName_Fails(string parameterName, string errorMe error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified fieldset is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterNameSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterNameSource.Text); } @@ -109,7 +109,7 @@ public void Reader_Read_ParameterValue_Fails(string parameterName, string parame error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("The specified fieldset is invalid."); error.Detail.Should().Be($"{errorMessage} {parameterValueSource}"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Parameter.Should().Be(parameterName); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs index 20b2f32c30..dc59dbe907 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs @@ -8,7 +8,6 @@ using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Resources.Annotations; using Microsoft.Extensions.Logging.Abstractions; -using TestBuildingBlocks; using Xunit; namespace JsonApiDotNetCoreTests.UnitTests.ResourceDefinitions; diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs index 2955f3403c..4a9d05f4dc 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/HasManyAttributeTests.cs @@ -1,7 +1,6 @@ using FluentAssertions; using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Resources.Annotations; -using TestBuildingBlocks; using Xunit; namespace JsonApiDotNetCoreTests.UnitTests.ResourceGraph; diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs index 76ed85d367..2b0557bcdf 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/ResourceObjectConverterTests.cs @@ -60,8 +60,8 @@ public void Permits_request_body_without_extension_usage() resourceObject.Relationships.Should().ContainKey("parent").WhoseValue.With(value => { - value.ShouldNotBeNull(); - value.Data.SingleValue.ShouldNotBeNull(); + value.Should().NotBeNull(); + value.Data.SingleValue.Should().NotBeNull(); value.Data.SingleValue.Type.Should().Be("baseTypes"); value.Data.SingleValue.Id.Should().Be("1"); }); @@ -159,8 +159,8 @@ public void Permits_request_body_with_extension_when_extension_enabled() ResourceObject resourceObject = testContext.Converter.Read(ref reader, typeof(ResourceObject), testContext.SerializerReadOptions); // Assert - resourceObject.Attributes.ShouldNotBeNull(); - resourceObject.Relationships.ShouldNotBeNull(); + resourceObject.Attributes.Should().NotBeNull(); + resourceObject.Relationships.Should().NotBeNull(); } [Fact] @@ -196,7 +196,7 @@ public void Throws_for_request_body_with_extension_in_attributes_when_extension_ ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Failure requested from attributes."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("attributes/type-info:fail"); } @@ -237,7 +237,7 @@ public void Throws_for_request_body_with_extension_in_relationships_when_extensi ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.BadRequest); error.Title.Should().Be("Failure requested from relationships."); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("relationships/type-info:fail"); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs index 8f957f967b..1638c0b0d2 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Extensions/SourcePointerInExceptionTests.cs @@ -10,7 +10,6 @@ using JsonApiDotNetCore.Serialization.Request; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging.Abstractions; -using TestBuildingBlocks; using Xunit; namespace JsonApiDotNetCoreTests.UnitTests.Serialization.Extensions; @@ -52,7 +51,7 @@ public async Task Adds_source_pointer_to_JsonApiException_thrown_from_JsonConver ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Extension error"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data"); } @@ -80,7 +79,7 @@ public async Task Makes_source_pointer_absolute_in_JsonApiException_thrown_from_ ErrorObject error = exception.Errors[0]; error.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity); error.Title.Should().Be("Extension error"); - error.Source.ShouldNotBeNull(); + error.Source.Should().NotBeNull(); error.Source.Pointer.Should().Be("/data/relative/path"); } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs index a837e61593..a7bc52ee4b 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/InputConversionTests.cs @@ -10,7 +10,6 @@ using JsonApiDotNetCore.Serialization.Objects; using JsonApiDotNetCore.Serialization.Request.Adapters; using Microsoft.Extensions.Logging.Abstractions; -using TestBuildingBlocks; using Xunit; namespace JsonApiDotNetCoreTests.UnitTests.Serialization; @@ -109,7 +108,7 @@ public void Converts_various_data_types_with_values() var model = (ResourceWithVariousDataTypes?)documentAdapter.Convert(document); // Assert - model.ShouldNotBeNull(); + model.Should().NotBeNull(); model.Boolean.Should().Be(booleanValue); model.NullableBoolean.Should().Be(nullableBooleanValue); @@ -134,7 +133,7 @@ public void Converts_various_data_types_with_values() model.Enum.Should().Be(enumValue); model.NullableEnum.Should().Be(nullableEnumValue); - model.ComplexObject.ShouldNotBeNull(); + model.ComplexObject.Should().NotBeNull(); model.ComplexObject.Value.Should().Be(complexObject.Value); model.ComplexObjectList.Should().HaveCount(2); @@ -215,7 +214,7 @@ public void Converts_various_data_types_with_defaults() var model = (ResourceWithVariousDataTypes?)documentAdapter.Convert(document); // Assert - model.ShouldNotBeNull(); + model.Should().NotBeNull(); model.Boolean.Should().Be(booleanValue); model.NullableBoolean.Should().Be(nullableBooleanValue); diff --git a/test/NoEntityFrameworkTests/PersonTests.cs b/test/NoEntityFrameworkTests/PersonTests.cs index 3b35dce634..c450239429 100644 --- a/test/NoEntityFrameworkTests/PersonTests.cs +++ b/test/NoEntityFrameworkTests/PersonTests.cs @@ -172,7 +172,7 @@ public async Task Can_get_primary_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("1"); } diff --git a/test/NoEntityFrameworkTests/TagTests.cs b/test/NoEntityFrameworkTests/TagTests.cs index c0dc76e2bc..9bcb719771 100644 --- a/test/NoEntityFrameworkTests/TagTests.cs +++ b/test/NoEntityFrameworkTests/TagTests.cs @@ -175,7 +175,7 @@ public async Task Can_get_primary_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("1"); } diff --git a/test/NoEntityFrameworkTests/TodoItemTests.cs b/test/NoEntityFrameworkTests/TodoItemTests.cs index 1ec0916bd8..1e691c9cd8 100644 --- a/test/NoEntityFrameworkTests/TodoItemTests.cs +++ b/test/NoEntityFrameworkTests/TodoItemTests.cs @@ -172,7 +172,7 @@ public async Task Can_get_primary_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Id.Should().Be("1"); } @@ -227,7 +227,7 @@ public async Task Can_get_secondary_resource() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be("Jane"); } @@ -299,7 +299,7 @@ public async Task Can_get_ToOne_relationship() // Assert httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK); - responseDocument.Data.SingleValue.ShouldNotBeNull(); + responseDocument.Data.SingleValue.Should().NotBeNull(); responseDocument.Data.SingleValue.Type.Should().Be("people"); responseDocument.Data.SingleValue.Id.Should().Be("2"); } diff --git a/test/TestBuildingBlocks/FluentAssertionsExtensions.cs b/test/TestBuildingBlocks/FluentAssertionsExtensions.cs new file mode 100644 index 0000000000..79e1ef7582 --- /dev/null +++ b/test/TestBuildingBlocks/FluentAssertionsExtensions.cs @@ -0,0 +1,49 @@ +using FluentAssertions; +using FluentAssertions.Collections; +using FluentAssertions.Primitives; +using JetBrains.Annotations; +using SysNotNull = System.Diagnostics.CodeAnalysis.NotNullAttribute; + +// ReSharper disable UnusedMethodReturnValue.Global + +namespace TestBuildingBlocks; + +public static class FluentAssertionsExtensions +{ + // Workaround for source.Should().NotBeNull().And.Subject having declared type 'object'. + [System.Diagnostics.Contracts.Pure] + public static StrongReferenceTypeAssertions RefShould([SysNotNull] this T? actualValue) + where T : class + { + actualValue.Should().NotBeNull(); + return new StrongReferenceTypeAssertions(actualValue); + } + + public static AndConstraint OnlyContainKeys( + this GenericDictionaryAssertions source, params TKey[] expected) + where TCollection : IEnumerable> + where TAssertions : GenericDictionaryAssertions + { + return source.HaveCount(expected.Length).And.ContainKeys(expected); + } + + // Workaround for CS0854: An expression tree may not contain a call or invocation that uses optional arguments. + public static WhoseValueConstraint ContainKey2( + this GenericDictionaryAssertions source, TKey expected) + where TCollection : IEnumerable> + where TAssertions : GenericDictionaryAssertions + { + return source.ContainKey(expected); + } + + public static void With(this T subject, [InstantHandle] Action continuation) + { + continuation(subject); + } + + public sealed class StrongReferenceTypeAssertions(TReference subject) + : ReferenceTypeAssertions>(subject) + { + protected override string Identifier => "subject"; + } +} diff --git a/test/TestBuildingBlocks/FluentExtensions.cs b/test/TestBuildingBlocks/FluentExtensions.cs deleted file mode 100644 index 2da5e81a79..0000000000 --- a/test/TestBuildingBlocks/FluentExtensions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using FluentAssertions; -using FluentAssertions.Collections; - -namespace TestBuildingBlocks; - -public static class FluentExtensions -{ - public static AndConstraint OnlyContainKeys( - this GenericDictionaryAssertions source, params TKey[] expected) - where TCollection : IEnumerable> - where TAssertions : GenericDictionaryAssertions - { - return source.HaveCount(expected.Length).And.ContainKeys(expected); - } -} diff --git a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs b/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs deleted file mode 100644 index 2fb6eea06b..0000000000 --- a/test/TestBuildingBlocks/NullabilityAssertionExtensions.cs +++ /dev/null @@ -1,23 +0,0 @@ -using FluentAssertions; -using JetBrains.Annotations; -using SysNotNull = System.Diagnostics.CodeAnalysis.NotNullAttribute; - -// ReSharper disable PossibleMultipleEnumeration -#pragma warning disable CS8777 // Parameter must have a non-null value when exiting. - -namespace TestBuildingBlocks; - -public static class NullabilityAssertionExtensions -{ - [CustomAssertion] - public static T ShouldNotBeNull([SysNotNull] this T? subject) - { - subject.Should().NotBeNull(); - return subject; - } - - public static void With(this T subject, [InstantHandle] Action continuation) - { - continuation(subject); - } -} diff --git a/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs b/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs index 6593d4ebcc..0531c42b1a 100644 --- a/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs +++ b/test/UnitTests/Graph/ResourceDescriptorAssemblyCacheTests.cs @@ -1,7 +1,6 @@ using FluentAssertions; using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Resources; -using TestBuildingBlocks; using Xunit; namespace UnitTests.Graph; diff --git a/test/UnitTests/Graph/TypeLocatorTests.cs b/test/UnitTests/Graph/TypeLocatorTests.cs index b5023e87ba..2731dcba0a 100644 --- a/test/UnitTests/Graph/TypeLocatorTests.cs +++ b/test/UnitTests/Graph/TypeLocatorTests.cs @@ -1,7 +1,6 @@ using System.Reflection; using FluentAssertions; using JsonApiDotNetCore.Configuration; -using TestBuildingBlocks; using Xunit; namespace UnitTests.Graph; @@ -22,7 +21,7 @@ public void GetContainerRegistrationFromAssembly_Gets_Implementation() (Type implementationType, Type serviceInterface)? result = typeLocator.GetContainerRegistrationFromAssembly(assembly, unboundInterface, typeArgument); // Assert - result.ShouldNotBeNull(); + result.Should().NotBeNull(); result.Value.implementationType.Should().Be(); result.Value.serviceInterface.Should().Be>(); } @@ -69,7 +68,7 @@ public void ResolveResourceDescriptor_Returns_Type_If_Type_Is_IIdentifiable() ResourceDescriptor? descriptor = typeLocator.ResolveResourceDescriptor(resourceClrType); // Assert - descriptor.ShouldNotBeNull(); + descriptor.Should().NotBeNull(); descriptor.ResourceClrType.Should().Be(resourceClrType); descriptor.IdClrType.Should().Be(); } diff --git a/test/UnitTests/Models/ResourceConstructionExpressionTests.cs b/test/UnitTests/Models/ResourceConstructionExpressionTests.cs index d8345b5de3..48e43d2452 100644 --- a/test/UnitTests/Models/ResourceConstructionExpressionTests.cs +++ b/test/UnitTests/Models/ResourceConstructionExpressionTests.cs @@ -3,7 +3,6 @@ using FluentAssertions; using JetBrains.Annotations; using JsonApiDotNetCore.Resources; -using TestBuildingBlocks; using Xunit; namespace UnitTests.Models; @@ -24,7 +23,7 @@ public void When_resource_has_default_constructor_it_must_succeed() Func createFunction = Expression.Lambda>(newExpression).Compile(); ResourceWithoutConstructor resource = createFunction(); - resource.ShouldNotBeNull(); + resource.Should().NotBeNull(); } [Fact]