Example #1
0
        public void EmpInitDABPVerifTestCases()
        {
            Init();

            var cases          = casesPath.XmlFileToObject <List <EmpInitDABPVerifTestCase> >();
            var notPassedCases = new List <EmpInitDABPVerifTestCase>();

            foreach (var casee in cases.Where(c => c.IsActive))
            {
                OnboardingEInfo einfo = null;
                CreateCase(casee, out einfo);

                var requestActual = EVerifyService.AssembleI9CaseFlat(einfo.Guidfield).ToBLO <EmpInitDABPVerifRequestBodyBLO>();

                switch (empInitDABPVerifTestMode)
                {
                case EmpInitDABPVerifTestMode.OfflineTestingModeRequestWriter:
                    if (!EmpInitDABPVerifRequestBodyBLO.Equals(requestActual, casee.EmpInitDABPVerifRequestExpected))
                    {
                        notPassedCases.Add(casee);
                    }

                    break;

                case EmpInitDABPVerifTestMode.OnlineRequestResponceWriter:
                    var ret = EVerifyService.CreateCase(einfo.Guidfield);
                    if (!ret)
                    {
                        notPassedCases.Add(casee);
                    }

                    casee.EmpInitDABPVerifResponce = (EmpInitVerfRespBLO)EVerifyService.LastResponce;
                    break;
                }

                casee.EmpInitDABPVerifRequestActual = requestActual;
            }

            cases.ToXmlFile(casesPath);
            Assert.IsTrue(notPassedCases.Count() == 0, "EmpInitDABPVerifRequest compare failed in TestCaseID : " + string.Join(",", notPassedCases.Select(c => c.TestCaseID).ToArray()));
        }
