private void ExpireAsync(ReservationExpiredMessage message)
        {
            var bus = BusPublisherStub.Create();

            var service = new ReservationService(Db, bus);

            service.ExpireAsync(message).Wait();
        }
示例#2
0
        private ShippingDto CreateShippingAsync(ShippingDtoMessage message)
        {
            var bus = BusPublisherStub.Create();

            var service = new ProcessDtoService(Db, bus);

            service.CreateShippingAsync(message).Wait();

            return(bus.DequeueExchange <ShippingDto>(ExchangeNames.DTO));
        }
        private ReservationExpiredMessage CheckDueAsync()
        {
            var bus = BusPublisherStub.Create();

            var service = new ReservationService(Db, bus);

            service.CheckDueAsync().Wait();

            return(bus.Dequeue <ReservationExpiredMessage>(QueueNames.Library));
        }
        private ReservationDtoMessage RequestAsync(ReservationMessage message)
        {
            var bus = BusPublisherStub.Create();

            var service = new ReservationService(Db, bus);

            service.RequestAsync(message).Wait();

            return(bus.Dequeue <ReservationDtoMessage>(QueueNames.Library));
        }
示例#5
0
        private PagedResponse <BookProxy> GetByFilterAsync(PagedRequest <BookFilterPayload> pagination, Settings settings = null)
        {
            settings = settings ?? Settings.Empty;

            var config = ConfigurationStub.Create(() =>
            {
                return(settings);
            });

            var service = new BookService(Db, BusPublisherStub.Create(), config, TenantAccessorStub.Create());

            return(service.GetByFilterAsync(pagination).GetAwaiter().GetResult());
        }
示例#6
0
        private BookProxy GetByIdAsync(Guid id, Settings settings = null)
        {
            settings = settings ?? Settings.Empty;

            var config = ConfigurationStub.Create(() =>
            {
                return(settings);
            });

            var service = new BookService(Db, BusPublisherStub.Create(), config, TenantAccessorStub.Create());

            return(service.GetByIdAsync(id).GetAwaiter().GetResult());
        }
示例#7
0
        private BookUpdateMessage SaveAsync(BookMessage model, Settings settings = null)
        {
            settings = settings ?? Settings.Empty;

            var config = ConfigurationStub.Create(() =>
            {
                return(settings);
            });

            var bus = BusPublisherStub.Create();

            var service = new BookService(Db, bus, config, TenantAccessorStub.Create());

            service.SaveAsync(model).Wait();

            return(bus.DequeueExchange <BookUpdateMessage>(ExchangeNames.Book));
        }
示例#8
0
        private (ShippingDtoMessage Dto, DropCopyNumberMessage Proxy) CreateAsync(PurchaseMessage message, Settings settings = null)
        {
            settings = settings ?? Settings.Empty;

            var config = ConfigurationStub.Create(() =>
            {
                return(settings);
            });

            var bus = BusPublisherStub.Create();

            var service = new PurchaseService(Db, bus, config, TenantAccessorStub.Create());

            service.CreateAsync(message).Wait();

            var drop    = bus.Dequeue <DropCopyNumberMessage>(QueueNames.Library);
            var payload = bus.Dequeue <ShippingDtoMessage>(QueueNames.Bookstore);

            return(payload, drop);
        }
示例#9
0
 public PublishEventCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbLibrary>();
     Bus            = BusPublisherStub.Create();
 }
示例#10
0
 public PurchaseBookCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbBookstore>();
     Bus            = BusPublisherStub.Create();
 }
示例#11
0
 public ReserveBookCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbLibrary>();
     Bus            = BusPublisherStub.Create();
 }
示例#12
0
 public ExpireReservationCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbLibrary>();
     Bus            = BusPublisherStub.Create();
 }
        private PagedResponse <ReservationProxy> GetByFilterAsync(PagedRequest <ReservationFilterPayload> pagination)
        {
            var service = new ReservationService(Db, BusPublisherStub.Create());

            return(service.GetByFilterAsync(pagination).GetAwaiter().GetResult());
        }
        private void ReturnAsync(ReservationReturnMessage message)
        {
            var service = new ReservationService(Db, BusPublisherStub.Create());

            service.ReturnAsync(message).Wait();
        }
示例#15
0
 public SaveBookCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbBook>();
     Bus            = BusPublisherStub.Create();
 }