Skip to content

Commit f54403c

Browse files
committed
Remove ShouldContainKey
1 parent 10e112d commit f54403c

File tree

83 files changed

+871
-880
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+871
-880
lines changed

test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
509509
"""));
510510

511511
command.Parameters.Should().HaveCount(1);
512-
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
512+
command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull();
513513
});
514514

515515
store.SqlCommands[2].With(command =>
@@ -522,7 +522,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
522522
"""));
523523

524524
command.Parameters.Should().HaveCount(1);
525-
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
525+
command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull();
526526
});
527527

528528
store.SqlCommands[3].With(command =>
@@ -534,7 +534,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
534534
"""));
535535

536536
command.Parameters.Should().HaveCount(2);
537-
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
537+
command.Parameters.Should().ContainKey("@p1").WhoseValue.ShouldNotBeNull();
538538
command.Parameters.Should().Contain("@p2", unknownTodoItemId);
539539
});
540540

test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
6060

6161
responseDocument.Data.ManyValue[0].Relationships.With(relationships =>
6262
{
63-
relationships.ShouldContainKey("owner").With(value =>
63+
relationships.Should().ContainKey("owner").WhoseValue.With(value =>
6464
{
6565
value.ShouldNotBeNull();
6666
value.Data.SingleValue.ShouldNotBeNull();
6767
value.Data.SingleValue.Type.Should().Be("people");
6868
value.Data.SingleValue.Id.Should().Be(todoItems[0].Owner.StringId);
6969
});
7070

71-
relationships.ShouldContainKey("assignee").With(value =>
71+
relationships.Should().ContainKey("assignee").WhoseValue.With(value =>
7272
{
7373
value.ShouldNotBeNull();
7474
value.Data.SingleValue.Should().BeNull();
7575
});
7676

77-
relationships.ShouldContainKey("tags").With(value =>
77+
relationships.Should().ContainKey("tags").WhoseValue.With(value =>
7878
{
7979
value.ShouldNotBeNull();
8080
value.Data.ManyValue.Should().HaveCount(2);
@@ -88,23 +88,23 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
8888

8989
responseDocument.Data.ManyValue[1].Relationships.With(relationships =>
9090
{
91-
relationships.ShouldContainKey("owner").With(value =>
91+
relationships.Should().ContainKey("owner").WhoseValue.With(value =>
9292
{
9393
value.ShouldNotBeNull();
9494
value.Data.SingleValue.ShouldNotBeNull();
9595
value.Data.SingleValue.Type.Should().Be("people");
9696
value.Data.SingleValue.Id.Should().Be(todoItems[1].Owner.StringId);
9797
});
9898

99-
relationships.ShouldContainKey("assignee").With(value =>
99+
relationships.Should().ContainKey("assignee").WhoseValue.With(value =>
100100
{
101101
value.ShouldNotBeNull();
102102
value.Data.SingleValue.ShouldNotBeNull();
103103
value.Data.SingleValue.Type.Should().Be("people");
104104
value.Data.SingleValue.Id.Should().Be(todoItems[1].Assignee!.StringId);
105105
});
106106

107-
relationships.ShouldContainKey("tags").With(value =>
107+
relationships.Should().ContainKey("tags").WhoseValue.With(value =>
108108
{
109109
value.ShouldNotBeNull();
110110
value.Data.ManyValue.Should().HaveCount(2);
@@ -118,29 +118,29 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
118118

119119
responseDocument.Included[0].Type.Should().Be("people");
120120
responseDocument.Included[0].Id.Should().Be(owner.StringId);
121-
responseDocument.Included[0].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(owner.FirstName));
122-
responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(owner.LastName));
121+
responseDocument.Included[0].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(owner.FirstName);
122+
responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(owner.LastName);
123123

124124
responseDocument.Included[1].Type.Should().Be("tags");
125125
responseDocument.Included[1].Id.Should().Be(todoItems[0].Tags.ElementAt(0).StringId);
126-
responseDocument.Included[1].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[0].Tags.ElementAt(0).Name));
126+
responseDocument.Included[1].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[0].Tags.ElementAt(0).Name);
127127

128128
responseDocument.Included[2].Type.Should().Be("tags");
129129
responseDocument.Included[2].Id.Should().Be(todoItems[0].Tags.ElementAt(1).StringId);
130-
responseDocument.Included[2].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[0].Tags.ElementAt(1).Name));
130+
responseDocument.Included[2].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[0].Tags.ElementAt(1).Name);
131131

132132
responseDocument.Included[3].Type.Should().Be("people");
133133
responseDocument.Included[3].Id.Should().Be(todoItems[1].Assignee!.StringId);
134-
responseDocument.Included[3].Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(todoItems[1].Assignee!.FirstName));
135-
responseDocument.Included[3].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItems[1].Assignee!.LastName));
134+
responseDocument.Included[3].Attributes.Should().ContainKey("firstName").WhoseValue.Should().Be(todoItems[1].Assignee!.FirstName);
135+
responseDocument.Included[3].Attributes.Should().ContainKey("lastName").WhoseValue.Should().Be(todoItems[1].Assignee!.LastName);
136136

137137
responseDocument.Included[4].Type.Should().Be("tags");
138138
responseDocument.Included[4].Id.Should().Be(todoItems[1].Tags.ElementAt(0).StringId);
139-
responseDocument.Included[4].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[1].Tags.ElementAt(0).Name));
139+
responseDocument.Included[4].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[1].Tags.ElementAt(0).Name);
140140

141141
responseDocument.Included[5].Type.Should().Be("tags");
142142
responseDocument.Included[5].Id.Should().Be(todoItems[1].Tags.ElementAt(1).StringId);
143-
responseDocument.Included[5].Attributes.ShouldContainKey("name").With(value => value.Should().Be(todoItems[1].Tags.ElementAt(1).Name));
143+
responseDocument.Included[5].Attributes.Should().ContainKey("name").WhoseValue.Should().Be(todoItems[1].Tags.ElementAt(1).Name);
144144

145145
responseDocument.Meta.Should().ContainTotal(2);
146146

test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
5151
responseDocument.Data.ManyValue[0].Type.Should().Be("todoItems");
5252
responseDocument.Data.ManyValue[0].Id.Should().Be(todoItem.StringId);
5353
responseDocument.Data.ManyValue[0].Attributes.Should().HaveCount(2);
54-
responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description));
55-
responseDocument.Data.ManyValue[0].Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(todoItem.DurationInHours));
54+
responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description));
55+
responseDocument.Data.ManyValue[0].Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(todoItem.DurationInHours));
5656
responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(2);
5757

58-
responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("owner").With(value =>
58+
responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("owner").WhoseValue.With(value =>
5959
{
6060
value.ShouldNotBeNull();
6161
value.Data.SingleValue.ShouldNotBeNull();
6262
value.Data.SingleValue.Type.Should().Be("people");
6363
value.Data.SingleValue.Id.Should().Be(todoItem.Owner.StringId);
6464
});
6565

66-
responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("assignee").With(value =>
66+
responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("assignee").WhoseValue.With(value =>
6767
{
6868
value.ShouldNotBeNull();
6969
value.Data.SingleValue.ShouldNotBeNull();
@@ -76,12 +76,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
7676

7777
responseDocument.Included[0].Id.Should().Be(todoItem.Owner.StringId);
7878
responseDocument.Included[0].Attributes.Should().HaveCount(1);
79-
responseDocument.Included[0].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Owner.LastName));
79+
responseDocument.Included[0].Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Owner.LastName));
8080
responseDocument.Included[0].Relationships.Should().BeNull();
8181

8282
responseDocument.Included[1].Id.Should().Be(todoItem.Assignee.StringId);
8383
responseDocument.Included[1].Attributes.Should().HaveCount(1);
84-
responseDocument.Included[1].Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(todoItem.Assignee.LastName));
84+
responseDocument.Included[1].Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(todoItem.Assignee.LastName));
8585
responseDocument.Included[1].Relationships.Should().BeNull();
8686

8787
store.SqlCommands.Should().HaveCount(2);
@@ -138,7 +138,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
138138
responseDocument.Data.SingleValue.Type.Should().Be("todoItems");
139139
responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId);
140140
responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1);
141-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description));
141+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description));
142142
responseDocument.Data.SingleValue.Relationships.Should().BeNull();
143143

144144
store.SqlCommands.Should().HaveCount(1);
@@ -187,7 +187,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
187187
responseDocument.Data.ManyValue[0].Attributes.Should().BeNull();
188188
responseDocument.Data.ManyValue[0].Relationships.Should().HaveCount(1);
189189

190-
responseDocument.Data.ManyValue[0].Relationships.ShouldContainKey("color").With(value =>
190+
responseDocument.Data.ManyValue[0].Relationships.Should().ContainKey("color").WhoseValue.With(value =>
191191
{
192192
value.ShouldNotBeNull();
193193
value.Data.Value.Should().BeNull();
@@ -338,7 +338,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
338338
responseDocument.Data.SingleValue.Type.Should().Be("people");
339339
responseDocument.Data.SingleValue.Id.Should().Be(person.StringId);
340340
responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1);
341-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(person.DisplayName));
341+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(person.DisplayName));
342342
responseDocument.Data.SingleValue.Relationships.Should().BeNull();
343343

344344
store.SqlCommands.Should().HaveCount(1);
@@ -385,7 +385,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
385385
responseDocument.Data.SingleValue.Type.Should().Be("todoItems");
386386
responseDocument.Data.SingleValue.Id.Should().Be(todoItem.StringId);
387387
responseDocument.Data.SingleValue.Attributes.Should().HaveCount(1);
388-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(todoItem.Description));
388+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(todoItem.Description));
389389
responseDocument.Data.SingleValue.Relationships.Should().BeNull();
390390

391391
responseDocument.Included.Should().HaveCount(2);

test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
9494

9595
responseDocument.Data.SingleValue.ShouldNotBeNull();
9696
responseDocument.Data.SingleValue.Type.Should().Be("todoItems");
97-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newTodoItem.Description));
98-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(newTodoItem.Priority));
99-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().Be(newTodoItem.DurationInHours));
100-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(DapperTestContext.FrozenTime));
101-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().BeNull());
97+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description));
98+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority));
99+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().Be(newTodoItem.DurationInHours));
100+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime));
101+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().BeNull());
102102

103103
responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags");
104104

@@ -230,11 +230,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
230230

231231
responseDocument.Data.SingleValue.ShouldNotBeNull();
232232
responseDocument.Data.SingleValue.Type.Should().Be("todoItems");
233-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("description").With(value => value.Should().Be(newTodoItem.Description));
234-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("priority").With(value => value.Should().Be(newTodoItem.Priority));
235-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("durationInHours").With(value => value.Should().BeNull());
236-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("createdAt").With(value => value.Should().Be(DapperTestContext.FrozenTime));
237-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("modifiedAt").With(value => value.Should().BeNull());
233+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("description").WhoseValue.With(value => value.Should().Be(newTodoItem.Description));
234+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("priority").WhoseValue.With(value => value.Should().Be(newTodoItem.Priority));
235+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("durationInHours").WhoseValue.With(value => value.Should().BeNull());
236+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("createdAt").WhoseValue.With(value => value.Should().Be(DapperTestContext.FrozenTime));
237+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("modifiedAt").WhoseValue.With(value => value.Should().BeNull());
238238
responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("owner", "assignee", "tags");
239239

240240
long newTodoItemId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull());
@@ -409,7 +409,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
409409

410410
responseDocument.Data.SingleValue.ShouldNotBeNull();
411411
responseDocument.Data.SingleValue.Type.Should().Be("loginAccounts");
412-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("userName").With(value => value.Should().Be(newUserName));
412+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("userName").WhoseValue.With(value => value.Should().Be(newUserName));
413413
responseDocument.Data.SingleValue.Attributes.Should().NotContainKey("lastUsedAt");
414414
responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("recovery", "person");
415415

@@ -522,9 +522,9 @@ public async Task Can_create_resource_with_calculated_attribute()
522522

523523
responseDocument.Data.SingleValue.ShouldNotBeNull();
524524
responseDocument.Data.SingleValue.Type.Should().Be("people");
525-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("firstName").With(value => value.Should().Be(newPerson.FirstName));
526-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("lastName").With(value => value.Should().Be(newPerson.LastName));
527-
responseDocument.Data.SingleValue.Attributes.ShouldContainKey("displayName").With(value => value.Should().Be(newPerson.DisplayName));
525+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("firstName").WhoseValue.With(value => value.Should().Be(newPerson.FirstName));
526+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("lastName").WhoseValue.With(value => value.Should().Be(newPerson.LastName));
527+
responseDocument.Data.SingleValue.Attributes.Should().ContainKey("displayName").WhoseValue.With(value => value.Should().Be(newPerson.DisplayName));
528528
responseDocument.Data.SingleValue.Relationships.Should().OnlyContainKeys("account", "ownedTodoItems", "assignedTodoItems");
529529

530530
long newPersonId = long.Parse(responseDocument.Data.SingleValue.Id.ShouldNotBeNull());

0 commit comments

Comments
 (0)