public void TestEditInvoiceDetails() { InvoiceDetailsController idc = new InvoiceDetailsController(); System.Web.Mvc.ViewResult result = idc.Index(); InvoiceDetails id = ((List<InvoiceDetails>)result.ViewData.Model).First(); System.Web.Mvc.ActionResult invoiceDetailsEdition = idc.Edit(id.InvoiceDetailsID); //post edited id.Price= 9999; System.Web.Mvc.ActionResult resultEdition = idc.Edit(id); Assert.IsInstanceOf(typeof(System.Web.Mvc.PartialViewResult), resultEdition); }
public void TestDeleteInvoiceDetails() { InvoiceDetailsController idc = new InvoiceDetailsController(); System.Web.Mvc.ViewResult result = idc.Index(); InvoiceDetails id = ((List<InvoiceDetails>)result.ViewData.Model).First(); Assert.NotNull(id); //ask deletion action System.Web.Mvc.ActionResult invoiceDetailsAskDeletion = idc.Delete(id.InvoiceDetailsID); Assert.IsInstanceOf(typeof(System.Web.Mvc.PartialViewResult), invoiceDetailsAskDeletion); //delete action System.Web.Mvc.ActionResult invoiceDetailDeletion = idc.DeleteConfirmed(id.InvoiceDetailsID); Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), invoiceDetailDeletion); }