Skip to content

Commit d833b9e

Browse files
committed
Remove ShouldNotBeEmpty
1 parent e353488 commit d833b9e

File tree

37 files changed

+352
-364
lines changed

37 files changed

+352
-364
lines changed

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public async Task Can_create_resources()
144144
resource.Attributes.ShouldContainKey("genre").With(value => value.Should().Be(newTracks[index].Genre));
145145
resource.Attributes.ShouldContainKey("releasedAt").With(value => value.Should().Be(newTracks[index].ReleasedAt));
146146

147-
resource.Relationships.ShouldNotBeEmpty();
147+
resource.Relationships.Should().NotBeEmpty();
148148
});
149149
}
150150

@@ -264,7 +264,7 @@ public async Task Cannot_create_resource_with_unknown_attribute()
264264
error.Detail.Should().Be("Attribute 'doesNotExist' does not exist on resource type 'playlists'.");
265265
error.Source.ShouldNotBeNull();
266266
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/doesNotExist");
267-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
267+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
268268
}
269269

270270
[Fact]
@@ -310,7 +310,7 @@ public async Task Can_create_resource_with_unknown_attribute()
310310
{
311311
resource.Type.Should().Be("playlists");
312312
resource.Attributes.ShouldContainKey("name").With(value => value.Should().Be(newName));
313-
resource.Relationships.ShouldNotBeEmpty();
313+
resource.Relationships.Should().NotBeEmpty();
314314
});
315315

316316
long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull());
@@ -369,7 +369,7 @@ public async Task Cannot_create_resource_with_unknown_relationship()
369369
error.Detail.Should().Be("Relationship 'doesNotExist' does not exist on resource type 'lyrics'.");
370370
error.Source.ShouldNotBeNull();
371371
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/doesNotExist");
372-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
372+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
373373
}
374374

375375
[Fact]
@@ -424,8 +424,8 @@ public async Task Can_create_resource_with_unknown_relationship()
424424
responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource =>
425425
{
426426
resource.Type.Should().Be("lyrics");
427-
resource.Attributes.ShouldNotBeEmpty();
428-
resource.Relationships.ShouldNotBeEmpty();
427+
resource.Attributes.Should().NotBeEmpty();
428+
resource.Relationships.Should().NotBeEmpty();
429429
});
430430

431431
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()
481481
error.Detail.Should().BeNull();
482482
error.Source.ShouldNotBeNull();
483483
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id");
484-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
484+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
485485
}
486486

487487
[Fact]
@@ -516,7 +516,7 @@ public async Task Cannot_create_resource_for_href_element()
516516
error.Detail.Should().BeNull();
517517
error.Source.ShouldNotBeNull();
518518
error.Source.Pointer.Should().Be("/atomic:operations[0]/href");
519-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
519+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
520520
}
521521

522522
[Fact]
@@ -554,7 +554,7 @@ public async Task Cannot_create_resource_for_ref_element()
554554
error.Detail.Should().BeNull();
555555
error.Source.ShouldNotBeNull();
556556
error.Source.Pointer.Should().Be("/atomic:operations[0]/ref");
557-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
557+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
558558
}
559559

560560
[Fact]
@@ -588,7 +588,7 @@ public async Task Cannot_create_resource_for_missing_data()
588588
error.Detail.Should().BeNull();
589589
error.Source.ShouldNotBeNull();
590590
error.Source.Pointer.Should().Be("/atomic:operations[0]");
591-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
591+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
592592
}
593593

594594
[Fact]
@@ -623,7 +623,7 @@ public async Task Cannot_create_resource_for_null_data()
623623
error.Detail.Should().BeNull();
624624
error.Source.ShouldNotBeNull();
625625
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
626-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
626+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
627627
}
628628

629629
[Fact]
@@ -670,7 +670,7 @@ public async Task Cannot_create_resource_for_array_data()
670670
error.Detail.Should().BeNull();
671671
error.Source.ShouldNotBeNull();
672672
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
673-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
673+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
674674
}
675675

