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 PagedResponse <BookDto> Handle(ListBookFilteringQuery query) { var provider = DependencyInjectorStub.Get((s, c) => { BootStrapper.RegisterServices(s, c); s.AddScoped(x => MockRepository.GetContext()); }); var handler = provider.GetRequiredService <IRequestHandler <ListBookFilteringQuery, PagedResponse <BookDto> > >(); return(handler.Handle(query, CancellationToken.None).GetAwaiter().GetResult()); }
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()); }
public static IServiceProvider Get(Action <IServiceCollection, IConfiguration> configure = null, Dictionary <string, string> configData = null) { return(DependencyInjectorStub.Get(configure, configData)); }