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()); }
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()); }
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)); }
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); }