public void Get_should_return_invoice()
        {
            // Hardcoded invoice
            var actual = testSubject.Get("1");

            // Assert
            Assert.NotNull(actual);
        }
        public IHttpActionResult Get(int id)
        {
            var user = InvoiceRepo.Get(id);

            if (user == null)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            return(Ok(InvoiceRepo.Get(id)));
        }
Ejemplo n.º 3
0
        public Invoice Get(int id)
        {
            var invoice = _repository.Get(id);

            if (invoice != null)
            {
                return(invoice);
            }
            else
            {
                throw new ObjectNotFoundException($"Not found an invoice with Id {id}");
            }
        }
Ejemplo n.º 4
0
        public void Get_Success_ReturnEntity()
        {
            // Arrange
            var repository = new InvoiceRepository();
            var input      = repository.Create(GenerateInput());

            // Act
            var result = repository.Get(input.Id);

            // Assert
            Assert.IsInstanceOf <Invoice>(result);
        }
Ejemplo n.º 5
0
 // GET: Invoicing/Invoices/Edit/5
 public ActionResult Edit(string id)
 {
     try
     {
         var objectId = ObjectId.Parse(id);
         var invoice  = repository.Get(objectId);
         return(View(invoice));
     }
     catch
     {
         return(null);
     }
 }
Ejemplo n.º 6
0
        public ActionResult Service(int invoiceId)
        {
            var lineItem = new InvoiceItem();
            var repo     = new InvoiceRepository();

            lineItem.Service  = new ServiceRepository().Get(1);
            lineItem.Invoice  = repo.Get(invoiceId);
            lineItem.IsActive = true;
            repo.AddLineItem(lineItem);


            return(View(lineItem));
        }
Ejemplo n.º 7
0
        public void Delete_Success_ReturnNull()
        {
            // Arrange
            var repository = new InvoiceRepository();
            var input      = repository.Create(GenerateInput());

            // Act
            repository.Delete(input.Id);
            var result = repository.Get(input.Id);

            // Assert
            Assert.IsNull(result);
        }
Ejemplo n.º 8
0
 public ActionResult GetDetailsFormPartialView(int id)
 {
     return(PartialView("_DetailsFormPartialView", _repository.Get(id)));
 }
        public async Task GIVEN_no_invoice_with_id_WHEN_Get_THEN_throws(Guid invoiceId)
        {
            A.CallTo(() => _dbContext.Invoices).Returns(ContainerFactory.FakeContainer(new InvoiceState[0]));

            await Assert.ThrowsAsync <AggregateNotFoundException <Invoice> >(() => _sut.Get(invoiceId));
        }
Ejemplo n.º 10
0
 public Invoice  Id(int invoiceId)
 {
     return(_repository.Get(invoiceId));
 }
 public ActionResult GetModificationPartialView(int id)
 {
     return(PartialView("_ModificationPartialView", _repository.Get(id)));
 }