public void doSave() { AccountService accountService = new AccountServiceImpl(); if (isValid()) { BasicEduDAO basicEduDao = new BasicEduDAO(); basicEduDao.presist(getBasicEduDto()); view.pageReload(); } else { view.showFeedback("Error Field vlaues are not valid"); } }
public void BasicEduSubject_Test() { /*Context*/ BasicEduSubjectDAO basicEdu_context = new BasicEduSubjectDAO(); BasicEduDAO edu_context = new BasicEduDAO(); AccountDAO acc_context = new AccountDAO(); /*Insert*/ AccountDTO acc = new AccountDTO(); acc.userName = "******"; acc.password = "******"; acc.accountType = "administrator"; acc.status = "active"; acc_context.presist(acc); BasicEduDTO basic_Edu = new BasicEduDTO(); basic_Edu.userName = "******"; basic_Edu.country = "South Africa"; basic_Edu.levelCompleted = 12; basic_Edu.province = "WP"; basic_Edu.school = "Brackenfell High School"; basic_Edu.town = "Cape Town"; edu_context.presist(basic_Edu); BasicEduSubjectDTO basicEduSub = new BasicEduSubjectDTO(); basicEduSub.subjectName = "Technical Programming"; basicEduSub.subjectDescription = "Mr Kabaso is Awesome"; basicEduSub.userName = "******"; basicEdu_context.presist(basicEduSub); /*Update*/ basicEduSub.subjectDescription = "Mr Kabaso is Awesome!"; basicEdu_context.merge(basicEduSub); string expectedUpdate = "Mr Kabaso is Awesome!"; BasicEduSubjectDTO updateEduSub = basicEdu_context.find("griddy","Technical Programming"); Assert.AreEqual(expectedUpdate, updateEduSub.subjectDescription); /*Delete*/ basicEdu_context.removeByUserId("griddy", "Technical Programming"); bool expectedDelBasicEduSub = false; bool actualDelBasicEduSub = basicEdu_context.isFound("griddy", "Technical Programming"); Assert.AreEqual(expectedDelBasicEduSub, actualDelBasicEduSub); edu_context.removeByUserId("griddy"); acc_context.removeByUserId("griddy"); }
public void BasicEduDAO_Test() { /*Context*/ BasicEduDAO edu_context = new BasicEduDAO(); AccountDAO acc_context = new AccountDAO(); /*Insert*/ AccountDTO acc = new AccountDTO(); acc.userName = "******"; acc.password = "******"; acc.accountType = "administrator"; acc.status = "active"; acc_context.presist(acc); BasicEduDTO basic_Edu = new BasicEduDTO(); basic_Edu.userName = "******"; basic_Edu.country = "South Africa"; basic_Edu.levelCompleted = 12; basic_Edu.province = "WP"; basic_Edu.school = "Brackenfell High School"; basic_Edu.town = "Cape Town"; edu_context.presist(basic_Edu); /*Update*/ basic_Edu.province = "PE"; edu_context.merge(basic_Edu); string expectedUpdate = "PE"; BasicEduDTO updateEdu = edu_context.find("griddy"); Assert.AreEqual(expectedUpdate, updateEdu.province); ///*Delete*/ edu_context.removeByUserId("griddy"); bool expectedDelBasicEdu = false; bool actualDelBasicEdu = edu_context.isFound("griddy"); Assert.AreEqual(expectedDelBasicEdu, actualDelBasicEdu); acc_context.removeByUserId("griddy"); }