public void TestGetRequestId_RequestIdIsWhitespace()
        {
            var instance = new SEVISEVBatchTypeExchangeVisitor();

            instance.requestID = " ";
            Assert.IsNull(instance.GetRequestId());
        }
        public void TestGetRequestId_RequestIdIsEmtpy()
        {
            var instance = new SEVISEVBatchTypeExchangeVisitor();

            instance.requestID = String.Empty;
            Assert.IsNull(instance.GetRequestId());
        }
示例#3
0
        /// <summary>
        /// Returns the Sevis model to create a new exchange visitor.
        /// </summary>
        /// <param name="sevisUsername">The sevis username the exchange visitor is being sent under.</param>
        /// <returns>The sevis model to create a new exchange visitor.</returns>
        public SEVISEVBatchTypeExchangeVisitor GetSEVISBatchTypeExchangeVisitor(string sevisUsername)
        {
            Contract.Requires(this.Person != null, "The person must not be null.");
            Contract.Requires(this.Person.FullName != null, "The person full name must not be null.");
            Contract.Requires(this.Person.ProgramCategoryCode != null, "The program category code must not be null.");
            Contract.Requires(this.FinancialInfo != null, "The financial info code must not be null.");
            Contract.Requires(this.OccupationCategoryCode != null, "The occupation category code must not be null.");
            Contract.Requires(sevisUsername != null, "The sevis username must not be null.");

            var instance = new SEVISEVBatchTypeExchangeVisitor();

            instance.userID        = sevisUsername;
            instance.Biographical  = this.Person.GetEVPersonTypeBiographical();
            instance.CategoryCode  = this.Person.ProgramCategoryCode.GetEVCategoryCodeType();
            instance.FinancialInfo = this.FinancialInfo.GetEVPersonTypeFinancialInfo();
            instance.Items         = new List <object> {
                GetAddSiteOfActivity()
            }.ToArray();
            if (this.Person.MailAddress != null)
            {
                var address       = this.Person.MailAddress.GetUSAddress();
                var addressDoctor = address.GetUSAddressDoctorType();
                instance.MailAddress = addressDoctor;
            }
            if (this.Person.USAddress != null)
            {
                var address       = this.Person.USAddress.GetUSAddress();
                var addressDoctor = address.GetUSAddressDoctorType();
                instance.USAddress = addressDoctor;
            }

            if (this.OccupationCategoryCode != null)
            {
                instance.OccupationCategoryCode          = this.OccupationCategoryCode.GetEVOccupationCategoryCodeType();
                instance.OccupationCategoryCodeSpecified = true;
            }
            else
            {
                instance.OccupationCategoryCodeSpecified = false;
            }
            instance.ResidentialAddress = null;
            instance.PositionCode       = (short)Int32.Parse(this.Person.PositionCode);
            instance.PrgEndDate         = this.ProgramEndDate;
            instance.PrgStartDate       = this.ProgramStartDate;
            instance.printForm          = true;
            instance.SubjectField       = this.Person.SubjectField.GetEVPersonTypeSubjectField();
            instance.SetRequestId(this.Person.ParticipantId);
            SetDependents(instance);

            var key = new ParticipantSevisKey(this.Person);

            key.SetUserDefinedFields(instance);
            return(instance);
        }
        public void TestSetRequestId()
        {
            var participantId = 10;
            var instance      = new SEVISEVBatchTypeExchangeVisitor();

            Assert.IsNull(instance.requestID);

            instance.SetRequestId(participantId);
            Assert.IsNotNull(instance.requestID);

            var expectedRequestId = new RequestId(participantId, RequestIdType.Participant, RequestActionType.Create);

            Assert.AreEqual(expectedRequestId.ToString(), instance.requestID);
        }
示例#5
0
        private void SetDependents(SEVISEVBatchTypeExchangeVisitor instance)
        {
            var dependentsList  = this.Dependents ?? new List <AddedDependent>();
            var addedDependents = new List <EVPersonTypeDependent>();

            foreach (var dependent in dependentsList.Where(x => !x.IsDeleted).ToList())
            {
                if (dependent.GetType() != typeof(AddedDependent))
                {
                    throw new NotSupportedException("The dependent must be an added dependent.");
                }
                var addedDependent = (AddedDependent)dependent;
                addedDependents.Add(addedDependent.GetEVPersonTypeDependent());
            }
            if (addedDependents.Count > 0)
            {
                instance.CreateDependent = addedDependents.ToArray();
            }
            else
            {
                instance.CreateDependent = null;
            }
        }