Skip to content

Commit 6460471

Browse files
author
Bart Koelman
committed
Added helper to suppress the "method has cancellation support" suggestion and turned that into a warning, so we'll get the right alerts.
1 parent ae18541 commit 6460471

File tree

35 files changed

+99
-92
lines changed

35 files changed

+99
-92
lines changed

JsonApiDotNetCore.sln.DotSettings

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$, $NAME$);</s:String>
5656
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalizableElement/@EntryIndexedValue">DO_NOT_SHOW</s:String>
5757
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LoopCanBePartlyConvertedToQuery/@EntryIndexedValue">HINT</s:String>
5858
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeInternal/@EntryIndexedValue">SUGGESTION</s:String>
59+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MethodHasAsyncOverload/@EntryIndexedValue">WARNING</s:String>
60+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MethodHasAsyncOverloadWithCancellation/@EntryIndexedValue">WARNING</s:String>
5961
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PatternAlwaysMatches/@EntryIndexedValue">SUGGESTION</s:String>
6062
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PublicConstructorInAbstractClass/@EntryIndexedValue">WARNING</s:String>
6163
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArrayCreationExpression/@EntryIndexedValue">SUGGESTION</s:String>

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/Controllers/AtomicConstrainedOperationsControllerTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public async Task Cannot_add_to_ToMany_relationship_for_matching_resource_type()
168168

169169
await _testContext.RunOnDatabaseAsync(async dbContext =>
170170
{
171-
dbContext.AddRange(existingTrack, existingPerformer);
171+
dbContext.AddInRange(existingTrack, existingPerformer);
172172
await dbContext.SaveChangesAsync();
173173
});
174174

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ public async Task Can_create_resource_with_attributes_and_multiple_relationship_
720720

721721
await _testContext.RunOnDatabaseAsync(async dbContext =>
722722
{
723-
dbContext.AddRange(existingLyric, existingCompany, existingPerformer);
723+
dbContext.AddInRange(existingLyric, existingCompany, existingPerformer);
724724
await dbContext.SaveChangesAsync();
725725
});
726726

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public async Task Update_resource_with_side_effects_returns_absolute_links()
4444

4545
await _testContext.RunOnDatabaseAsync(async dbContext =>
4646
{
47-
dbContext.AddRange(existingLanguage, existingCompany);
47+
dbContext.AddInRange(existingLanguage, existingCompany);
4848
await dbContext.SaveChangesAsync();
4949
});
5050

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public async Task Can_update_resource_with_annotated_relationship()
264264

265265
await _testContext.RunOnDatabaseAsync(async dbContext =>
266266
{
267-
dbContext.AddRange(existingPlaylist, existingTrack);
267+
dbContext.AddInRange(existingPlaylist, existingTrack);
268268
await dbContext.SaveChangesAsync();
269269
});
270270

@@ -335,7 +335,7 @@ public async Task Can_update_ToOne_relationship()
335335

336336
await _testContext.RunOnDatabaseAsync(async dbContext =>
337337
{
338-
dbContext.AddRange(existingTrack, existingCompany);
338+
dbContext.AddInRange(existingTrack, existingCompany);
339339
await dbContext.SaveChangesAsync();
340340
});
341341

@@ -389,7 +389,7 @@ public async Task Can_update_ToMany_relationship()
389389

390390
await _testContext.RunOnDatabaseAsync(async dbContext =>
391391
{
392-
dbContext.AddRange(existingPlaylist, existingTrack);
392+
dbContext.AddInRange(existingPlaylist, existingTrack);
393393
await dbContext.SaveChangesAsync();
394394
});
395395

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public async Task Skips_on_update_resource_with_ToOne_relationship()
278278

279279
await _testContext.RunOnDatabaseAsync(async dbContext =>
280280
{
281-
dbContext.AddRange(existingTrack, existingCompany);
281+
dbContext.AddInRange(existingTrack, existingCompany);
282282
await dbContext.SaveChangesAsync();
283283
});
284284

@@ -337,7 +337,7 @@ public async Task Skips_on_update_ToOne_relationship()
337337

338338
await _testContext.RunOnDatabaseAsync(async dbContext =>
339339
{
340-
dbContext.AddRange(existingTrack, existingCompany);
340+
dbContext.AddInRange(existingTrack, existingCompany);
341341
await dbContext.SaveChangesAsync();
342342
});
343343

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task Cannot_add_to_HasOne_relationship()
3636

3737
await _testContext.RunOnDatabaseAsync(async dbContext =>
3838
{
39-
dbContext.AddRange(existingTrack, existingCompany);
39+
dbContext.AddInRange(existingTrack, existingCompany);
4040
await dbContext.SaveChangesAsync();
4141
});
4242

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public async Task Can_create_OneToOne_relationship_from_principal_side()
194194

