public void TestConstructor_Person() { var participantId = 10; var personId = 20; var testPerson = new Person( fullName: null, birthCity: null, birthCountryCode: null, birthDate: null, citizenshipCountryCode: null, emailAddress: null, gender: null, permanentResidenceCountryCode: null, phoneNumber: null, remarks: null, positionCode: null, programCategoryCode: null, subjectField: null, mailAddress: null, usAddress: null, printForm: true, personId: personId, participantId: participantId); var key = new ParticipantSevisKey(testPerson); Assert.AreEqual(testPerson.PersonId, key.PersonId); Assert.AreEqual(testPerson.ParticipantId, key.ParticipantId); }
/// <summary> /// Returns a EVPersonTypeDependent instance representing a new sevis depenedent with a new sevis exchange visitor. /// </summary> /// <returns>A EVPersonTypeDependent instance representing a new sevis depenedent with a new sevis exchange visitor.</returns> public EVPersonTypeDependent GetEVPersonTypeDependent() { Contract.Requires(this.BirthDate.HasValue, "The birth date must have a value."); Contract.Requires(this.FullName != null, "The full name should be specified."); Contract.Requires(this.BirthCountryCode != null, "The BirthCountryCode should be specified."); Contract.Requires(this.CitizenshipCountryCode != null, "The CitizenshipCountryCode should be specified."); Contract.Requires(this.PermanentResidenceCountryCode != null, "The PermanentResidenceCountryCode should be specified."); Contract.Requires(this.Gender != null, "The Gender should be specified."); Func <string, bool> isCodeSpecified = (value) => { return(!string.IsNullOrWhiteSpace(value)); }; var dependent = new EVPersonTypeDependent { BirthCity = this.BirthCity, BirthCountryCode = this.BirthCountryCode.GetBirthCntryCodeType(), BirthCountryReasonSpecified = isCodeSpecified(this.BirthCountryReasonCode), BirthDate = this.BirthDate.Value, CitizenshipCountryCode = this.CitizenshipCountryCode.GetCountryCodeWithType(), EmailAddress = this.EmailAddress, FullName = this.FullName.GetNameType(), Gender = this.Gender.GetEVGenderCodeType(), PermanentResidenceCountryCode = this.PermanentResidenceCountryCode.GetCountryCodeWithType(), Relationship = this.Relationship.GetDependentCodeType(), }; if (dependent.BirthCountryReasonSpecified) { dependent.BirthCountryReason = this.BirthCountryReasonCode.GetUSBornReasonType(); } var sevisKey = new ParticipantSevisKey(this); sevisKey.SetUserDefinedFields(dependent); return(dependent); }
public void TestConstructor_Dependent() { var testDependent = new TestDependent(); Assert.AreEqual(10, testDependent.PersonId); Assert.AreEqual(20, testDependent.ParticipantId); var key = new ParticipantSevisKey(testDependent); Assert.AreEqual(testDependent.PersonId, key.PersonId); Assert.AreEqual(testDependent.ParticipantId, key.ParticipantId); }
public void TestConstructor_UserDefinedAAndUserDefinedB() { var participantId = 10; var personId = 20; var userDefinedA = participantId.ToString(); var userDefinedB = "B" + personId.ToString(); var key = new ParticipantSevisKey(userDefinedA, userDefinedB); Assert.AreEqual(personId, key.PersonId); Assert.AreEqual(participantId, key.ParticipantId); }
/// <summary> /// Returns a sevis registered exchnage visitor's dependent modification, such as a new dependent that must be added. /// </summary> /// <returns>A sevis registered exchnage visitor's dependent modification, such as a new dependent that must be added.</returns> public SEVISEVBatchTypeExchangeVisitorDependent GetSEVISEVBatchTypeExchangeVisitorDependent() { //should return SEVISEVBatchTypeExchangeVisitorDependent with the correct Item property set to either //SEVISEVBatchTypeExchangeVisitorDependentAdd, SEVISEVBatchTypeExchangeVisitorDependentDelete, etc.... var instance = new SEVISEVBatchTypeExchangeVisitorDependent { Item = Dependent.GetSevisExhangeVisitorDependentInstance(), }; var key = new ParticipantSevisKey(this.Dependent); key.SetUserDefinedFields(instance); return(instance); }
public void TestConstructor_TransactionLogTypeBatchDetailProcessRecord() { var participantId = 10; var personId = 20; var userDefinedA = participantId.ToString(); var userDefinedB = "B" + personId.ToString(); var dependent = new TransactionLogTypeBatchDetailProcessRecord { UserDefinedA = userDefinedA, UserDefinedB = userDefinedB }; var key = new ParticipantSevisKey(dependent); Assert.AreEqual(personId, key.PersonId); Assert.AreEqual(participantId, key.ParticipantId); }
public void TestGetSEVISEVBatchTypeExchangeVisitorDependent() { var personId = 100; var participantId = 200; var firstName = "first"; var lastName = "last"; var passport = "passport"; var preferred = "preferred"; var suffix = "Jr."; var fullName = new FullName(firstName, lastName, passport, preferred, suffix); var birthCity = "birth city"; var birthCountryCode = "CN"; var birthDate = DateTime.UtcNow; var citizenshipCountryCode = "FR"; var email = "*****@*****.**"; var gender = Gender.SEVIS_MALE_GENDER_CODE_VALUE; var permanentResidenceCountryCode = "MX"; var phone = "123-456-7890"; var mailAddress = new AddressDTO { AddressId = 1, Country = LocationServiceAddressValidator.UNITED_STATES_COUNTRY_NAME }; var usAddress = new AddressDTO { AddressId = 2, Country = LocationServiceAddressValidator.UNITED_STATES_COUNTRY_NAME }; var printForm = true; var birthCountryReasonCode = USBornReasonType.Item01.ToString(); var relationship = DependentCodeType.Item01.ToString(); var isTravelingWithParticipant = true; var isDeleted = false; var dependent = new AddedDependent( fullName: fullName, birthCity: birthCity, birthCountryCode: birthCountryCode, birthCountryReasonCode: birthCountryReasonCode, birthDate: birthDate, citizenshipCountryCode: citizenshipCountryCode, emailAddress: email, gender: gender, permanentResidenceCountryCode: permanentResidenceCountryCode, phoneNumber: phone, relationship: relationship, mailAddress: mailAddress, usAddress: usAddress, printForm: printForm, participantId: participantId, personId: personId, isTravelingWithParticipant: isTravelingWithParticipant, isDeleted: isDeleted ); var modifiedParticipantDependent = new ModifiedParticipantDependent(dependent: dependent); var instance = modifiedParticipantDependent.GetSEVISEVBatchTypeExchangeVisitorDependent(); Assert.IsNotNull(instance.Item); Assert.IsInstanceOfType(instance.Item, typeof(SEVISEVBatchTypeExchangeVisitorDependentAdd)); Assert.IsNotNull(instance.UserDefinedA); Assert.IsNotNull(instance.UserDefinedB); var key = new ParticipantSevisKey(instance.UserDefinedA, instance.UserDefinedB); Assert.AreEqual(participantId, key.ParticipantId); Assert.AreEqual(personId, key.PersonId); }