public async Task RemoveTaskAsync_WorkTaskNotExists_RemoveNotPerformed()
        {
            IDbRepository <ITasksGroup> dbRepository = A.Fake <IDbRepository <ITasksGroup> >();

            A.CallTo(() => dbRepository.ListAsync()).Returns(new List <ITasksGroup>());
            TasksGroupService tasksGroupService =
                new TasksGroupService(dbRepository, mTasksGroupFactory, NullLogger <TasksGroupService> .Instance);

            IResponse <IWorkTask> response = await tasksGroupService.RemoveTaskAsync("notExistingId").ConfigureAwait(false);

            A.CallTo(() => dbRepository.UpdateAsync(A <ITasksGroup> .Ignored)).MustNotHaveHappened();
        }
        public async Task RemoveTaskAsync_WorkTaskNotExists_FailResponseReturned()
        {
            IDbRepository <ITasksGroup> dbRepository = A.Fake <IDbRepository <ITasksGroup> >();

            A.CallTo(() => dbRepository.ListAsync()).Returns(new List <ITasksGroup>());
            TasksGroupService tasksGroupService =
                new TasksGroupService(dbRepository, mTasksGroupFactory, NullLogger <TasksGroupService> .Instance);

            IResponse <IWorkTask> response = await tasksGroupService.RemoveTaskAsync("notExistingId").ConfigureAwait(false);

            Assert.False(response.IsSuccess);
            Assert.Null(response.ResponseObject);
        }
        public async Task RemoveTaskAsync_TaskExists_TaskRemoved()
        {
            IWorkTask taskToRemove = A.Fake <IWorkTask>();
            OperationResult <IWorkTask> getTaskResult = new OperationResult <IWorkTask>(true, taskToRemove);

            ITasksGroup tasksGroup = A.Fake <ITasksGroup>();

            A.CallTo(() => tasksGroup.GetTask(A <string> .Ignored)).Returns(getTaskResult);

            IDbRepository <ITasksGroup> dbRepository = A.Fake <IDbRepository <ITasksGroup> >();

            A.CallTo(() => dbRepository.ListAsync()).Returns(new List <ITasksGroup>()
            {
                tasksGroup
            });
            TasksGroupService tasksGroupService =
                new TasksGroupService(dbRepository, mTasksGroupFactory, NullLogger <TasksGroupService> .Instance);

            await tasksGroupService.RemoveTaskAsync(tasksGroup.ID).ConfigureAwait(false);

            A.CallTo(() => tasksGroup.RemoveTask(A <string> .Ignored)).MustHaveHappenedOnceExactly();
            A.CallTo(() => dbRepository.UpdateAsync(tasksGroup)).MustHaveHappenedOnceExactly();
        }
        public async Task RemoveTaskAsync_TaskExists_SuccessResponseReturned()
        {
            IWorkTask taskToRemove = A.Fake <IWorkTask>();
            OperationResult <IWorkTask> getTaskResult = new OperationResult <IWorkTask>(true, taskToRemove);

            ITasksGroup tasksGroup = A.Fake <ITasksGroup>();

            A.CallTo(() => tasksGroup.GetTask(A <string> .Ignored)).Returns(getTaskResult);

            IDbRepository <ITasksGroup> dbRepository = A.Fake <IDbRepository <ITasksGroup> >();

            A.CallTo(() => dbRepository.ListAsync()).Returns(new List <ITasksGroup>()
            {
                tasksGroup
            });
            TasksGroupService tasksGroupService =
                new TasksGroupService(dbRepository, mTasksGroupFactory, NullLogger <TasksGroupService> .Instance);

            IResponse <IWorkTask> response = await tasksGroupService.RemoveTaskAsync(tasksGroup.ID).ConfigureAwait(false);

            Assert.True(response.IsSuccess);
            Assert.Equal(taskToRemove, response.ResponseObject);
        }