Ejemplo n.º 1
0
        public void setup()
        {
            appRepo = new ApplicantRepo();
            a1 = new Applicant{
                APPLICANT_ID = 1,
                FIRST_NAME_TX = "Wes",
                LAST_NAME_TX = "Reisz",
                MIDDLE_INITIAL_TX = "T",
                MOD_DT = DateTime.Now,
                SSN_TX = "400121234",
                SUFFIX_TX = ""
            };
            appRepo.add(a1);

            appRepo.add(new Applicant{
                    APPLICANT_ID = 2,
                    FIRST_NAME_TX = "Justin",
                    LAST_NAME_TX = "Reisz",
                    MIDDLE_INITIAL_TX = "T",
                    MOD_DT = DateTime.Now,
                    SSN_TX = "400121235",
                    SUFFIX_TX = ""
                }
            );
        }
Ejemplo n.º 2
0
        public async Task GivenAnApplicant_Create_CreatesAnApplicant()
        {
            sut = new ApplicantRepo(applicationContext);
            var applicant        = fixture.Create <Applicant>();
            var createdApplicant = await sut.Create(applicant);

            Assert.NotNull(createdApplicant);
        }
Ejemplo n.º 3
0
        public async Task GivenAnNonExistingApplicant_Update_ReturnsFailure()
        {
            sut = new ApplicantRepo(applicationContext);
            var updatedApplicant = fixture.Create <Applicant>();

            (var updateStatus, var updatedId) = await sut.Update(updatedApplicant.Id, updatedApplicant);

            Assert.Equal(Result.Fail, updateStatus);
            Assert.Equal(default, updatedId);
Ejemplo n.º 4
0
        public void CreateTest()
        {
            ApplicationDbContext db = new ApplicationDbContext();

            // Arrange
            Applicant applicant = new Applicant()
            {
                ApplicantId = 1, FirstName = "Muna", LastName = "Frank", Age = 22, EmailAddress = "*****@*****.**", Gender = Gender.Female
            };

            //Act
            ApplicantRepo arepo  = new ApplicantRepo();
            var           result = arepo.Create(applicant).Result;

            //Assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 5
0
        public async Task GivenAnExistingApplicant_Update_UpdatesApplicant()
        {
            sut = new ApplicantRepo(applicationContext);
            var applicant        = fixture.Create <Applicant>();
            var createdApplicant = await sut.Create(applicant);

            var updatedApplicant = fixture.Create <Applicant>();

            (var updateStatus, var updatedId) = await sut.Update(createdApplicant.Id, updatedApplicant);

            Assert.Equal(Result.Success, updateStatus);
            var updatedEntity = await sut.GetById(createdApplicant.Id);

            Assert.Equal(createdApplicant.Id, updatedId);
            Assert.Equal(updatedEntity.Address, updatedApplicant.Address);
            Assert.Equal(updatedEntity.Age, updatedApplicant.Age);
            Assert.Equal(updatedEntity.FamilyName, updatedApplicant.FamilyName);
            Assert.Equal(updatedEntity.Name, updatedApplicant.Name);
            Assert.Equal(updatedEntity.Hired, updatedApplicant.Hired);
        }
Ejemplo n.º 6
0
        public void setup()
        {
            codeRepo = new PhoneCodeRepo();
            codeRepo.add(new PhoneCD { PHONE_CD = "AA", PHONE_TX = "Home", MOD_DT = DateTime.Now });
            codeRepo.add(new PhoneCD { PHONE_CD = "BB", PHONE_TX = "Mobile", MOD_DT = DateTime.Now });
            codeRepo.add(new PhoneCD { PHONE_CD = "CC", PHONE_TX = "Work", MOD_DT = DateTime.Now });

            /*
             * Add the logic here to create a new applicantRepo() and then add an applicant with an
             * applicant_id of 1. When you do this, the next part should work.
             */
            appRepo = new ApplicantRepo();
            appRepo.add(new Applicant {
                APPLICANT_ID = 1, FIRST_NAME_TX = "Wes", LAST_NAME_TX = "Reisz", MIDDLE_INITIAL_TX = "T",
                MOD_DT = DateTime.Now, SSN_TX = "400121234", SUFFIX_TX = "" }
            );

            phoneRepo = new PhoneRepo();
            phoneRepo.add(new Phone { PHONE_CD = "AA", PHONE_TX = 5028011112, MOD_DT = DateTime.Now, APPLICANT_ID = 1, CREATE_DT = DateTime.Now });
            phoneRepo.add(new Phone { PHONE_CD = "BB", PHONE_TX = 5028011113, MOD_DT = DateTime.Now, APPLICANT_ID = 1, CREATE_DT = DateTime.Now });
            phoneRepo.add(new Phone { PHONE_CD = "CC", PHONE_TX = 5028011114, MOD_DT = DateTime.Now, APPLICANT_ID = 1, CREATE_DT = DateTime.Now });
        }
Ejemplo n.º 7
0
 public Models.ApplicantModel addOrUpdateApplicant(Models.ApplicantModel applicant)
 {
     Applicant a = new Applicant
     {
         APPLICANT_ID = applicant.applicantId,
         FIRST_NAME_TX = applicant.firstName,
         LAST_NAME_TX = applicant.lastName,
         MIDDLE_INITIAL_TX = applicant.middleInitial,
         MOD_DT = DateTime.Now,
         SSN_TX = applicant.ssn,
         SUFFIX_TX = applicant.suffix
     };
     ApplicantRepo appRepo = new ApplicantRepo();
     if (appRepo.getById(a) != null)
     {
         appRepo.update(a);
     }
     else {
         appRepo.add(a);
     }
     return applicant;
 }
Ejemplo n.º 8
0
 public void removeApplicant(Models.ApplicantModel applicant)
 {
     ApplicantRepo appRepo = new ApplicantRepo();
     appRepo.remove(appRepo.getById(new Applicant { APPLICANT_ID = applicant.applicantId }));
 }