コード例 #1
0
 public void MaintTaskControllerEnsureIndexViewExists()
 {
     // Arrange
     MaintTaskController controller = new MaintTaskController();
     // Act
     ViewResult result = controller.Index() as ViewResult;
     // Assert
     Assert.AreEqual("Index", result.ViewName);
 }
コード例 #2
0
 public void MaintTaskControllerEnsureIndexPageExists()
 {
     // Arrange
     MaintTaskController controller = new MaintTaskController();
     // Act
     ViewResult result = controller.Index() as ViewResult;
     // Assert
     Assert.IsNotNull(result);
 }
コード例 #3
0
 public void MaintTaskControllerEnsureItHasThings()
 {
     // Arrange
     MaintTaskController controller = new MaintTaskController();
     // Act
     ViewResult result = controller.Index() as ViewResult;
     // Assert
     string expected_message = "My Maint Task Reminders";
     Assert.AreEqual(expected_message, result.ViewBag.Message);
 }
コード例 #4
0
        public void MaintTaskControllerEnsureListOfUserMaintTasks()
        {
            // Arrange
            List<MaintTask> data_store_m_tasks = new List<MaintTask>
            {
                new MaintTask {Title = "My Maint Task", MaintTaskId = 1, Owner = owner  },
                new MaintTask {Title = "My Maint Task 2", MaintTaskId = 2, Owner = owner  }
            };
            MaintTaskController controller = new MaintTaskController(mock_repository.Object);
            mock_repository.Setup(r => r.GetAllMaintTasks()).Returns(data_store_m_tasks);
            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            CollectionAssert.AreEqual(data_store_m_tasks, result.ViewBag.MaintTasks);
        }