public void Should_map_all_properties() { var refDataBuilder = new RefDataBuilder(); var venue = refDataBuilder.HearingVenues.First(x => x.Name == _hearingVenueName); var caseType = new CaseType(1, _caseTypeName); var hearingType = Builder <HearingType> .CreateNew().WithFactory(() => new HearingType(_hearingTypeName)).Build(); var scheduledDateTime = DateTime.Today.AddDays(1).AddHours(11).AddMinutes(45); var duration = 80; var hearingRoomName = "Roome03"; var otherInformation = "OtherInformation03"; var createdBy = "User03"; const bool questionnaireNotRequired = false; const bool audioRecordingRequired = true; var cancelReason = "Online abandonment (incomplete registration)"; var hearing = new VideoHearing(caseType, hearingType, scheduledDateTime, duration, venue, hearingRoomName, otherInformation, createdBy, questionnaireNotRequired, audioRecordingRequired, cancelReason); _videoHearing = Builder <VideoHearing> .CreateNew().WithFactory(() => hearing).Build(); var applicantCaseRole = new CaseRole(1, "Applicant"); var applicantLipHearingRole = new HearingRole(1, "Litigant in person") { UserRole = new UserRole(1, "Individual") }; _videoHearing.AddCase("0875", "Test Case Add", false); var person1 = new PersonBuilder(true).Build(); _videoHearing.AddIndividual(person1, applicantLipHearingRole, applicantCaseRole, $"{person1.FirstName} {person1.LastName}"); var party = _videoHearing.GetParticipants().FirstOrDefault(); party.SetProtected(nameof(party.CaseRole), applicantCaseRole); party.SetProtected(nameof(party.HearingRole), applicantLipHearingRole); var endpoints = new Endpoint("displayName", "333", "200", null); _videoHearing.AddEndpoint(endpoints); // Set the navigation properties as well since these would've been set if we got the hearing from DB _videoHearing.SetProtected(nameof(_videoHearing.HearingType), hearingType); _videoHearing.SetProtected(nameof(_videoHearing.CaseType), caseType); _videoHearing.SetProtected(nameof(_videoHearing.HearingVenue), venue); var response = _mapper.MapHearingToDetailedResponse(_videoHearing); response.Should().BeEquivalentTo(response, options => options .Excluding(v => v.Id) ); }
public VideoHearingBuilder() { var refDataBuilder = new RefDataBuilder(); var venue = refDataBuilder.HearingVenues.First(x => x.Name == _hearingVenueName); var caseType = new CaseType(1, _caseTypeName); var hearingType = Builder <HearingType> .CreateNew().WithFactory(() => new HearingType(_hearingTypeName)).Build(); var scheduledDateTime = DateTime.Today.AddDays(1).AddHours(11).AddMinutes(45); var duration = 80; var hearingRoomName = "Roome03"; var otherInformation = "OtherInformation03"; var createdBy = "User03"; const bool questionnaireNotRequired = false; const bool audioRecordingRequired = true; var cancelReason = "Online abandonment (incomplete registration)"; _videoHearing = Builder <VideoHearing> .CreateNew().WithFactory(() => new VideoHearing(caseType, hearingType, scheduledDateTime, duration, venue, hearingRoomName, otherInformation, createdBy, questionnaireNotRequired, audioRecordingRequired, cancelReason)) .Build(); var applicantCaseRole = new CaseRole(1, "Applicant") { Group = CaseRoleGroup.Applicant }; var respondentCaseRole = new CaseRole(2, "Respondent") { Group = CaseRoleGroup.Respondent }; var applicantLipHearingRole = new HearingRole(1, "Litigant in person") { UserRole = new UserRole(1, "Individual") }; var respondentRepresentativeHearingRole = new HearingRole(5, "Representative") { UserRole = new UserRole(1, "Representative") }; var respondentLipHearingRole = new HearingRole(4, "Litigant in person") { UserRole = new UserRole(1, "Individual") }; var judgeCaseRole = new CaseRole(5, "Judge") { Group = CaseRoleGroup.Judge }; var judgeHearingRole = new HearingRole(13, "Judge") { UserRole = new UserRole(1, "Judge") }; var johHearingRole = new HearingRole(14, "Judicial Office Holder") { UserRole = new UserRole(7, "Judicial Office Holder") }; var johCaseRole = new CaseRole(11, "Winger") { Group = CaseRoleGroup.Winger }; var person1 = new PersonBuilder(true).Build(); var person2 = new PersonBuilder(true).Build(); var person3 = new PersonBuilder(true).Build(); _judgePerson = new PersonBuilder(true).Build(); _johPerson = new PersonBuilder(true).Build(); _videoHearing.AddIndividual(person1, applicantLipHearingRole, applicantCaseRole, $"{person1.FirstName} {person1.LastName}"); var indApplicant = _videoHearing?.Participants.Last(); indApplicant.SetProtected(nameof(indApplicant.CaseRole), applicantCaseRole); indApplicant.SetProtected(nameof(indApplicant.HearingRole), applicantLipHearingRole); _videoHearing.AddIndividual(person3, respondentLipHearingRole, respondentCaseRole, $"{person3.FirstName} {person3.LastName}"); var indRespondent = _videoHearing?.Participants.Last(); indRespondent.SetProtected(nameof(indApplicant.CaseRole), respondentCaseRole); indRespondent.SetProtected(nameof(indRespondent.HearingRole), respondentLipHearingRole); _videoHearing.AddRepresentative(person2, respondentRepresentativeHearingRole, respondentCaseRole, $"{person2.FirstName} {person2.LastName}", string.Empty); var repRespondent = _videoHearing?.Participants.Last(); repRespondent.SetProtected(nameof(indApplicant.CaseRole), respondentCaseRole); repRespondent.SetProtected(nameof(repRespondent.HearingRole), respondentRepresentativeHearingRole); _videoHearing.AddJudge(_judgePerson, judgeHearingRole, judgeCaseRole, $"{_judgePerson.FirstName} {_judgePerson.LastName}"); var judge = _videoHearing?.Participants.Last(); judge.SetProtected(nameof(indApplicant.CaseRole), judgeCaseRole); judge.SetProtected(nameof(judge.HearingRole), judgeHearingRole); _videoHearing.AddJudicialOfficeHolder(_johPerson, johHearingRole, johCaseRole, $"{_johPerson.FirstName} {_johPerson.LastName}"); var joh = _videoHearing?.Participants.Last(); joh.SetProtected(nameof(indApplicant.CaseRole), johCaseRole); joh.SetProtected(nameof(joh.HearingRole), johHearingRole); // Set the navigation properties as well since these would've been set if we got the hearing from DB _videoHearing.SetProtected(nameof(_videoHearing.HearingType), hearingType); _videoHearing.SetProtected(nameof(_videoHearing.CaseType), caseType); _videoHearing.SetProtected(nameof(_videoHearing.HearingVenue), venue); }