コード例 #1
0
 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);
     
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 public void OpenTicketsList()
 {
     var result = new StaffController(mock.Object, queryProc);
     Assert.IsNotNull(result);
 }
コード例 #4
0
 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);
 }