public void Can_Paginate() { // create a controller and make the page size 3 items StaffController staffController = new StaffController(mock.Object, queryProc); staffController.PageSize = 3; // Action //TicketsListViewModel result = (TicketsListViewModel)staffController.ViewTickets().Model; var result = staffController.ViewTickets("",-1,2); var resultModel = ((ViewResult)result).Model; TicketsListViewModel model = (TicketsListViewModel)resultModel; // Assert Tickets[] prodArray = model.Tickets.ToArray(); Assert.IsTrue(prodArray.Length > 0); Assert.AreEqual(prodArray[0].Id, 3); }
public void Find_Correct_Reference_InTickets() { StaffController staffController = new StaffController(mock.Object, queryProc); var result = staffController.ViewTickets("AAA-000001"); var resultModel = ((ViewResult)result).Model; TicketsListViewModel model = (TicketsListViewModel)resultModel; Assert.IsTrue(model.Tickets.ToList().Count() > 0); }
public void OpenTicketsList() { var result = new StaffController(mock.Object, queryProc); Assert.IsNotNull(result); }
public void Open_Edit_Ticket() { //listTickets.Find(x => x.Id == 1) StaffController staffController = new StaffController(mock.Object, queryProc); var result = staffController.Edit(1); Tickets resultModel = (Tickets)((ViewResult)result).Model; Assert.IsTrue(resultModel.Id == 1); result = staffController.Edit(100); Assert.IsInstanceOf<HttpNotFoundResult>(result); }