public IEnumerable <DTOReportingInvoice> GetInvoiceList() { using (var ctx = new ChinookContext()) { var mapCfg = new MapperConfiguration(cfg => cfg.AddProfile <MapperProfile>()); var map = mapCfg.CreateMapper(); var invoiceStore = new InvoiceStore(ctx, map); var invoiceLineStore = new InvoiceLineStore(ctx, map); var invoices = invoiceStore.Query <DTOReportingInvoice>() .Where(i => invoiceIds.Contains(i.InvoiceId)).ToList(); var lines = invoiceLineStore.Query() .Where(i => invoiceIds.Contains(i.InvoiceId)).ToList(); foreach (var invoice in invoices) { lines.RemoveAll(i => i.InvoiceId == invoice.InvoiceId, o => invoice.InvoiceLines.Add(o)); } var r = invoices.ToList(); return(r); } }
public void Setup() { var fileHandler = new Mock <IFileHandler>(); fileHandler.Setup(x => x.ReadAll(It.IsAny <string>())).Returns(GetInvoiceSample()); var appConfig = new Mock <IAppConfiguration>(); invoiceStore = new InvoiceStore(appConfig.Object, fileHandler.Object); }
public async Task MyTestMethod() { var underlyingStore = new InMemoryKVStore(); var store = new InvoiceStore(underlyingStore); var invoice = new InvoiceFull { Invoice = new MediusFlowAPI.Models.SupplierInvoiceGadgetData.Invoice { InvoiceDate = DateTime.Today.ToMediusDate(), Supplier = new MediusFlowAPI.Models.SupplierInvoiceGadgetData.Supplier { Name = "Supplier" }, Id = 1 }, TaskAssignments = new List <InvoiceFull.TaskAssignmentAndTasks> { new InvoiceFull.TaskAssignmentAndTasks { Task = new InvoiceFull.TaskFull { Task = new MediusFlowAPI.Models.Task.Response { CreatedTimestamp = DateTime.Today.ToMediusDate(), State = 1 } } } } }; await store.Post(invoice); var filenameFormat = InvoiceFull.FilenameFormat.Parse(InvoiceFull.FilenameFormat.Create(invoice)); var retrieved = await underlyingStore.Get(filenameFormat.ToString()); if (retrieved is string serialized) { Newtonsoft.Json.JsonConvert.DeserializeObject(serialized); } else { throw new FormatException("Not a string"); } //var xx = await store.Get(filenameFormat); }
public InvoicesAuthorize(BusinessAuthorize businessAuthorize, InvoiceStore invoiceStore, ClientsAuthorize clientsAuthorize) { this.businessAuthorize = businessAuthorize; this.invoiceStore = invoiceStore; this.clientsAuthorize = clientsAuthorize; }
public InvoiceService(InvoiceStore invoiceStore) { _invoiceStore = invoiceStore; }
public InvoiceService(InvoiceStore invoiceStore, NotificationSender notificationSender) { this.invoiceStore = invoiceStore; this.notificationSender = notificationSender; }
public BusinessAuthorize(BusinessStore businessStore, InvoiceStore invoiceStore, ClientStore clientStore) { this.businessStore = businessStore; this.invoiceStore = invoiceStore; this.clientStore = clientStore; }