public void Given_valid_model_state_When_NewFurtherControlMeasureTask_Request_Then_should_call_correct_methods()
        {
            // Given
            var controller = GetTarget();
            var viewModel = new AddEditFireRiskAssessmentFurtherControlMeasureTaskViewModel()
                                {
                                    CompanyId = 123L,
                                    RiskAssessmentId = 789L,
                                    Title = "TItle",
                                    Description = "A description",
                                    Reference = "My reference",
                                    SignificantFindingId = 888L,
                                    TaskStatusId = 3
                                };
            var documentsToSave = new DocumentsToSaveViewModel();

            var result = new FireRiskAssessmentFurtherControlMeasureTaskDto();
            _furtherControlMeasureTaskService
                .Setup(x => x.AddFurtherControlMeasureTask(It.Is<SaveFurtherControlMeasureTaskRequest>(
                    y => y.CompanyId == viewModel.CompanyId &&
                         y.RiskAssessmentId == viewModel.RiskAssessmentId &&
                         y.Title == viewModel.Title &&
                         y.Description == viewModel.Description &&
                         y.Reference == viewModel.Reference &&
                         y.SignificantFindingId == viewModel.SignificantFindingId &&
                         y.TaskStatus == (TaskStatus)viewModel.TaskStatusId
                    )))
                .Returns(result);

            // When
            controller.NewFurtherControlMeasureTask(viewModel, documentsToSave);

            // Then
            _furtherControlMeasureTaskService.VerifyAll();
        }
        public TaskDto MapWithAssignedTo(Task entity)
        {
            TaskDto dto = null;

            if (entity.Self as ResponsibilityTask != null)
            {
                var responsibilityTask = (ResponsibilityTask) entity;
                dto = new ResponsibilityTaskDto()
                          {
                              Responsibility = new ResponsibilityDto()
                                                   {
                                                       Id = responsibilityTask.Responsibility.Id,
                                                       Title = responsibilityTask.Responsibility.Title,
                                                       Description = responsibilityTask.Responsibility.Description
                                                   }
                          };

            }

            if (entity.Self as ActionTask != null)
            {
                dto = new ActionTaskDto();
            }


            if (entity.Self as RiskAssessmentReviewTask != null)
            {
                dto = new RiskAssessmentReviewTaskDto();
            }

            if (entity.Self as MultiHazardRiskAssessmentFurtherControlMeasureTask != null)
            {

                if (entity.RiskAssessment.Self is GeneralRiskAssessment)
                {
                    dto = new MultiHazardRiskAssessmentFurtherControlMeasureTaskDto();

                    dto.DefaultDocumentType = DocumentTypeEnum.GRADocumentType; //TODO: This does not belong here, it belongs in the entity then map that. PTD.
                }

                if (entity.RiskAssessment.Self is PersonalRiskAssessment)
                {
                    dto = new MultiHazardRiskAssessmentFurtherControlMeasureTaskDto();
                    dto.DefaultDocumentType = DocumentTypeEnum.PRADocumentType; //TODO: This does not belong here, it belongs in the entity then map that. PTD.
                }

            }

            if (entity.Self as HazardousSubstanceRiskAssessmentFurtherControlMeasureTask != null)
            {
                dto = new HazardousSubstanceRiskAssessmentFurtherControlMeasureTaskDto();

                dto.DefaultDocumentType = DocumentTypeEnum.HSRADocumentType; //TODO: This does not belong here, it belongs in the entity then map that. PTD.
            }

            if (entity.Self as FireRiskAssessmentFurtherControlMeasureTask != null)
            {
                dto = new FireRiskAssessmentFurtherControlMeasureTaskDto();
                dto.DefaultDocumentType = DocumentTypeEnum.FRADocumentType; //TODO: This does not belong here, it belongs in the entity then map that. PTD.
            }

            return PopulateTaskDto(entity, dto);
        }