public void Summary_Get_ReturnsTotalLoggedTime() { // arrange var tasksRepository = new Mock<ITasksRepository>(); var controller = new TaskManagementController(tasksRepository.Object); var tasks = new List<Task> { new Task { Id = 1, ActualWork = 10 }, new Task { Id = 2, ActualWork = 15 }, new Task { Id = 3, ActualWork = 20 } }; tasksRepository.Setup(t => t.Tasks).Returns(tasks.AsQueryable()); // act var result = controller.Summary() as ViewResult; // assert var model = result.ViewData.Model as TaskSummaryModel; Assert.That(model.TotalLoggedTime, Is.EqualTo(45)); }