195195
await _testContext.RunOnDatabaseAsync(async dbContext =>
196196
{
197-
dbContext.AddRange(existingLyric, existingTrack);
197+
dbContext.AddInRange(existingLyric, existingTrack);
198198
await dbContext.SaveChangesAsync();
199199
});
200200

@@ -247,7 +247,7 @@ public async Task Can_create_OneToOne_relationship_from_dependent_side()
247247

248248
await _testContext.RunOnDatabaseAsync(async dbContext =>
249249
{
250-
dbContext.AddRange(existingTrack, existingLyric);
250+
dbContext.AddInRange(existingTrack, existingLyric);
251251
await dbContext.SaveChangesAsync();
252252
});
253253

@@ -300,7 +300,7 @@ public async Task Can_create_ManyToOne_relationship()
300300

301301
await _testContext.RunOnDatabaseAsync(async dbContext =>
302302
{
303-
dbContext.AddRange(existingTrack, existingCompany);
303+
dbContext.AddInRange(existingTrack, existingCompany);
304304
await dbContext.SaveChangesAsync();
305305
});
306306

@@ -356,7 +356,7 @@ public async Task Can_replace_OneToOne_relationship_from_principal_side()
356356
await _testContext.RunOnDatabaseAsync(async dbContext =>
357357
{
358358
await dbContext.ClearTableAsync<MusicTrack>();
359-
dbContext.AddRange(existingLyric, existingTrack);
359+
dbContext.AddInRange(existingLyric, existingTrack);
360360
await dbContext.SaveChangesAsync();
361361
});
362362

@@ -415,7 +415,7 @@ public async Task Can_replace_OneToOne_relationship_from_dependent_side()
415415
await _testContext.RunOnDatabaseAsync(async dbContext =>
416416
{
417417
await dbContext.ClearTableAsync<Lyric>();
418-
dbContext.AddRange(existingTrack, existingLyric);
418+
dbContext.AddInRange(existingTrack, existingLyric);
419419
await dbContext.SaveChangesAsync();
420420
});
421421

@@ -474,7 +474,7 @@ public async Task Can_replace_ManyToOne_relationship()
474474
await _testContext.RunOnDatabaseAsync(async dbContext =>
475475
{
476476
await dbContext.ClearTableAsync<RecordCompany>();
477-
dbContext.AddRange(existingTrack, existingCompany);
477+
dbContext.AddInRange(existingTrack, existingCompany);
478478
await dbContext.SaveChangesAsync();
479479
});
480480

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ public async Task Can_update_resource_with_attributes_and_multiple_relationship_
15111511

15121512
await _testContext.RunOnDatabaseAsync(async dbContext =>
15131513
{
1514-
dbContext.AddRange(existingTrack, existingLyric, existingCompany, existingPerformer);
1514+
dbContext.AddInRange(existingTrack, existingLyric, existingCompany, existingPerformer);
15151515
await dbContext.SaveChangesAsync();
15161516
});
15171517

test/JsonApiDotNetCoreExampleTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateToOneRelationshipTests.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public async Task Can_create_OneToOne_relationship_from_principal_side()
209209

210210
await _testContext.RunOnDatabaseAsync(async dbContext =>
211211
{
212-
dbContext.AddRange(existingLyric, existingTrack);
212+
dbContext.AddInRange(existingLyric, existingTrack);
213213
await dbContext.SaveChangesAsync();
214214
});
215215

@@ -267,7 +267,7 @@ public async Task Can_create_OneToOne_relationship_from_dependent_side()
267267

268268
await _testContext.RunOnDatabaseAsync(async dbContext =>
269269
{
270-
dbContext.AddRange(existingTrack, existingLyric);
270+
dbContext.AddInRange(existingTrack, existingLyric);
271271
await dbContext.SaveChangesAsync();
272272
});
273273

@@ -325,7 +325,7 @@ public async Task Can_create_ManyToOne_relationship()
325325

326326
await _testContext.RunOnDatabaseAsync(async dbContext =>
327327
{
328-
dbContext.AddRange(existingTrack, existingCompany);
328+
dbContext.AddInRange(existingTrack, existingCompany);
329329
await dbContext.SaveChangesAsync();
330330
});
331331

@@ -386,7 +386,7 @@ public async Task Can_replace_OneToOne_relationship_from_principal_side()
386386
await _testContext.RunOnDatabaseAsync(async dbContext =>
387387
{
388388
await dbContext.ClearTableAsync<MusicTrack>();
389-
dbContext.AddRange(existingLyric, existingTrack);
389+
dbContext.AddInRange(existingLyric, existingTrack);
390390
await dbContext.SaveChangesAsync();
391391
});
392392

