Skip to content

Simplify some assertions #1695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -366,7 +366,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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -478,7 +478,7 @@ public async Task Cannot_create_resource_with_client_generated_ID()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -513,7 +513,7 @@ public async Task Cannot_create_resource_for_href_element()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/href");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -551,7 +551,7 @@ public async Task Cannot_create_resource_for_ref_element()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/ref");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -585,7 +585,7 @@ public async Task Cannot_create_resource_for_missing_data()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -620,7 +620,7 @@ public async Task Cannot_create_resource_for_null_data()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -667,7 +667,7 @@ public async Task Cannot_create_resource_for_array_data()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -707,7 +707,7 @@ public async Task Cannot_create_resource_for_missing_type()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -745,7 +745,7 @@ public async Task Cannot_create_resource_for_unknown_type()
error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist.");
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -790,7 +790,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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -832,7 +832,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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -985,6 +985,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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public async Task Cannot_create_resource_for_missing_client_generated_ID(ClientI
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Theory]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Theory]
Expand Down Expand Up @@ -456,7 +456,7 @@ public async Task Cannot_create_resource_with_local_ID(ClientIdGenerationMode mo
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Theory]
Expand Down Expand Up @@ -501,6 +501,6 @@ public async Task Cannot_create_resource_for_ID_and_local_ID(ClientIdGenerationM
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public async Task Cannot_create_for_missing_relationship_type()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -341,7 +341,7 @@ public async Task Cannot_create_for_missing_relationship_ID()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -590,7 +590,7 @@ public async Task Cannot_create_with_missing_data_in_OneToMany_relationship()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -635,7 +635,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -682,7 +682,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public async Task Cannot_create_for_null_relationship()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -348,7 +348,7 @@ public async Task Cannot_create_for_missing_data_in_relationship()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -400,7 +400,7 @@ public async Task Cannot_create_for_array_data_in_relationship()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -448,7 +448,7 @@ public async Task Cannot_create_for_missing_relationship_type()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -545,7 +545,7 @@ public async Task Cannot_create_for_missing_relationship_ID()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/lyric/data/type");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/language");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public async Task Cannot_delete_resource_for_href_element()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/href");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -389,7 +389,7 @@ public async Task Cannot_delete_resource_for_missing_ref_element()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -427,7 +427,7 @@ public async Task Cannot_delete_resource_for_missing_type()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/ref");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/type");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -504,7 +504,7 @@ public async Task Cannot_delete_resource_for_missing_ID()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/ref");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -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.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/ref/id");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}

[Fact]
Expand Down Expand Up @@ -626,6 +626,6 @@ public async Task Cannot_delete_resource_for_ID_and_local_ID()
error.Detail.Should().BeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[0]/ref");
error.Meta.Should().ContainKey("requestBody").WhoseValue.Should().NotBeNull().And.Subject.ToString().Should().NotBeEmpty();
error.Meta.Should().HaveRequestBody();
}
}
Loading
Loading