public void RemoveTest() { CandidateQualificationService.RemoveQualificationFromCandidate(Candidate.Id, Qualification.Id); var removed = CandidateQualificationService.GetFromIdPair(Candidate.Id, Qualification.Id); Assert.AreEqual(removed.Id, -1); }
public CandidateQualificationServiceTest() { TecAppContext = new TecAppContext(); CandidateQualificationService = new CandidateQualificationService(TecAppContext); CandidateService = new EmployeeService.CandidateService(TecAppContext); QualificationsService = new QualificationsService.QualificationsService(TecAppContext); }
private void UpdateProc() { if (MessageBox.Show("Are you sure?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { //TODO add message //update candidate name only var newCandidate = OldCandidate; OldCandidate = CandidateService.UpdateCandidate(OldCandidate, NewCandidate); //update candidate qualifications foreach (var v in Qualifications) { if (v.IsSelected) { CandidateQualificationService.AddQualificationToCandidate(new Candidate_Qualification() { Candidate = OldCandidate, Qualification = v.Qualification }); } else { CandidateQualificationService.RemoveQualificationFromCandidate(OldCandidate.Id, v.Qualification.Id); } } //update candidate addresses UpdateCandidateAddresses(); } BackProc(); }
public void GetTest() { var added = CandidateQualificationService.GetFromIdPair(CandidateQualification.CandidateId, CandidateQualification.QualificationId); Assert.AreEqual(added.CandidateId, Candidate.Id); Assert.AreEqual(added.QualificationId, Qualification.Id); Assert.AreEqual(added.Id, CandidateQualification.Id); }
public void AddTest() { var random = new Random(); Candidate = CandidateService.GetAllCandidates()[random.Next(100)]; Qualification = QualificationsService.GetAllQualifications()[random.Next(10)]; CandidateQualification = CandidateQualificationService.AddQualificationToCandidate(new Candidate_Qualification() { Candidate = Candidate, Qualification = Qualification, }); }
//[TestCase(11, 3)] //[TestCase(12, 3)] //[TestCase(13, 3)] //[TestCase(14, 3)] public void AddSpecificCandidateQualificationTest(int candidateId, int qualificationId) { var random = new Random(); Candidate = CandidateService.GetCandidateFromId(candidateId); Qualification = QualificationsService.GetQualificationFromId(qualificationId); CandidateQualification = CandidateQualificationService.AddQualificationToCandidate(new Candidate_Qualification() { Candidate = Candidate, CandidateId = Candidate.Id, Qualification = Qualification, QualificationId = Qualification.Id }); }
private void AddQualifications() { foreach (var v in Qualifications) { if (v.IsSelected) { CandidateQualificationService.AddQualificationToCandidate(new Candidate_Qualification() { Candidate = Candidate, Qualification = v.Qualification }); } } }
public void InitializeQualifications() { var candidateQualifications = CandidateQualificationService.GetAll().Where(c => c.CandidateId == OldCandidate.Id); Qualifications.Clear(); foreach (var v in QualificationsService.GetAllAndMapToQualificationWithCheckBoxDto()) { if (candidateQualifications.Any(d => d.CandidateId == OldCandidate.Id && d.QualificationId == v.Qualification.Id)) { v.IsSelected = true; } else { v.IsSelected = false; } Qualifications.Add(v); } }
private void ConfirmAttendanceProc() { if (MessageBox.Show("Are you sure?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { if (CandidateWithCheckBoxDtos.Count(d => d.IsSelected) > SelectedSession.Location.Capacity) { MessageBox.Show("Too many attendees"); return; } foreach (var v in CandidateWithCheckBoxDtos) { if (v.IsSelected) { var candidateQualifications = CandidateQualificationService.GetAll() .Where(d => d.CandidateId == v.Candidate.Id); var coursePrerequisites = PrerequisitesForCourseService.GetAll() .Where(d => d.CourseId == SelectedSession.Course.Id); if (CandidateIsNotQualified(v.Candidate, candidateQualifications, coursePrerequisites)) { MessageBox.Show($"{v.Candidate.FullName} is not qualified for this course"); return; } CandidateSessionService.Add(new Candidate_Session() { Candidate = v.Candidate, Session = SelectedSession }); } else { CandidateSessionService.Remove(v.Candidate.Id, SelectedSession.Id); } } var candidateSessions = CandidateSessionService.GetAll().Where(d => d.SessionId == SelectedSession.Id); SelectedSession = SessionService.UpdateSessionNumberOfAttendees(SelectedSession, candidateSessions.Count()); } BackProc(); }
public void RemoveTest() { foreach (var v in QualificationsService.GetAllQualifications()) { QualificationsService.RemoveQualification(v); } foreach (var v in AddressCandidateService.GetAllAddressCandidatePairs()) { AddressCandidateService.Remove(v); } foreach (var v in AddressService.GetAllAdresses()) { AddressService.RemoveAddress(v); } foreach (var v in CandidateQualificationService.GetAll()) { CandidateQualificationService.RemoveQualificationFromCandidate(v.CandidateId, v.QualificationId); } foreach (var v in CandidateService.GetAllCandidates()) { CandidateService.RemoveCandidate(v); } foreach (var v in CompanyService.GetAllCompanies()) { CompanyService.RemoveCompany(v); } foreach (var v in CourseService.GetAllCourses()) { CourseService.RemoveCourse(v); } foreach (var v in JobHistoryCompanyService.GetAll()) { JobHistoryCompanyService.Remove(v.JobHistoryId, v.CompanyId); } foreach (var v in JobHistoryJobService.GetAll()) { JobHistoryJobService.Remove(v.JobHistoryId, v.JobId); } foreach (var v in JobHistoryService.GetAllJobHistories()) { JobHistoryService.RemoveJobHistory(v); } foreach (var v in JobService.GetAllJobs()) { JobService.RemoveJob(v); } foreach (var v in LocationService.GetAllLocations()) { LocationService.RemoveLocation(v); } foreach (var v in OpeningService.GetAllOpenings()) { OpeningService.RemoveOpening(v); } foreach (var v in PlacementService.GetAllPlacements()) { PlacementService.RemovePlacement(v); } foreach (var v in PrerequisitesForCourseService.GetAll()) { PrerequisitesForCourseService.Remove(v.CourseId, v.QualificationId); } foreach (var v in QualificationDevelopedByCourseService.GetAll()) { QualificationDevelopedByCourseService.Remove(v.CourseId, v.QualificationId); } }