コード例 #1
0
        public void GetAllItemsTest()
        {
            var rootTask = new Task {
                Id = TaskId
            };
            var subTask = new Task {
                Id = 2, ParentId = TaskId
            };
            var tasks = new List <Task> {
                rootTask, subTask
            };

            _tasksRepositoryMock.Setup(tasksRepository => tasksRepository.GetAll()).Returns(tasks);
            // TODO: Setup mapper Mock

            var actualTasks = _tasksService.GetAllItems().ToList();

            // TODO: Verify _tasksRepositoryMock GetAll

            Assert.AreEqual(1, actualTasks.Count);

            var actualTask = actualTasks.Single();

            Assert.AreEqual(TaskId, actualTask.Id);
            Assert.AreEqual(2, actualTask.SubTasks.Single().Id);
        }