public void Add_POST_ReturnsRedirectToActionResultIfModelStateIsValid() { //arrange var rep = new Mock <ITicketRepository>(); var controller = new TicketingController(rep.Object); var model = new TicketViewModel(); //act var result = controller.Add(model); //assert Assert.IsType <RedirectToActionResult>(result); }
public void Add_POST_ReturnsViewResultIfModelStateIsInValid() { //arrange var rep = new Mock <ITicketRepository>(); var controller = new TicketingController(rep.Object); var model = new TicketViewModel(); //act controller.ModelState.AddModelError("Error", "This is a fake error"); var result = controller.Add(model); //assert Assert.IsType <ViewResult>(result); }