Esempio n. 1
0
        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>();
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
 public static IServiceProvider Get(Action <IServiceCollection, IConfiguration> configure = null, Dictionary <string, string> configData = null)
 {
     return(DependencyInjectorStub.Get(configure, configData));
 }