@@ -450,7 +450,7 @@ public async Task Can_replace_OneToOne_relationship_from_dependent_side()
450450
await _testContext.RunOnDatabaseAsync(async dbContext =>
451451
{
452452
await dbContext.ClearTableAsync<Lyric>();
453-
dbContext.AddRange(existingTrack, existingLyric);
453+
dbContext.AddInRange(existingTrack, existingLyric);
454454
await dbContext.SaveChangesAsync();
455455
});
456456

@@ -514,7 +514,7 @@ public async Task Can_replace_ManyToOne_relationship()
514514
await _testContext.RunOnDatabaseAsync(async dbContext =>
515515
{
516516
await dbContext.ClearTableAsync<RecordCompany>();
517-
dbContext.AddRange(existingTrack, existingCompany);
517+
dbContext.AddInRange(existingTrack, existingCompany);
518518
await dbContext.SaveChangesAsync();
519519
});
520520

test/JsonApiDotNetCoreExampleTests/IntegrationTests/CompositeKeys/CompositeKeyTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public async Task Can_create_OneToOne_relationship()
210210
await _testContext.RunOnDatabaseAsync(async dbContext =>
211211
{
212212
await dbContext.ClearTableAsync<Car>();
213-
dbContext.AddRange(existingCar, existingEngine);
213+
dbContext.AddInRange(existingCar, existingEngine);
214214
await dbContext.SaveChangesAsync();
215215
});
216216

@@ -387,7 +387,7 @@ public async Task Can_add_to_OneToMany_relationship()
387387
await _testContext.RunOnDatabaseAsync(async dbContext =>
388388
{
389389
await dbContext.ClearTableAsync<Car>();
390-
dbContext.AddRange(existingDealership, existingCar);
390+
dbContext.AddInRange(existingDealership, existingCar);
391391
await dbContext.SaveChangesAsync();
392392
});
393393

@@ -454,7 +454,7 @@ public async Task Can_replace_OneToMany_relationship()
454454
await _testContext.RunOnDatabaseAsync(async dbContext =>
455455
{
456456
await dbContext.ClearTableAsync<Car>();
457-
dbContext.AddRange(existingDealership, existingCar);
457+
dbContext.AddInRange(existingDealership, existingCar);
458458
await dbContext.SaveChangesAsync();
459459
});
460460

test/JsonApiDotNetCoreExampleTests/IntegrationTests/IdObfuscation/IdObfuscationTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public async Task Can_update_resource_with_relationship()
277277

278278
await _testContext.RunOnDatabaseAsync(async dbContext =>
279279
{
280-
dbContext.AddRange(existingAccount, existingCard);
280+
dbContext.AddInRange(existingAccount, existingCard);
281281
await dbContext.SaveChangesAsync();
282282
});
283283

@@ -341,7 +341,7 @@ public async Task Can_add_to_ToMany_relationship()
341341

342342
await _testContext.RunOnDatabaseAsync(async dbContext =>
343343
{
344-
dbContext.AddRange(existingAccount, existingDebitCard);
344+
dbContext.AddInRange(existingAccount, existingDebitCard);
345345
await dbContext.SaveChangesAsync();
346346
});
347347

test/JsonApiDotNetCoreExampleTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public async Task Can_add_to_annotated_ToMany_relationship()
305305

306306
await _testContext.RunOnDatabaseAsync(async dbContext =>
307307
{
308-
dbContext.AddRange(directory, file);
308+
dbContext.AddInRange(directory, file);
309309
await dbContext.SaveChangesAsync();
310310
});
311311

@@ -917,7 +917,7 @@ public async Task Can_remove_from_annotated_ToMany_relationship()
917917

918918
await _testContext.RunOnDatabaseAsync(async dbContext =>
919919
{
920-
dbContext.AddRange(directory);
920+
dbContext.AddInRange(directory);
921921
await dbContext.SaveChangesAsync();
922922
});
923923

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Links/AbsoluteLinksWithNamespaceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public async Task Update_resource_with_side_effects_and_include_returns_absolute
324324

325325
await _testContext.RunOnDatabaseAsync(async dbContext =>
326326
{
327-
dbContext.AddRange(existingPhoto, existingAlbum);
327+
dbContext.AddInRange(existingPhoto, existingAlbum);
328328
await dbContext.SaveChangesAsync();
329329
});
330330

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Links/AbsoluteLinksWithoutNamespaceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public async Task Update_resource_with_side_effects_and_include_returns_absolute
324324

325325
await _testContext.RunOnDatabaseAsync(async dbContext =>
326326
{
327-
dbContext.AddRange(existingPhoto, existingAlbum);
327+
dbContext.AddInRange(existingPhoto, existingAlbum);
328328
await dbContext.SaveChangesAsync();
329329
});
330330

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Links/RelativeLinksWithNamespaceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public async Task Update_resource_with_side_effects_and_include_returns_relative
322322

