public void Given_fire_answer_does_not_have_significant_finding_When_GetByChecklistIdAndQuestionId_return_correct_result()
        {
            // Given
            var service = GetService();

            var request = new GetFurtherControlMeasureTaskCountsForAnswerRequest
            {
                FireChecklistId = 34L,
                FireQuestionId = 56L
            };

            var fireAnswer = new FireAnswer();
            fireAnswer.SignificantFinding = null;

            _fireAnswerRepository
                .Setup(x => x.GetByChecklistIdAndQuestionId(request.FireChecklistId, request.FireQuestionId))
                .Returns(fireAnswer)
                ;

            // When
            var result = service.GetFurtherControlMeasureTaskCountsForAnswer(request);

            // Then
            Assert.That(result.TotalCompletedFurtherControlMeasureTaskCount, Is.EqualTo(0));
            Assert.That(result.TotalFurtherControlMeasureTaskCount, Is.EqualTo(0));
        }
        //public virtual FireRiskAssessmentFurtherControlMeasureTaskDto Map(FireRiskAssessmentFurtherControlMeasureTask task)
        //{
        //    return new TaskDtoMapper().Map(task) as FireRiskAssessmentFurtherControlMeasureTaskDto;
        //}

        public GetFurtherControlMeasureTaskCountsForAnswerResponse GetFurtherControlMeasureTaskCountsForAnswer(GetFurtherControlMeasureTaskCountsForAnswerRequest request)
        {
            var answer = _fireAnswerRepository.GetByChecklistIdAndQuestionId(request.FireChecklistId, request.FireQuestionId);

            if (HasNoFurtherControlMeasureTasks(answer))
            {
                return new GetFurtherControlMeasureTaskCountsForAnswerResponse()
                           {
                               TotalFurtherControlMeasureTaskCount = 0,
                               TotalCompletedFurtherControlMeasureTaskCount = 0
                           };
            }

            return new GetFurtherControlMeasureTaskCountsForAnswerResponse()
                       {
                           TotalFurtherControlMeasureTaskCount = answer.SignificantFinding.FurtherControlMeasureTasks.Count(),
                           TotalCompletedFurtherControlMeasureTaskCount = answer.SignificantFinding.FurtherControlMeasureTasks.Count(x => x.TaskStatus == TaskStatus.Completed)
                       };
        }
        public void When_GetByChecklistIdAndQuestionId_is_called_Then_should_call_correct_methods()
        {
            // Given
            var service = GetService();

            var request = new GetFurtherControlMeasureTaskCountsForAnswerRequest
            {
                FireChecklistId = 34L,
                FireQuestionId = 56L
            };

            _fireAnswerRepository
                .Setup(x => x.GetByChecklistIdAndQuestionId(request.FireChecklistId, request.FireQuestionId))
                .Returns(new FireAnswer());

            // When
            service.GetFurtherControlMeasureTaskCountsForAnswer(request);

            // Then
            _fireAnswerRepository.VerifyAll();
        }
        public void Given_fire_answer_with_significant_finding_and_has_a_completed_task_When_GetByChecklistIdAndQuestionId_return_correct_result()
        {
            // Given
            var service = GetService();

            var request = new GetFurtherControlMeasureTaskCountsForAnswerRequest
            {
                FireChecklistId = 34L,
                FireQuestionId = 56L
            };

            var fireAnswer = new FireAnswer();
            var significantFinding = new SignificantFinding
            {
                FurtherControlMeasureTasks = new List<FireRiskAssessmentFurtherControlMeasureTask>
                {
                    new FireRiskAssessmentFurtherControlMeasureTask
                    {
                        Id = 12L,
                        TaskCompletedDate = DateTime.Now,
                        TaskCompletedComments = "my comments",
                        TaskStatus = TaskStatus.Completed,
                        Deleted = false
                    }
                }
            };
            fireAnswer.SignificantFinding = significantFinding;

            _fireAnswerRepository
               .Setup(x => x.GetByChecklistIdAndQuestionId(request.FireChecklistId, request.FireQuestionId))
               .Returns(fireAnswer)
               ;

            // When
            var result = service.GetFurtherControlMeasureTaskCountsForAnswer(request);

            // Then
            Assert.That(result.TotalCompletedFurtherControlMeasureTaskCount, Is.EqualTo(1));
        }