Пример #1
0
        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);
        }
Пример #2
0
        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);
        }