Пример #1
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());
        }
Пример #2
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());
        }
Пример #3
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));
        }
Пример #4
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);
        }