public void Invoice_Service_Add_Sucessfully() { //Arrange var invoice = ObjectMother.InvoiceValidWithoutIdWithIssuerAddresseeShippingCompanyId(1, 1, 1); var invoiceCmd = ObjectMother.InvoiceCommandToRegister(1, 1, 1); _mockInvoiceRepository.Setup(ir => ir.Add(It.IsAny <Invoice>())).Returns(invoice); //Action var addInvoice = _invoiceService.Add(invoiceCmd); //Verificar _mockInvoiceRepository.Verify(ir => ir.Add(It.IsAny <Invoice>())); addInvoice.Should().Be(invoice.Id); }
public ResultViewModel <InvoiceEditViewModel> Add(InvoiceEditViewModel inv) { ResultViewModel <InvoiceEditViewModel> result = new ResultViewModel <InvoiceEditViewModel>(); try { if (!ModelState.IsValid) { result.Message = "In Valid Model State"; } else { InvoiceEditViewModel selectedEmp = InvoiceService.Add(inv); result.Successed = true; result.Data = selectedEmp; } } catch (Exception ex) { result.Successed = false; result.Message = "Semething Went Wrong"; } return(result); }
private static void AddInvoice(IUnitOfWork uow) { var customer = new CustomerService(uow).Get(1); var product1 = new ProductService(uow).Get(1); var product2 = new ProductService(uow).Get(2); var product3 = new ProductService(uow).Get(3); IInvoiceService invoiceService = new InvoiceService(uow); invoiceService.Add(new InvoicePersist { CustomerId = customer.CustomerId , IssueDate = DateTime.Now , InvoiceLines = new List <InvoiceLinePersist> { new InvoiceLinePersist { Price = 100, Qty = 2, ProductId = product1.ProductId } , new InvoiceLinePersist { Price = 200, Qty = 2, ProductId = product2.ProductId } , new InvoiceLinePersist { Price = 200, Qty = 2, ProductId = product3.ProductId } } }); uow.SaveChage(); }
public ActionResult Add(ProductList model) { var products = _invoiceService.Add(model, HttpContext); // = _invoiceService.ProductList(HttpContext); // products.Add(model); return(PartialView("_Products", products.ToList())); }
public async Task <int> Add(AddInvoiceDto addInvoiceDto) { return(await _service.Add(addInvoiceDto)); }
// POST api/<controller> public void Post(CustomerInvoice value) { var invoiceService = new InvoiceService(); invoiceService.Add(GlobalVariables.SapSessionId, value); }