Beispiel #1
0
        public void Remove_NotExistingIdPassed_ReturnsNotFoundResponse()
        {
            // Arrange
            var notExistingId = 666;

            // Act
            var badResponse = _controller.Delete(notExistingId);

            // Assert
            Assert.IsType <NotFoundResult>(badResponse);
        }
Beispiel #2
0
        public void TestDeleteInvoice()
        {
            InvoiceController ic = new InvoiceController();
            System.Web.Mvc.ViewResult result = ic.Index(null,null,null) as ViewResult;

            Invoice i = ((IPagedList<Invoice>)result.ViewData.Model).First();
            Assert.NotNull(i);

            //ask deletion action
            System.Web.Mvc.ActionResult invoiceAskDeletion = ic.Delete(i.InvoiceID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), invoiceAskDeletion);

            //delete action
            System.Web.Mvc.ActionResult invoiceDeletion = ic.DeleteConfirmed(i.InvoiceID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), invoiceDeletion);
        }
Beispiel #3
0
        public void TestDeleteInvoice()
        {
            InvoiceController ic = new InvoiceController();

            System.Web.Mvc.ViewResult result = ic.Index(null, null, null) as ViewResult;

            Invoice i = ((IPagedList <Invoice>)result.ViewData.Model).First();

            Assert.NotNull(i);

            //ask deletion action
            System.Web.Mvc.ActionResult invoiceAskDeletion = ic.Delete(i.InvoiceID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), invoiceAskDeletion);

            //delete action
            System.Web.Mvc.ActionResult invoiceDeletion = ic.DeleteConfirmed(i.InvoiceID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), invoiceDeletion);
        }