public static FireAnswer Create( FireRiskAssessmentChecklist fireRiskAssessmentChecklist, Question question, YesNoNotApplicableEnum? yesNoNotApplicableResponse, string additionalInfo, UserForAuditing user) { var fireAnswer = new FireAnswer { FireRiskAssessmentChecklist = fireRiskAssessmentChecklist, Question = question, YesNoNotApplicableResponse = yesNoNotApplicableResponse, AdditionalInfo = additionalInfo, CreatedOn = DateTime.Now, CreatedBy = user }; if (yesNoNotApplicableResponse == YesNoNotApplicableEnum.No) { var significantFinding = SignificantFinding.Create(fireAnswer, user); fireAnswer.SignificantFinding = significantFinding; } return fireAnswer; }
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 void TestFixtureSetUp() { _fireAnswer = FireAnswer.Create(null, null, YesNoNotApplicableEnum.No, "some additional info", _currentUser); _currentUser = new UserForAuditing { Id = Guid.NewGuid() }; _significantFinding = SignificantFinding.Create(_fireAnswer, _currentUser); }
private static FireRiskAssessmentFurtherControlMeasureTask CreateFireRiskAssessmentFurtherControlMeasureTask() { var fireRiskAssessment = new FireRiskAssessment(); var fireRiskAssessmentChecklist = new FireRiskAssessmentChecklist(); fireRiskAssessmentChecklist.FireRiskAssessment = fireRiskAssessment; var fireAnswer = new FireAnswer(); fireAnswer.FireRiskAssessmentChecklist = fireRiskAssessmentChecklist; fireRiskAssessmentChecklist.Answers.Add(fireAnswer); var significantFinding = SignificantFinding.Create(fireAnswer, null); var fraTask = new FireRiskAssessmentFurtherControlMeasureTask(); fraTask.SignificantFinding = significantFinding; return fraTask; }
private bool HasNoFurtherControlMeasureTasks(FireAnswer answer) { return answer == null || answer.SignificantFinding == null || answer.SignificantFinding.FurtherControlMeasureTasks.Any(x => x.Deleted == false) == false; }
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)); }
public FireAnswerDto Map(FireAnswer entity) { return new AnswerDtoMapper().Map(entity) as FireAnswerDto; }