Skip to content

Commit 32b2624

Browse files
authored
Update FluentAssertions (#1693)
* Update Resharper * Update FluentAssertions package * Remove ShouldHaveCount * Remove ShouldNotBeEmpty * Remove ShouldNotBeNullOrEmpty * Remove ShouldOnlyContainKeys * Remove ShouldContainKey * Remove ShouldNotBeNull and redundant With calls
1 parent 42a010a commit 32b2624

File tree

165 files changed

+4158
-4178
lines changed

Some content is hidden

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

165 files changed

+4158
-4178
lines changed

Diff for: .config/dotnet-tools.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"jetbrains.resharper.globaltools": {
6-
"version": "2024.3.5",
6+
"version": "2024.3.6",
77
"commands": [
88
"jb"
99
],

Diff for: package-versions.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<CodeAnalysisVersion>4.12.*</CodeAnalysisVersion>
1212
<CoverletVersion>6.0.*</CoverletVersion>
1313
<DapperVersion>2.1.*</DapperVersion>
14-
<FluentAssertionsVersion>7.0.*</FluentAssertionsVersion>
14+
<FluentAssertionsVersion>7.2.*</FluentAssertionsVersion>
1515
<GitHubActionsTestLoggerVersion>2.4.*</GitHubActionsTestLoggerVersion>
1616
<InheritDocVersion>2.0.*</InheritDocVersion>
1717
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>

Diff for: test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs

+39-39
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,20 @@ public async Task Can_use_multiple_operations()
168168
// Assert
169169
httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK);
170170

171-
responseDocument.Results.ShouldHaveCount(7);
171+
responseDocument.Results.Should().HaveCount(7);
172172

173-
responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people"));
174-
responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people"));
175-
responseDocument.Results[2].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("tags"));
176-
responseDocument.Results[3].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("todoItems"));
173+
responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("people");
174+
responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("people");
175+
responseDocument.Results[2].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("tags");
176+
responseDocument.Results[3].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("todoItems");
177177
responseDocument.Results[4].Data.Value.Should().BeNull();
178-
responseDocument.Results[5].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("todoItems"));
178+
responseDocument.Results[5].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("todoItems");
179179
responseDocument.Results[6].Data.Value.Should().BeNull();
180180

181-
long newOwnerId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull());
182-
long newAssigneeId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull());
183-
long newTagId = long.Parse(responseDocument.Results[2].Data.SingleValue!.Id.ShouldNotBeNull());
184-
long newTodoItemId = long.Parse(responseDocument.Results[3].Data.SingleValue!.Id.ShouldNotBeNull());
181+
long newOwnerId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);
182+
long newAssigneeId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);
183+
long newTagId = long.Parse(responseDocument.Results[2].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);
184+
long newTodoItemId = long.Parse(responseDocument.Results[3].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);
185185

186186
await _testContext.RunOnDatabaseAsync(async dbContext =>
187187
{
@@ -203,14 +203,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
203203
todoItemInDatabase.CreatedAt.Should().Be(DapperTestContext.FrozenTime);
204204
todoItemInDatabase.LastModifiedAt.Should().Be(DapperTestContext.FrozenTime);
205205

206-
todoItemInDatabase.Owner.ShouldNotBeNull();
206+
todoItemInDatabase.Owner.Should().NotBeNull();
207207
todoItemInDatabase.Owner.Id.Should().Be(newOwnerId);
208208
todoItemInDatabase.Assignee.Should().BeNull();
209-
todoItemInDatabase.Tags.ShouldHaveCount(1);
209+
todoItemInDatabase.Tags.Should().HaveCount(1);
210210
todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(newTagId);
211211
});
212212

213-
store.SqlCommands.ShouldHaveCount(15);
213+
store.SqlCommands.Should().HaveCount(15);
214214

215215
store.SqlCommands[0].With(command =>
216216
{
@@ -220,7 +220,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
220220
RETURNING "Id"
221221
"""));
222222

223-
command.Parameters.ShouldHaveCount(3);
223+
command.Parameters.Should().HaveCount(3);
224224
command.Parameters.Should().Contain("@p1", newOwner.FirstName);
225225
command.Parameters.Should().Contain("@p2", newOwner.LastName);
226226
command.Parameters.Should().Contain("@p3", null);
@@ -234,7 +234,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
234234
WHERE t1."Id" = @p1
235235
"""));
236236

237-
command.Parameters.ShouldHaveCount(1);
237+
command.Parameters.Should().HaveCount(1);
238238
command.Parameters.Should().Contain("@p1", newOwnerId);
239239
});
240240

@@ -246,7 +246,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
246246
RETURNING "Id"
247247
"""));
248248

249-
command.Parameters.ShouldHaveCount(3);
249+
command.Parameters.Should().HaveCount(3);
250250
command.Parameters.Should().Contain("@p1", newAssignee.FirstName);
251251
command.Parameters.Should().Contain("@p2", newAssignee.LastName);
252252
command.Parameters.Should().Contain("@p3", null);
@@ -260,7 +260,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
260260
WHERE t1."Id" = @p1
261261
"""));
262262

263-
command.Parameters.ShouldHaveCount(1);
263+
command.Parameters.Should().HaveCount(1);
264264
command.Parameters.Should().Contain("@p1", newAssigneeId);
265265
});
266266

@@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
272272
RETURNING "Id"
273273
"""));
274274

275-
command.Parameters.ShouldHaveCount(2);
275+
command.Parameters.Should().HaveCount(2);
276276
command.Parameters.Should().Contain("@p1", newTag.Name);
277277
command.Parameters.Should().Contain("@p2", null);
278278
});
@@ -285,7 +285,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
285285
WHERE t1."Id" = @p1
286286
"""));
287287