Example #2
0
        private static void CreateCase(EmpInitDABPVerifTestCase empInitDABPVerifTestCase, out OnboardingEInfo einfo)
        {
            bool success;
            var  flow     = new OnboardingFlowDataProvider().GetEntity(new Hashtable());
            var  flowStep = new OnboardingFlowStepDataProvider().GetEntity(new Hashtable());

            einfo = OnboardingEInfo.CreateEntity(true);
            {
                einfo.FirstName              = empInitDABPVerifTestCase.FirstName;
                einfo.LastName               = empInitDABPVerifTestCase.LastName;
                einfo.MiddleName             = empInitDABPVerifTestCase.MiddleName;
                einfo.Ssn                    = empInitDABPVerifTestCase.Ssn;
                einfo.BirthDate              = empInitDABPVerifTestCase.BirthDate;
                einfo.HireDate               = DateTime.Now.ToString("yyyy-MM-dd");
                einfo.FlowGuid               = flow.GuidField;
                einfo.OnboardingFlowStepGuid = flowStep.GuidField;
                einfo.AnnualSalary           = "5000";
                einfo.PayFrequency           = "M";
                einfo.DefaultHours           = "10";
                einfo.WorkState              = empInitDABPVerifTestCase.WorkState;
                einfo.IsProvideEmailToDHS    = true.ToString();
                einfo.ProvidedEmailAddress   = empInitDABPVerifTestCase.ProvidedEmailAddress;
                einfo.StartDate              = DateTime.Now.ToShortDateString();
                einfo.EmpType                = _employeeType;

                var cc1Info = new CDept1DataProvider()
                              .GetEntityList(new Hashtable()
                {
                    { CDept1.DBFieldName.Co.ToString(), EntityObjects.CInfo.Co }
                })
                              .FirstOrDefault();
                if (cc1Info != null)
                {
                    einfo.Cc1 = cc1Info.Cc1;
                }
            }

            success = einfo.Save();
            Assert.IsTrue(success, "Create OnboardingEinfo failed: " + ErrorHandler.GetErrorListString);

            var listADoc = new OnboardingI9Document();
            var listBDoc = new OnboardingI9Document();
            var listCDoc = new OnboardingI9Document();

            var listABDoc = new OnboardingI9Document()
            {
                Guidfield           = "",
                CurrentEntityState  = KYSSEntityBase.EntityState.NewUnmodified,
                OnboardingEInfoGuid = einfo.Guidfield,
                CountryOfIssuance   = empInitDABPVerifTestCase.AB_CountryOfIssuance.ToString(),
                IssuingAuthorityID  = empInitDABPVerifTestCase.GetOnboardingIssuingAuthorityTableRowID(EmpInitDABPVerifTestCase.ListType.AB),
                DocumentNumber      = empInitDABPVerifTestCase.AB_DocNumber,
                ExpirationDate      = empInitDABPVerifTestCase.AB_DocExpDate,
            };

            listABDoc.HasExpirationDate = empInitDABPVerifTestCase.AB_HasExpirationDate == null
                ? listABDoc.HasExpirationDate
                : empInitDABPVerifTestCase.AB_HasExpirationDate.ToString();

            success = listABDoc.Save();
            Assert.IsTrue(success, "Create Onboardingi9Document(list AB) failed");



            if (empInitDABPVerifTestCase.ListADocumentType == ListADocumentType.ListBandCDocuments)
            {
                listBDoc = listABDoc;
                listCDoc = new OnboardingI9Document()
                {
                    OnboardingEInfoGuid = einfo.Guidfield,
                    CountryOfIssuance   = empInitDABPVerifTestCase.C_CountryOfIssuance.ToString(),
                    IssuingAuthorityID  = empInitDABPVerifTestCase.GetOnboardingIssuingAuthorityTableRowID(EmpInitDABPVerifTestCase.ListType.C),
                    DocumentNumber      = empInitDABPVerifTestCase.C_DocNumber,
                    ExpirationDate      = empInitDABPVerifTestCase.C_DocExpDate,
                };
                success = listCDoc.Save();
                Assert.IsTrue(success, "Create Onboardingi9Document(list B) failed");
            }
            else
            {
                listADoc = listABDoc;
            }

            var listADocumentTypeID = "";
            var listBDocumentTypeID = "";
            var listCDocumentTypeID = "";

            var listAI9DocumentId = "";
            var listBI9DocumentId = "";
            var listCI9DocumentId = "";

            if (empInitDABPVerifTestCase.ListADocumentType == ListADocumentType.ListBandCDocuments)
            {
                listBDocumentTypeID =
                    OnboardingI9DocumentType.GetEntityByCitizenshipStatusAndEVerifyDocumentIdAndDocumentType(
                        (int)empInitDABPVerifTestCase.SitezenshipStatus,
                        empInitDABPVerifTestCase.ListBDocumentType.ToIntString(),
                        OnboardingI9Document.DocumentTypes.B).I9DocumentTypeID;
                listCDocumentTypeID =
                    OnboardingI9DocumentType.GetEntityByCitizenshipStatusAndEVerifyDocumentIdAndDocumentType(
                        (int)empInitDABPVerifTestCase.SitezenshipStatus,
                        empInitDABPVerifTestCase.ListCDocumentType.ToIntString(),
                        OnboardingI9Document.DocumentTypes.C).I9DocumentTypeID;
                listBI9DocumentId = empInitDABPVerifTestCase.ListBDocumentType.ToIntString();
                listCI9DocumentId = empInitDABPVerifTestCase.ListCDocumentType.ToIntString();
            }

            listAI9DocumentId   = empInitDABPVerifTestCase.ListADocumentType.ToIntString();
            listADocumentTypeID = OnboardingI9DocumentType.GetEntityByCitizenshipStatusAndEVerifyDocumentIdAndDocumentType(
                (int)empInitDABPVerifTestCase.SitezenshipStatus,
                empInitDABPVerifTestCase.ListADocumentType.ToIntString(),
                OnboardingI9Document.DocumentTypes.A).I9DocumentTypeID;

            var i9 = new OnboardingI9()
            {
                OnboardingEInfoGuid   = einfo.Guidfield,
                CitizenshipStatusID   = empInitDABPVerifTestCase.SitezenshipStatus.ToIntString(),
                AlienNumber           = empInitDABPVerifTestCase.AlienNumber,
                AdmissionNumber       = empInitDABPVerifTestCase.AdmissionNumber,
                ForeignPassportNumber = empInitDABPVerifTestCase.ForeignPassportNumber,
                CountryOfIssuance     = empInitDABPVerifTestCase.ForeignPassport_CountryOfIssuance.ToString(),

                ListADocumentTypeID = listADocumentTypeID,
                ListBDocumentTypeID = listBDocumentTypeID,
                ListCDocumentTypeID = listCDocumentTypeID,
                ListAI9DocumentGuid = listADoc.Guidfield,
                ListBI9DocumentGuid = listBDoc.Guidfield,
                ListCI9DocumentGuid = listCDoc.Guidfield,
                ListAI9DocumentId   = listAI9DocumentId,
                ListBI9DocumentId   = listBI9DocumentId,
                ListCI9DocumentId   = listCI9DocumentId,

                ActiveStage = OnboardingI9.ActiveStageEnum.Active.ToIntString(),
            };

            i9.ApplyDefaults();
            success = i9.Save();
            Assert.IsTrue(success, "Create Onboardingi9 failed");
        }