Exemplo n.º 1
0
        public void VacancyDAOConstructorTest()
        {
            /*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");
        }
Exemplo n.º 2
0
        public void KeyWordDAOConstructorTest()
        {
            /*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("1", "Fish");
            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("1", "Fish"), true);
            key_context.removeByUserId("1", "Fish");
            Assert.AreEqual(key_context.isFound("1", "Fish"), false);
            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 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 VacancyKillerQuestionDAO_Test()
        {
            /*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("Do you have a BTech","1"),true );
            vac_context.removeByUserId("1");
        }
 public void doDelete()
 {
     if (isMinimumValid())
     {
         VacancyDAO vacancyDao = new VacancyDAO();
         vacancyDao.removeByUserId(view.getVacancyNumber());
         view.pageReload();
     }
     else
     {
         view.showFeedback("Error Field vlaues are not valid");
     }
 }