/// <summary> /// Returns the person model for an exchange visitor. /// </summary> /// <param name="biography">The biography of the participant.</param> /// <param name="participantExchangeVisitor">The participant exchange visitor record. This record should have the program category and position pre-loaded.</param> /// <param name="subjectFieldDTO">The field of study of the participant.</param> /// <param name="siteOfActivityAddress">the site of activity of the exchange visitor, i.e. C Street state dept.</param> /// <returns>The person model for the exchange visitor.</returns> public ECA.Business.Validation.Sevis.Bio.Person GetPerson( BiographicalDTO biography, ParticipantExchangeVisitor participantExchangeVisitor, SubjectFieldDTO subjectFieldDTO, AddressDTO siteOfActivityAddress) { Contract.Requires(biography != null, "The biography should not be null."); Contract.Requires(participantExchangeVisitor != null, "The participant exchange visitor must not be null."); Contract.Requires(siteOfActivityAddress != null, "The site of activity address must not be null."); SubjectField subjectField = null; FullName fullName = null; if (subjectFieldDTO != null) { subjectField = subjectFieldDTO.GetSubjectField(); } if (biography.FullName != null) { fullName = biography.FullName.GetFullName(); } var instance = new ECA.Business.Validation.Sevis.Bio.Person( fullName: fullName, birthCity: biography.BirthCity, birthCountryCode: biography.BirthCountryCode, birthDate: biography.BirthDate, citizenshipCountryCode: biography.CitizenshipCountryCode, emailAddress: biography.EmailAddress, gender: biography.Gender, permanentResidenceCountryCode: biography.PermanentResidenceCountryCode, phoneNumber: biography.PhoneNumber, remarks: null, positionCode: participantExchangeVisitor.Position != null ? participantExchangeVisitor.Position.PositionCode : null, programCategoryCode: participantExchangeVisitor.ProgramCategory != null ? participantExchangeVisitor.ProgramCategory.ProgramCategoryCode : null, mailAddress: biography.MailAddress, participantId: participantExchangeVisitor.ParticipantId, usAddress: siteOfActivityAddress, personId: biography.PersonId, printForm: true, subjectField: subjectField ); return(instance); }
public void TestGetSubjectField() { var code = "01.0103"; var foreignDegreeLevel = "degree level"; var foreignFieldOfStudy = "field of study"; var remarks = "remarks"; var dto = new SubjectFieldDTO(); dto.ForeignDegreeLevel = foreignDegreeLevel; dto.Remarks = remarks; dto.SubjectFieldCode = code; dto.ForeignFieldOfStudy = foreignFieldOfStudy; var instance = dto.GetSubjectField(); Assert.AreEqual(code, instance.SubjectFieldCode); Assert.AreEqual(foreignDegreeLevel, instance.ForeignDegreeLevel); Assert.AreEqual(foreignFieldOfStudy, instance.ForeignFieldOfStudy); Assert.AreEqual(remarks, instance.Remarks); }