public void Remove_NotExistingIdPassed_ReturnsNotFoundResponse() { // Arrange var notExistingId = 666; // Act var badResponse = _controller.Delete(notExistingId); // Assert Assert.IsType <NotFoundResult>(badResponse); }
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); }
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); }