288-
command.Parameters.ShouldHaveCount(1);
288+
command.Parameters.Should().HaveCount(1);
289289
command.Parameters.Should().Contain("@p1", newTagId);
290290
});
291291

@@ -297,7 +297,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
297297
RETURNING "Id"
298298
"""));
299299

300-
command.Parameters.ShouldHaveCount(7);
300+
command.Parameters.Should().HaveCount(7);
301301
command.Parameters.Should().Contain("@p1", newTodoItem.Description);
302302
command.Parameters.Should().Contain("@p2", newTodoItem.Priority);
303303
command.Parameters.Should().Contain("@p3", newTodoItem.DurationInHours);
@@ -315,7 +315,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
315315
WHERE t1."Id" = @p1
316316
"""));
317317

318-
command.Parameters.ShouldHaveCount(1);
318+
command.Parameters.Should().HaveCount(1);
319319
command.Parameters.Should().Contain("@p1", newTodoItemId);
320320
});
321321

@@ -328,7 +328,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
328328
WHERE t1."Id" = @p1
329329
"""));
330330

331-
command.Parameters.ShouldHaveCount(1);
331+
command.Parameters.Should().HaveCount(1);
332332
command.Parameters.Should().Contain("@p1", newTodoItemId);
333333
});
334334

@@ -340,7 +340,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
340340
WHERE "Id" = @p2
341341
"""));
342342

343-
command.Parameters.ShouldHaveCount(2);
343+
command.Parameters.Should().HaveCount(2);
344344
command.Parameters.Should().Contain("@p1", newAssigneeId);
345345
command.Parameters.Should().Contain("@p2", newTodoItemId);
346346
});
@@ -354,7 +354,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
354354
WHERE t1."Id" = @p1
355355
"""));
356356

357-
command.Parameters.ShouldHaveCount(1);
357+
command.Parameters.Should().HaveCount(1);
358358
command.Parameters.Should().Contain("@p1", newTodoItemId);
359359
});
360360

@@ -366,7 +366,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
366366
WHERE "Id" = @p2
367367
"""));
368368

369-
command.Parameters.ShouldHaveCount(2);
369+
command.Parameters.Should().HaveCount(2);
370370
command.Parameters.Should().Contain("@p1", DapperTestContext.FrozenTime);
371371
command.Parameters.Should().Contain("@p2", newTodoItemId);
372372
});
@@ -379,7 +379,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
379379
WHERE "Id" = @p2
380380
"""));
381381

382-
command.Parameters.ShouldHaveCount(2);
382+
command.Parameters.Should().HaveCount(2);
383383
command.Parameters.Should().Contain("@p1", newTodoItemId);
384384
command.Parameters.Should().Contain("@p2", newTagId);
385385
});
@@ -392,7 +392,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
392392
WHERE t1."Id" = @p1
393393
"""));
394394

395-
command.Parameters.ShouldHaveCount(1);
395+
command.Parameters.Should().HaveCount(1);
396396
command.Parameters.Should().Contain("@p1", newTodoItemId);
397397
});
398398

@@ -403,7 +403,7 @@ DELETE FROM "People"
403403
WHERE "Id" = @p1
404404
"""));
405405

406-
command.Parameters.ShouldHaveCount(1);
406+
command.Parameters.Should().HaveCount(1);
407407
command.Parameters.Should().Contain("@p1", newAssigneeId);
408408
});
409409
}
@@ -469,13 +469,13 @@ public async Task Can_rollback_on_error()
469469
// Assert
470470
httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound);
471471

472-
responseDocument.Errors.ShouldHaveCount(1);
472+
responseDocument.Errors.Should().HaveCount(1);
473473

474474
ErrorObject error = responseDocument.Errors[0];
475475
error.StatusCode.Should().Be(HttpStatusCode.NotFound);
476476
error.Title.Should().Be("A related resource does not exist.");
477477
error.Detail.Should().Be($"Related resource of type 'todoItems' with ID '{unknownTodoItemId}' in relationship 'assignedTodoItems' does not exist.");
478-
error.Source.ShouldNotBeNull();
478+
error.Source.Should().NotBeNull();
479479
error.Source.Pointer.Should().Be("/atomic:operations[1]");
480480

481481
await _testContext.RunOnDatabaseAsync(async dbContext =>
@@ -484,7 +484,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
484484
peopleInDatabase.Should().BeEmpty();
485485
});
486486

487-
store.SqlCommands.ShouldHaveCount(5);
487+
store.SqlCommands.Should().HaveCount(5);
488488

489489
store.SqlCommands[0].With(command =>
490490
{
@@ -494,7 +494,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
494494
RETURNING "Id"
495495
"""));
496496

497-
command.Parameters.ShouldHaveCount(3);
497+
command.Parameters.Should().HaveCount(3);
498498
command.Parameters.Should().Contain("@p1", null);
499499
command.Parameters.Should().Contain("@p2", newPerson.LastName);
500500
command.Parameters.Should().Contain("@p3", null);
@@ -508,8 +508,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
508508
WHERE t1."Id" = @p1
509509
"""));
510510

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

515515
store.SqlCommands[2].With(command =>
@@ -521,8 +521,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
521521
WHERE t1."Id" = @p1
522522
"""));
523523

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

528528
store.SqlCommands[3].With(command =>
@@ -533,8 +533,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
533533
WHERE "Id" = @p2
534534
"""));
535535

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

@@ -546,7 +546,7 @@ SELECT t1."Id"
546546
WHERE t1."Id" = @p1
547547
"""));
548548

549-
command.Parameters.ShouldHaveCount(1);
549+
command.Parameters.Should().HaveCount(1);
550550
command.Parameters.Should().Contain("@p1", unknownTodoItemId);
551551
});
552552
}

0 commit comments

Comments
 (0)