676676
[Fact]
@@ -710,7 +710,7 @@ public async Task Cannot_create_resource_for_missing_type()
710710
error.Detail.Should().BeNull();
711711
error.Source.ShouldNotBeNull();
712712
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
713-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
713+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
714714
}
715715

716716
[Fact]
@@ -748,7 +748,7 @@ public async Task Cannot_create_resource_for_unknown_type()
748748
error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist.");
749749
error.Source.ShouldNotBeNull();
750750
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/type");
751-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
751+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
752752
}
753753

754754
[Fact]
@@ -793,7 +793,7 @@ public async Task Cannot_create_resource_with_readonly_attribute()
793793
error.Detail.Should().Be("Attribute 'isArchived' on resource type 'playlists' is read-only.");
794794
error.Source.ShouldNotBeNull();
795795
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/isArchived");
796-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
796+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
797797
}
798798

799799
[Fact]
@@ -835,7 +835,7 @@ public async Task Cannot_create_resource_with_incompatible_attribute_value()
835835
error.Detail.Should().Be("Failed to convert attribute 'bornAt' with value '12345' of type 'Number' to type 'DateTimeOffset'.");
836836
error.Source.ShouldNotBeNull();
837837
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/bornAt");
838-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
838+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
839839
}
840840

841841
[Fact]
@@ -917,7 +917,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
917917
{
918918
resource.Type.Should().Be("musicTracks");
919919
resource.Attributes.ShouldContainKey("title").With(value => value.Should().Be(newTitle));
920-
resource.Relationships.ShouldNotBeEmpty();
920+
resource.Relationships.Should().NotBeEmpty();
921921
});
922922

923923
Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull());
@@ -988,6 +988,6 @@ public async Task Cannot_assign_attribute_with_blocked_capability()
988988
error.Detail.Should().Be("The attribute 'createdAt' on resource type 'lyrics' cannot be assigned to.");
989989
error.Source.ShouldNotBeNull();
990990
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/createdAt");
991-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
991+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
992992
}
993993
}

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public async Task Can_create_resource_with_client_generated_guid_ID_having_side_
8080
resource.Type.Should().Be("textLanguages");
8181
resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode));
8282
resource.Attributes.Should().NotContainKey("isRightToLeft");
83-
resource.Relationships.ShouldNotBeEmpty();
83+
resource.Relationships.Should().NotBeEmpty();
8484
});
8585

8686
await _testContext.RunOnDatabaseAsync(async dbContext =>
@@ -189,7 +189,7 @@ public async Task Can_create_resource_for_missing_client_generated_ID_having_sid
189189
{
190190
resource.Type.Should().Be("textLanguages");
191191
resource.Attributes.ShouldContainKey("isoCode").With(value => value.Should().Be(isoCode));
192-
resource.Relationships.ShouldNotBeEmpty();
192+
resource.Relationships.Should().NotBeEmpty();
193193
});
194194

195195
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
247247
error.Detail.Should().BeNull();
248248
error.Source.ShouldNotBeNull();
249249
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
250-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
250+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
251251
}
252252

253253
[Theory]
@@ -356,7 +356,7 @@ public async Task Cannot_create_resource_for_incompatible_ID(ClientIdGenerationM
356356
error.Detail.Should().Be($"Failed to convert '{guid}' of type 'String' to type 'Int32'.");
357357
error.Source.ShouldNotBeNull();
358358
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/id");
359-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
359+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
360360
}
361361

362362
[Theory]
@@ -456,7 +456,7 @@ public async Task Cannot_create_resource_with_local_ID(ClientIdGenerationMode mo
456456
error.Detail.Should().BeNull();
457457
error.Source.ShouldNotBeNull();
458458
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/lid");
459-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
459+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
460460
}
461461

