public void Should_map_suitability_answears_items_to_response_list() { var result = mapper.MapToResponses(suitabilityAnswers); result.Should().NotBeNull(); result.Count.Should().Equals(3); }
private static PersonSuitabilityAnswerResponse BuildResponse(Hearing hearing, string username) { PersonSuitabilityAnswerResponse personSuitabilityAnswer = null; if (hearing.Participants != null) { var participant = hearing.Participants.FirstOrDefault(p => p.Person.Username.ToLower() == username.Trim().ToLower()); if (participant != null) { var answers = participant.Questionnaire != null ? participant.Questionnaire.SuitabilityAnswers : new List <SuitabilityAnswer>(); var suitabilityAnswerToResponseMapper = new SuitabilityAnswerToResponseMapper(); personSuitabilityAnswer = new PersonSuitabilityAnswerResponse { HearingId = hearing.Id, ParticipantId = participant.Id, UpdatedAt = participant.Questionnaire?.UpdatedDate ?? DateTime.MinValue, ScheduledAt = hearing.ScheduledDateTime, Answers = suitabilityAnswerToResponseMapper.MapToResponses(answers), QuestionnaireNotRequired = hearing.QuestionnaireNotRequired }; } } return(personSuitabilityAnswer); }