private BookDto Handle(GetBookQuery query) { var provider = DependencyInjectorStub.Get((s, c) => { BootStrapper.RegisterServices(s, c); s.AddScoped(x => MockRepository.GetContext()); }); var handler = provider.GetRequiredService <IRequestHandler <GetBookQuery, BookDto> >(); return(handler.Handle(query, CancellationToken.None).GetAwaiter().GetResult()); }
public MgaAppServiceTest() { MockRepository = new DbMockRepository <InsuranceDb>(); var provider = DependencyInjectorStub.Get((s, c) => { BootStrapper.RegisterServices(s, c); s.AddScoped(x => MockRepository.GetContext()); }); Service = provider.GetService <IMgaAppService>(); }
private bool Handle(PublishReservationEventCommand command) { var provider = DependencyInjectorStub.Get((s, c) => { BootStrapper.RegisterServices(s, c); s.AddScoped(x => MockRepository.GetContext()); s.AddScoped <IBusPublisher>(x => Bus); }); var handler = provider.GetRequiredService <IRequestHandler <PublishReservationEventCommand, bool> >(); return(handler.Handle(command, CancellationToken.None).GetAwaiter().GetResult()); }