462462
[Theory]
@@ -501,6 +501,6 @@ public async Task Cannot_create_resource_for_ID_and_local_ID(ClientIdGenerationM
501501
error.Detail.Should().BeNull();
502502
error.Source.ShouldNotBeNull();
503503
error.Source.Pointer.Should().Be("/atomic:operations[0]/data");
504-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
504+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
505505
}
506506
}

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithToManyRelationshipTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
8888
responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource =>
8989
{
9090
resource.Type.Should().Be("musicTracks");
91-
resource.Attributes.ShouldNotBeEmpty();
92-
resource.Relationships.ShouldNotBeEmpty();
91+
resource.Attributes.Should().NotBeEmpty();
92+
resource.Relationships.Should().NotBeEmpty();
9393
});
9494

9595
Guid newTrackId = Guid.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull());
@@ -173,8 +173,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
173173
responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource =>
174174
{
175175
resource.Type.Should().Be("playlists");
176-
resource.Attributes.ShouldNotBeEmpty();
177-
resource.Relationships.ShouldNotBeEmpty();
176+
resource.Attributes.Should().NotBeEmpty();
177+
resource.Relationships.Should().NotBeEmpty();
178178
});
179179

180180
long newPlaylistId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull());
@@ -238,7 +238,7 @@ public async Task Cannot_create_for_missing_relationship_type()
238238
error.Detail.Should().BeNull();
239239
error.Source.ShouldNotBeNull();
240240
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]");
241-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
241+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
242242
}
243243

244244
[Fact]
@@ -290,7 +290,7 @@ public async Task Cannot_create_for_unknown_relationship_type()
290290
error.Detail.Should().Be($"Resource type '{Unknown.ResourceType}' does not exist.");
291291
error.Source.ShouldNotBeNull();
292292
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type");
293-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
293+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
294294
}
295295

296296
[Fact]
@@ -341,7 +341,7 @@ public async Task Cannot_create_for_missing_relationship_ID()
341341
error.Detail.Should().BeNull();
342342
error.Source.ShouldNotBeNull();
343343
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]");
344-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
344+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
345345
}
346346

347347
[Fact]
@@ -467,7 +467,7 @@ public async Task Cannot_create_on_relationship_type_mismatch()
467467
error.Detail.Should().Be("Type 'playlists' is not convertible to type 'performers' of relationship 'performers'.");
468468
error.Source.ShouldNotBeNull();
469469
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers/data[0]/type");
470-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
470+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
471471
}
472472

473473
[Fact]
@@ -534,8 +534,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
534534
responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource =>
535535
{
536536
resource.Type.Should().Be("musicTracks");
537-
resource.Attributes.ShouldNotBeEmpty();
538-
resource.Relationships.ShouldNotBeEmpty();
537+
resource.Attributes.Should().NotBeEmpty();
538+
resource.Relationships.Should().NotBeEmpty();
539539
});
540540

541541
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()
590590
error.Detail.Should().BeNull();
591591
error.Source.ShouldNotBeNull();
592592
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/performers");
593-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
593+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
594594
}
595595

596596
[Fact]
@@ -635,7 +635,7 @@ public async Task Cannot_create_with_null_data_in_ManyToMany_relationship()
635635
error.Detail.Should().BeNull();
636636
error.Source.ShouldNotBeNull();
637637
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data");
638-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
638+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
639639
}
640640

641641
[Fact]
@@ -682,7 +682,7 @@ public async Task Cannot_create_with_object_data_in_ManyToMany_relationship()
682682
error.Detail.Should().BeNull();
683683
error.Source.ShouldNotBeNull();
684684
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/tracks/data");
685-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
685+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
686686
}
687687

688688
[Fact]
@@ -734,6 +734,6 @@ public async Task Cannot_assign_relationship_with_blocked_capability()
734734
error.Detail.Should().Be("The relationship 'occursIn' on resource type 'musicTracks' cannot be assigned to.");
735735
error.Source.ShouldNotBeNull();
736736
error.Source.Pointer.Should().Be("/atomic:operations[0]/data/relationships/occursIn");
737-
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().ShouldNotBeEmpty());
737+
error.Meta.ShouldContainKey("requestBody").With(value => value.ShouldNotBeNull().ToString().Should().NotBeEmpty());
738738
}
739739
}

0 commit comments

Comments
 (0)