Skip to content

Commit

Permalink
Test fixes for mediatr upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
paullocknimble committed May 16, 2023
1 parent d584404 commit cbb8938
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Dfe.Academies.Academisation.WebApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@
builder.Services.AddSwaggerGen();
builder.Services.ConfigureOptions<SwaggerOptions>();
builder.Services.AddAutoMapper(typeof(AutoMapperProfile));
builder.Services.AddMediatR(typeof(Program).GetTypeInfo().Assembly);
builder.Services.AddMediatR(Assembly.GetAssembly(typeof(JoinTrustCommandHandler))!);
builder.Services.AddMediatR(typeof(CreateLoanCommandHandler).GetTypeInfo().Assembly);

builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(typeof(Program).GetTypeInfo().Assembly));
builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(Assembly.GetAssembly(typeof(JoinTrustCommandHandler))!));
builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(typeof(CreateLoanCommandHandler).GetTypeInfo().Assembly));

builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(ValidatorBehavior<,>));
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));

builder.Services.AddScoped(typeof(IValidator<UpdateLoanCommand>), typeof(UpdateLoanCommandValidator));
builder.Services.AddScoped(typeof(IValidator<CreateLoanCommand>), typeof(CreateLoanCommandValidator));
builder.Services.AddScoped(typeof(IValidator<UpdateLeaseCommand>), typeof(UpdateLeaseCommandValidator));
Expand Down

0 comments on commit cbb8938

Please sign in to comment.