Exemple #1
0
        public void TestTimeTasksRepository_ShouldRemoveTask()
        {
            // Arrange
            var repository = new TimeTasksRepository(DatabaseContext);
            var mapper     = new TimeTasksMapper();
            var tasksList  = TestTaskListProvider.GetMockTimeTaskContexts(1);
            var task       = tasksList[1];

            // Act
            repository.SaveTask(mapper.ReverseMap(tasksList[0]));
            repository.SaveTask(mapper.ReverseMap(tasksList[1]));
            repository.SaveTask(mapper.ReverseMap(tasksList[2]));

            repository.RemoveTasks(new List <int> {
                task.Id
            });

            var returnedList = repository.GetSavedTasksForToday("").ToList();

            // Assert
            Assert.True(returnedList.Count == tasksList.Count - 1);
            Assert.True(returnedList[0].Name == "NAME1");
            Assert.True(returnedList[1].Name == "NAME2");
            Assert.True(returnedList[1].Priority == Priority.Three);
        }
 /// <summary>
 /// Default constructor
 /// </summary>
 public TimeTasksService(ITimeTasksRepository timeTasksRepository, TimeTasksMapper tasksMapper)
 {
     // Get injected DI services
     mTimeTasksRepository = timeTasksRepository;
     mTimeTasksMapper     = tasksMapper;
 }