public void VacancyDAO_Test() { /*Context*/ VacancyDAO vac_context = new VacancyDAO(); /*Insert*/ VacancyDTO vac = new VacancyDTO(); vac.department = "IS"; vac.description = "Web services"; vac.manager = "Tom"; vac.recruiter = "Thumi"; vac.site = "www.petrosa.co.za"; vac.startDate = new DateTime(2012, 10, 10); vac.endDate = new DateTime(2012, 12, 1); vac.description = "desktop support"; vac.title = "support technician"; vac.vacancyNumber = "1"; vac.viewCount = 10; vac.viewStatus = "published"; vac.status = "active"; vac_context.presist(vac); /*Update*/ vac.status = "draft"; vac_context.merge(vac); Assert.AreEqual(vac.status, "draft"); /*Delete*/ Assert.AreEqual(vac_context.removeByUserId("1"), true); vac_context.removeByUserId("1"); }
public void ApplicationDAO_Test() { AccountDAO account_context = new AccountDAO(); ApplicationDAO app_context = new ApplicationDAO(); VacancyDAO vac_context = new VacancyDAO(); /*Insert*/ AccountDTO account = new AccountDTO(); account.userName = "******"; account.status = "active"; account.password = "******"; account.accountType = "admin"; account_context.presist(account); VacancyDTO vac = new VacancyDTO(); vac.department = "IS"; vac.description = "Web services"; vac.manager = "Tom"; vac.recruiter = "Thumi"; vac.site = "www.petrosa.co.za"; vac.startDate = new DateTime(2012, 10, 10); vac.endDate = new DateTime(2012, 12, 1); vac.description = "desktop support"; vac.title = "support technician"; vac.vacancyNumber = "1"; vac.viewCount = 10; vac.viewStatus = "published"; vac.status = "active"; vac_context.presist(vac); bool expectedVac = true; bool actualVac; actualVac = vac_context.isFound("1"); Assert.AreEqual(expectedVac, actualVac); ApplicationDTO application = new ApplicationDTO(); application.userName = "******"; application.vacancyNumber = "1"; application.status = "open"; app_context.presist(application); bool expected = true; bool actual; actual = app_context.isFound("griddy", "1"); Assert.AreEqual(expected, actual); /*Update*/ application.status = "closed"; expected = true; actual = app_context.merge(application); Assert.AreEqual(expected, actual); /*Delete*/ Assert.AreEqual(app_context.removeByUserId("griddy", "1"), true); Assert.AreEqual(vac_context.removeByUserId("1"), true); Assert.AreEqual(account_context.removeByUserId("griddy"), true); }
public void KeyWordDAO_Test() { /*Context*/ KeyWordDAO key_context = new KeyWordDAO(); VacancyDAO vac_context = new VacancyDAO(); /*Insert*/ VacancyDTO vac = new VacancyDTO(); vac.department = "IS"; vac.description = "Web services"; vac.manager = "Tom"; vac.recruiter = "Thumi"; vac.site = "www.petrosa.co.za"; vac.startDate = new DateTime(2012, 10, 10); vac.endDate = new DateTime(2012, 12, 1); vac.description = "desktop support"; vac.title = "support technician"; vac.vacancyNumber = "1"; vac.viewCount = 10; vac.viewStatus = "published"; vac.status = "active"; vac_context.presist(vac); KeyWordDTO key = new KeyWordDTO(); key.vacancyNumber = "1"; key.word = "Fish"; key_context.presist(key); bool expectedVac = true; bool actualVac; actualVac = key_context.isFound("Fish", "1"); Assert.AreEqual(expectedVac, actualVac); /*Update*/ //Not Applicable - Composite primary key can not be changed,except by removing the entity. /*Delete*/ Assert.AreEqual(key_context.isFound("Fish", "1"), true); key_context.removeByUserId("Fish", "1"); Assert.AreEqual(key_context.isFound("Fish", "1"), false); vac_context.removeByUserId("1"); }
public void VacancyKillerQuestionDAOConstructorTest() { /*Context*/ VacancyKillerQuestionDAO vacKill_context = new VacancyKillerQuestionDAO(); VacancyDAO vac_context = new VacancyDAO(); /*Insert*/ VacancyDTO vac = new VacancyDTO(); vac.department = "IS"; vac.description = "Web services"; vac.manager = "Tom"; vac.recruiter = "Thumi"; vac.site = "www.petrosa.co.za"; vac.startDate = new DateTime(2012, 10, 10); vac.endDate = new DateTime(2012, 12, 1); vac.description = "desktop support"; vac.title = "support technician"; vac.vacancyNumber = "1"; vac.viewCount = 10; vac.viewStatus = "published"; vac.status = "active"; vac_context.presist(vac); VacancyKillerQuestionDTO vacKill = new VacancyKillerQuestionDTO(); vacKill.vacancyNumber = "1"; vacKill.question = "Do you have a BTech"; vacKill.answer = "Yes"; Assert.AreEqual(vacKill_context.presist(vacKill), true); /*Update*/ vacKill.answer = "No"; vacKill_context.merge(vacKill); Assert.AreEqual(vacKill.answer, "No"); /*Delete*/ Assert.AreEqual(vacKill_context.removeByUserId("1", "Do you have a BTech"), true); vac_context.removeByUserId("1"); }
public void getVacanciesByStatusTest() { VacancyStatus target = new VacancyStatus(); VacancyDAO vac_context = new VacancyDAO(); VacancyDTO vac = new VacancyDTO(); vac.department = "IS"; vac.description = "Web services"; vac.manager = "Tom"; vac.recruiter = "Thumi"; vac.site = "www.petrosa.co.za"; vac.startDate = new DateTime(2012, 10, 10); vac.endDate = new DateTime(2012, 12, 15); vac.description = "desktop support"; vac.title = "support technician"; vac.vacancyNumber = "1"; vac.viewCount = 10; vac.viewStatus = "published"; vac.status = "active"; vac_context.presist(vac); bool expected = true; bool actual; actual = vac_context.isFound("1"); Assert.AreEqual(expected, actual); VacancyDTO vacTwo = new VacancyDTO(); vacTwo.department = "Business"; vacTwo.description = "Money"; vacTwo.manager = "Marc"; vacTwo.recruiter = "Mandy"; vacTwo.site = "Durban"; vacTwo.startDate = new DateTime(2012, 1, 10); vacTwo.endDate = new DateTime(2012, 3, 15); vacTwo.description = "desktop support"; vacTwo.title = "support technician"; vacTwo.vacancyNumber = "2"; vacTwo.viewCount = 10; vacTwo.viewStatus = "published"; vacTwo.status = "active"; vac_context.presist(vacTwo); bool expected2 = true; bool actual2; actual2 = vac_context.isFound("2"); Assert.AreEqual(expected2, actual2); VacancyDTO vacThree = new VacancyDTO(); vacThree.department = "IS"; vacThree.description = "Money"; vacThree.manager = "Tom"; vacThree.recruiter = "Fuji"; vacThree.site = "Durban"; vacThree.startDate = new DateTime(2012, 11, 10); vacThree.endDate = new DateTime(2012, 12, 20); vacThree.description = "App Specialist"; vacThree.title = "Developer"; vacThree.vacancyNumber = "3"; vacThree.viewCount = 10; vacThree.viewStatus = "published"; vacThree.status = "inactive"; vac_context.presist(vacThree); bool expected3 = true; bool actual3; actual3 = vac_context.isFound("3"); Assert.AreEqual(expected3, actual3); VacancyStatus status = new VacancyStatus(); List<VacancyDTO> listVacs = status.getVacanciesByStatus("active"); foreach (VacancyDTO v in listVacs) { string vacNo = v.vacancyNumber.ToString(); Assert.IsNotNull(vacNo); } vac_context.removeByUserId("1"); vac_context.removeByUserId("2"); vac_context.removeByUserId("3"); }
public void userServiceTest() { UserService target = CreateUserService(); // TODO: Initialize to an appropriate value AccountDAO account_context = new AccountDAO(); ApplicationDAO app_context = new ApplicationDAO(); VacancyDAO vac_context = new VacancyDAO(); /*Insert*/ AccountDTO account = new AccountDTO(); account.userName = "******"; account.status = "active"; account.password = "******"; account.accountType = "admin"; account_context.presist(account); VacancyDTO vac = new VacancyDTO(); vac.department = "IS"; vac.description = "Web services"; vac.manager = "Tom"; vac.recruiter = "Thumi"; vac.site = "www.petrosa.co.za"; vac.startDate = new DateTime(2012, 10, 10); vac.endDate = new DateTime(2012, 12, 1); vac.description = "desktop support"; vac.title = "support technician"; vac.vacancyNumber = "1"; vac.viewCount = 10; vac.viewStatus = "published"; vac.status = "active"; vac_context.presist(vac); bool expectedVac = true; bool actualVac; actualVac = vac_context.isFound("1"); Assert.AreEqual(expectedVac, actualVac); ApplicationDTO applicationDto = new ApplicationDTO(); applicationDto.userName = "******"; applicationDto.vacancyNumber = "1"; applicationDto.status = ApplicationStatus.APPLIED.ToString(); app_context.presist(applicationDto); bool expected = true; bool actual; actual = app_context.isFound("griddy", "1"); Assert.AreEqual(expected, actual); //Test changeUserApplicationStatus method target.changeUserApplicationStatus("griddy", "1", ApplicationStatus.SHORTLISTED); ApplicationDTO applicationDto2 = app_context.find("griddy", "1"); Assert.AreEqual(ApplicationStatus.SHORTLISTED.ToString(), applicationDto2.status); //Test getShortListedCandidates method List<ApplicationDTO> candidates = target.getShortListedCandidates("1"); Assert.AreEqual("griddy", candidates[0].userName); /*Delete*/ Assert.AreEqual(app_context.removeByUserId("griddy", "1"), true); Assert.AreEqual(vac_context.removeByUserId("1"), true); Assert.AreEqual(account_context.removeByUserId("griddy"), true); }
public void applicationSearchServiceTest() { ApplicationSearchService target = new ApplicationSearchServiceImpl(); // TODO: Initialize to an appropriate value AccountDAO account_context = new AccountDAO(); ApplicationDAO app_context = new ApplicationDAO(); VacancyDAO vac_context = new VacancyDAO(); /*Insert*/ AccountDTO account = new AccountDTO(); account.userName = "******"; account.status = "active"; account.password = "******"; account.accountType = "admin"; account_context.presist(account); VacancyDTO vac = new VacancyDTO(); vac.department = "IS"; vac.description = "Web services"; vac.manager = "Tom"; vac.recruiter = "Thumi"; vac.site = "www.petrosa.co.za"; vac.startDate = new DateTime(2012, 10, 10); vac.endDate = new DateTime(2012, 12, 1); vac.description = "desktop support"; vac.title = "support technician"; vac.vacancyNumber = "1"; vac.viewCount = 10; vac.viewStatus = "published"; vac.status = "active"; vac_context.presist(vac); bool expectedVac = true; bool actualVac; actualVac = vac_context.isFound("1"); Assert.AreEqual(expectedVac, actualVac); ApplicationDTO application = new ApplicationDTO(); application.userName = "******"; application.vacancyNumber = "1"; application.status = "open"; app_context.presist(application); //Test getApplicationByUsername method List<ApplicationDTO> applicationTestListObj = target.getApplicationByUsername("graddy"); Assert.AreEqual(application.status, applicationTestListObj[0].status); //Test getApplicationByStatus method List<ApplicationDTO> applicationTestListObj2 = target.getApplicationByStatus("open"); Assert.AreEqual(application.status, applicationTestListObj2[0].status); //Test getApplicationByVacancyNumber method List<ApplicationDTO> applicationTestListObj3 = target.getApplicationByVacancyNumber("1"); Assert.AreEqual(application.status, applicationTestListObj3[0].status); /*Delete*/ /* account_context.removeByUserId("graddy"); bool expectedDelete = false; bool actualDelete = account_context.isFound("graddy"); Assert.AreEqual(expectedDelete, actualDelete); */ }
public void doSave() { AccountService accountService = new AccountServiceImpl(); if (isValid()) { if (accountService.isUniqueVacancy(view.getVacancyNumber())) { VacancyDAO vacancyDao = new VacancyDAO(); VacancyDTO vacancy = getVacancyDto(); vacancyDao.presist(vacancy); //view.pageReload(); } else { view.setVacancyNumber("Error, this Date type is already used. Enter another value"); } } else { view.showFeedback("Error Field vlaues are not valid"); } }