|
1 | 1 | using System.Net; |
2 | 2 | using System.Security.Claims; |
3 | | -using Ardalis.GuardClauses; |
4 | 3 | using BuildingBlocks.Core.Event; |
5 | 4 | using BuildingBlocks.Core.Model; |
6 | 5 | using BuildingBlocks.EFCore; |
|
13 | 12 | using MassTransit; |
14 | 13 | using MassTransit.Testing; |
15 | 14 | using MediatR; |
16 | | -using Microsoft.AspNetCore.Authorization; |
17 | 15 | using Microsoft.AspNetCore.Hosting; |
18 | 16 | using Microsoft.AspNetCore.Http; |
19 | 17 | using Microsoft.AspNetCore.Mvc.Testing; |
|
24 | 22 | using MongoDB.Driver; |
25 | 23 | using NSubstitute; |
26 | 24 | using Respawn; |
27 | | -using Respawn.Graph; |
28 | 25 | using WebMotions.Fake.Authentication.JwtBearer; |
29 | 26 | using Xunit; |
30 | 27 | using Xunit.Abstractions; |
@@ -346,32 +343,32 @@ public class TestWriteFixture<TEntryPoint, TWContext> : TestFixture<TEntryPoint> |
346 | 343 | { |
347 | 344 | public Task ExecuteDbContextAsync(Func<TWContext, Task> action) |
348 | 345 | { |
349 | | - return ExecuteScopeAsync(sp => action(sp.GetService<TWContext>())); |
| 346 | + return ExecuteScopeAsync(sp => action(sp.GetRequiredService<TWContext>())); |
350 | 347 | } |
351 | 348 |
|
352 | 349 | public Task ExecuteDbContextAsync(Func<TWContext, ValueTask> action) |
353 | 350 | { |
354 | | - return ExecuteScopeAsync(sp => action(sp.GetService<TWContext>()).AsTask()); |
| 351 | + return ExecuteScopeAsync(sp => action(sp.GetRequiredService<TWContext>()).AsTask()); |
355 | 352 | } |
356 | 353 |
|
357 | 354 | public Task ExecuteDbContextAsync(Func<TWContext, IMediator, Task> action) |
358 | 355 | { |
359 | | - return ExecuteScopeAsync(sp => action(sp.GetService<TWContext>(), sp.GetService<IMediator>())); |
| 356 | + return ExecuteScopeAsync(sp => action(sp.GetRequiredService<TWContext>(), sp.GetRequiredService<IMediator>())); |
360 | 357 | } |
361 | 358 |
|
362 | 359 | public Task<T> ExecuteDbContextAsync<T>(Func<TWContext, Task<T>> action) |
363 | 360 | { |
364 | | - return ExecuteScopeAsync(sp => action(sp.GetService<TWContext>())); |
| 361 | + return ExecuteScopeAsync(sp => action(sp.GetRequiredService<TWContext>())); |
365 | 362 | } |
366 | 363 |
|
367 | 364 | public Task<T> ExecuteDbContextAsync<T>(Func<TWContext, ValueTask<T>> action) |
368 | 365 | { |
369 | | - return ExecuteScopeAsync(sp => action(sp.GetService<TWContext>()).AsTask()); |
| 366 | + return ExecuteScopeAsync(sp => action(sp.GetRequiredService<TWContext>()).AsTask()); |
370 | 367 | } |
371 | 368 |
|
372 | 369 | public Task<T> ExecuteDbContextAsync<T>(Func<TWContext, IMediator, Task<T>> action) |
373 | 370 | { |
374 | | - return ExecuteScopeAsync(sp => action(sp.GetService<TWContext>(), sp.GetService<IMediator>())); |
| 371 | + return ExecuteScopeAsync(sp => action(sp.GetRequiredService<TWContext>(), sp.GetRequiredService<IMediator>())); |
375 | 372 | } |
376 | 373 |
|
377 | 374 | public Task InsertAsync<T>(params T[] entities) |
|
0 commit comments