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

            var service = new ReservationService(Db, bus);

            service.ExpireAsync(message).Wait();
        }
Esempio n. 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));
        }
Esempio n. 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());
        }
Esempio n. 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());
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 9
0
 public PublishEventCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbLibrary>();
     Bus            = BusPublisherStub.Create();
 }
Esempio n. 10
0
 public PurchaseBookCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbBookstore>();
     Bus            = BusPublisherStub.Create();
 }
Esempio n. 11
0
 public ReserveBookCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbLibrary>();
     Bus            = BusPublisherStub.Create();
 }
Esempio n. 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();
        }
Esempio n. 15
0
 public SaveBookCommandHandlerTest()
 {
     MockRepository = new EfMockRepository <DbBook>();
     Bus            = BusPublisherStub.Create();
 }