public void TestEditInvoice() { InvoiceController ic = new InvoiceController(); ActionResult result = ic.Index(null,null,null); ViewResult view = result as ViewResult; Invoice i = ((IPagedList<Invoice>)view.ViewData.Model).First(); System.Web.Mvc.ActionResult invoiceEdition = ic.Edit(i.InvoiceID); //post edited i.Name = "Change invoice name test"; //get System.Web.Mvc.ActionResult resultEditionView = ic.Edit(i.InvoiceID); Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), resultEditionView); //post System.Web.Mvc.ActionResult resultEdition = ic.Edit(i); Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), resultEdition); }
public void TestEditInvoice() { InvoiceController ic = new InvoiceController(); ActionResult result = ic.Index(null, null, null); ViewResult view = result as ViewResult; Invoice i = ((IPagedList <Invoice>)view.ViewData.Model).First(); System.Web.Mvc.ActionResult invoiceEdition = ic.Edit(i.InvoiceID); //post edited i.Name = "Change invoice name test"; //get System.Web.Mvc.ActionResult resultEditionView = ic.Edit(i.InvoiceID); Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), resultEditionView); //post System.Web.Mvc.ActionResult resultEdition = ic.Edit(i); Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), resultEdition); }