323323
await _testContext.RunOnDatabaseAsync(async dbContext =>
324324
{
325-
dbContext.AddRange(existingPhoto, existingAlbum);
325+
dbContext.AddInRange(existingPhoto, existingAlbum);
326326
await dbContext.SaveChangesAsync();
327327
});
328328

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Links/RelativeLinksWithoutNamespaceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public async Task Update_resource_with_side_effects_and_include_returns_relative
322322

323323
await _testContext.RunOnDatabaseAsync(async dbContext =>
324324
{
325-
dbContext.AddRange(existingPhoto, existingAlbum);
325+
dbContext.AddInRange(existingPhoto, existingAlbum);
326326
await dbContext.SaveChangesAsync();
327327
});
328328

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Microservices/FireAndForgetDelivery/FireForgetTests.User.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public async Task Update_user_add_to_group_sends_messages()
283283

284284
await _testContext.RunOnDatabaseAsync(async dbContext =>
285285
{
286-
dbContext.AddRange(existingUser, existingGroup);
286+
dbContext.AddInRange(existingUser, existingGroup);
287287
await dbContext.SaveChangesAsync();
288288
});
289289

@@ -357,7 +357,7 @@ public async Task Update_user_move_to_group_sends_messages()
357357

358358
await _testContext.RunOnDatabaseAsync(async dbContext =>
359359
{
360-
dbContext.AddRange(existingUser, existingGroup);
360+
dbContext.AddInRange(existingUser, existingGroup);
361361
await dbContext.SaveChangesAsync();
362362
});
363363

@@ -553,7 +553,7 @@ public async Task Assign_group_to_user_sends_messages()
553553

554554
await _testContext.RunOnDatabaseAsync(async dbContext =>
555555
{
556-
dbContext.AddRange(existingUser, existingGroup);
556+
dbContext.AddInRange(existingUser, existingGroup);
557557
await dbContext.SaveChangesAsync();
558558
});
559559

@@ -605,7 +605,7 @@ public async Task Replace_group_for_user_sends_messages()
605605

606606
await _testContext.RunOnDatabaseAsync(async dbContext =>
607607
{
608-
dbContext.AddRange(existingUser, existingGroup);
608+
dbContext.AddInRange(existingUser, existingGroup);
609609
await dbContext.SaveChangesAsync();
610610
});
611611

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.User.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public async Task Update_user_add_to_group_writes_to_outbox()
302302
await _testContext.RunOnDatabaseAsync(async dbContext =>
303303
{
304304
await dbContext.ClearTableAsync<OutgoingMessage>();
305-
dbContext.AddRange(existingUser, existingGroup);
305+
dbContext.AddInRange(existingUser, existingGroup);
306306
await dbContext.SaveChangesAsync();
307307
});
308308

@@ -379,7 +379,7 @@ public async Task Update_user_move_to_group_writes_to_outbox()
379379
await _testContext.RunOnDatabaseAsync(async dbContext =>
380380
{
381381
await dbContext.ClearTableAsync<OutgoingMessage>();
382-
dbContext.AddRange(existingUser, existingGroup);
382+
dbContext.AddInRange(existingUser, existingGroup);
383383
await dbContext.SaveChangesAsync();
384384
});
385385

@@ -587,7 +587,7 @@ public async Task Assign_group_to_user_writes_to_outbox()
587587
await _testContext.RunOnDatabaseAsync(async dbContext =>
588588
{
589589
await dbContext.ClearTableAsync<OutgoingMessage>();
590-
dbContext.AddRange(existingUser, existingGroup);
590+
dbContext.AddInRange(existingUser, existingGroup);
591591
await dbContext.SaveChangesAsync();
592592
});
593593

@@ -642,7 +642,7 @@ public async Task Replace_group_for_user_writes_to_outbox()
642642
await _testContext.RunOnDatabaseAsync(async dbContext =>
643643
{
644644
await dbContext.ClearTableAsync<OutgoingMessage>();
645-
dbContext.AddRange(existingUser, existingGroup);
645+
dbContext.AddInRange(existingUser, existingGroup);
646646
await dbContext.SaveChangesAsync();
647647
});
648648

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Microservices/TransactionalOutboxPattern/OutboxTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public async Task Does_not_add_to_outbox_on_write_error()
5757
await _testContext.RunOnDatabaseAsync(async dbContext =>
5858
{
5959
await dbContext.ClearTableAsync<OutgoingMessage>();
60-
dbContext.AddRange(existingGroup, existingUser);
60+
dbContext.AddInRange(existingGroup, existingUser);
6161
await dbContext.SaveChangesAsync();
6262
});
6363

0 commit comments

Comments
 (0)