示例#1
0
        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());
        }
示例#2
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>();
        }
示例#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());
        }