public void TestGetEVPersonTypeDependent_BirthCountryReasonCodeNotSpecified()
        {
            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;
            string birthCountryReasonCode     = null;
            var    relationship               = DependentCodeType.Item01.ToString();
            var    isTravelingWithParticipant = true;
            var    isDeleted = true;
            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 instance = dependent.GetEVPersonTypeDependent();

            Assert.IsFalse(instance.BirthCountryReasonSpecified);
        }
        public void TestGetRequestId()
        {
            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 = true;
            var instance  = new AddedDependent(
                fullName,
                birthCity,
                birthCountryCode,
                birthCountryReasonCode,
                birthDate,
                citizenshipCountryCode,
                email,
                gender,
                permanentResidenceCountryCode,
                phone,
                relationship,
                mailAddress,
                usAddress,
                printForm,
                personId,
                participantId,
                isTravelingWithParticipant,
                isDeleted
                );
            var expectedRequestId = new RequestId(instance.PersonId, RequestIdType.Dependent, RequestActionType.Create);

            Assert.AreEqual(expectedRequestId, instance.GetRequestId());
        }
        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);
        }
        public void TestJsonSerialization()
        {
            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 = true;
            var instance  = new AddedDependent(
                fullName,
                birthCity,
                birthCountryCode,
                birthCountryReasonCode,
                birthDate,
                citizenshipCountryCode,
                email,
                gender,
                permanentResidenceCountryCode,
                phone,
                relationship,
                mailAddress,
                usAddress,
                printForm,
                personId,
                participantId,
                isTravelingWithParticipant,
                isDeleted
                );

            var json       = JsonConvert.SerializeObject(instance);
            var jsonObject = JsonConvert.DeserializeObject <AddedDependent>(json);

            Assert.AreEqual(personId, jsonObject.PersonId);
            Assert.AreEqual(participantId, jsonObject.ParticipantId);
            Assert.AreEqual(birthCity, jsonObject.BirthCity);
            Assert.AreEqual(birthCountryCode, jsonObject.BirthCountryCode);
            Assert.AreEqual(birthDate, jsonObject.BirthDate);
            Assert.AreEqual(citizenshipCountryCode, jsonObject.CitizenshipCountryCode);
            Assert.AreEqual(email, jsonObject.EmailAddress);
            Assert.AreEqual(gender, jsonObject.Gender);
            Assert.AreEqual(permanentResidenceCountryCode, jsonObject.PermanentResidenceCountryCode);
            Assert.AreEqual(phone, jsonObject.PhoneNumber);
            Assert.AreEqual(printForm, jsonObject.PrintForm);
            Assert.AreEqual(birthCountryReasonCode, jsonObject.BirthCountryReasonCode);
            Assert.AreEqual(relationship, jsonObject.Relationship);
            Assert.AreEqual(isTravelingWithParticipant, jsonObject.IsTravelingWithParticipant);
            Assert.AreEqual(isDeleted, jsonObject.IsDeleted);
            Assert.IsNotNull(jsonObject.FullName);
            Assert.IsNotNull(jsonObject.MailAddress);
            Assert.IsNotNull(jsonObject.USAddress);
        }
        public void TestGetSevisExhangeVisitorDependentInstance_IsTravelingWithParticipant()
        {
            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 = true;
            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 instance = dependent.GetSevisExhangeVisitorDependentInstance();

            Assert.IsInstanceOfType(instance, typeof(SEVISEVBatchTypeExchangeVisitorDependentAdd));
            var sevisModel = (SEVISEVBatchTypeExchangeVisitorDependentAdd)instance;

            Assert.AreEqual(dependent.BirthCity, sevisModel.BirthCity);
            Assert.AreEqual(dependent.BirthCountryCode.GetBirthCntryCodeType(), sevisModel.BirthCountryCode);
            Assert.AreEqual(dependent.BirthDate, sevisModel.BirthDate);
            Assert.AreEqual(dependent.CitizenshipCountryCode.GetCountryCodeWithType(), sevisModel.CitizenshipCountryCode);
            Assert.AreEqual(dependent.EmailAddress, sevisModel.EmailAddress);
            Assert.AreEqual(dependent.Gender.GetEVGenderCodeType(), sevisModel.Gender);
            Assert.AreEqual(dependent.PermanentResidenceCountryCode.GetCountryCodeWithType(), sevisModel.PermanentResidenceCountryCode);
            Assert.AreEqual(dependent.Relationship.GetDependentCodeType(), sevisModel.Relationship);
            Assert.AreEqual(dependent.PrintForm, sevisModel.printForm);
            Assert.AreEqual(EVPrintReasonType.Item06, sevisModel.FormPurpose);
            Assert.IsTrue(sevisModel.BirthCountryReasonSpecified);
            Assert.AreEqual(birthCountryReasonCode.GetUSBornReasonType(), sevisModel.BirthCountryReason);
        }