public void EditAsync_ReturnsCorrectNumberOfModifiedEntries() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { Qualification qualification = new Qualification() { Name = "TestQualification", Description = "random desc" }; EditQualificationServiceModel model = new EditQualificationServiceModel { Id = 1, Name = "NewQualificationName", }; var qualificationsService = new QualificationsService(dbContext); dbContext.Qualifications.Add(qualification); dbContext.SaveChanges(); var result = qualificationsService.EditAsync(model); Assert.Equal(1, result.Result); } }
public void GetAll_ReturnsCorrectCollection() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { Qualification qualification1 = new Qualification() { Name = "TestQualification", Description = "random desc" }; Qualification qualification2 = new Qualification() { Name = "TestQualification2", Description = "random desc2" }; dbContext.Qualifications.Add(qualification1); dbContext.Qualifications.Add(qualification2); dbContext.SaveChanges(); var qualificationsService = new QualificationsService(dbContext); var qualifications = qualificationsService.GetAll(); Assert.Collection(qualifications, item => Assert.Contains("TestQualification", qualification1.Name), item => Assert.Contains("TestQualification2", qualification2.Name)); } }
public void LoadQualifications() { Qualifications.Clear(); foreach (var v in QualificationsService.GetAllAndMapToQualificationWithCheckBoxDto()) { Qualifications.Add(v); } }
private void LoadQualifications() { Qualifications.Clear(); var qualifications = QualificationsService.GetAllQualifications(); foreach (var v in qualifications) { Qualifications.Add(v); } }
public void Exist_ReturnsFalse() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { var qualificationsService = new QualificationsService(dbContext); var result = qualificationsService.Exists(1); Assert.False(result); } }
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, }); }
private void AddOpening(Company v) { var randomJob = JobService.GetAllJobs()[random.Next(100)]; var randomQualification = QualificationsService.GetAllQualifications()[random.Next(10)]; var newOpening = new Opening() { Company = v, Job = randomJob, RequiredQualification = randomQualification }; OpeningService.AddOpening(newOpening); }
//[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 }); }
public void AddTest() { var random = new Random(); Qualification = QualificationsService.GetAllQualifications()[random.Next(10)]; Course = CourseService.GetAllCourses()[random.Next(100)]; PrerequisitesForCourse = PrerequisitesForCourseService.Add(new PrerequisitesForCourse() { Qualification = Qualification, QualificationId = Qualification.Id, Course = Course, CourseId = Course.Id }); }
public void AddTest() { var random = new Random(); Qualification = QualificationsService.GetAllQualifications()[random.Next(10)]; Course = CourseService.GetAllCourses()[random.Next(100)]; QualificationDevelopedByCourse = QualificationDevelopedByCourseService.Add( new QualificationDevelopedByCourse() { Course = Course, CourseId = Course.Id, Qualification = Qualification, QualificationId = Qualification.Id }); }
public void CreateAsync_ReturnsCorrectQualificationId() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { CreateQualificationServiceModel qualification = new CreateQualificationServiceModel { Name = "TestQualification", Description = "random desc", }; var qualificationsService = new QualificationsService(dbContext); var result = qualificationsService.CreateAsync(qualification); Assert.Equal(1, result.Result); } }
public void LoadQualifications() { SelectedQualification = new QualificationWithCheckboxViewDto(); var prerequisites = QualificationsService.GetAllAndMapToQualificationWithCheckBoxDto(); var developedQualifications = QualificationsService.GetAllAndMapToQualificationWithCheckBoxDto(); PrerequisiteQualifications.Clear(); DevelopedQualifications.Clear(); foreach (var v in prerequisites) { PrerequisiteQualifications.Add(v); } foreach (var v in developedQualifications) { DevelopedQualifications.Add(v); } }
public void Count_ReturnsCorrectCount() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { Qualification qualification = new Qualification() { Name = "TestQualification", Description = "random desc" }; dbContext.Qualifications.Add(qualification); dbContext.SaveChanges(); var qualificationsService = new QualificationsService(dbContext); int qualificationsCount = qualificationsService.Count(); Assert.Equal(1, qualificationsCount); } }
public void RemoveAsync_ReturnsTrue() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { Qualification qualification = new Qualification() { Name = "TestQualification", Description = "random desc" }; var qualificationsService = new QualificationsService(dbContext); dbContext.Qualifications.Add(qualification); dbContext.SaveChanges(); var result = qualificationsService.RemoveAsync(1); Assert.True(result.Result); } }
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); } }
public void AddQualification() { QualificationsService.AddQualification(new Qualification() { Code = "SEC-45", Description = "Secretarial work, at least 45 words per minute", }); QualificationsService.AddQualification(new Qualification() { Code = "SEC-60", Description = "Secretarial work, at least 60 words per minute", }); QualificationsService.AddQualification(new Qualification() { Code = "Clerk", Description = "General Clerking work", }); QualificationsService.AddQualification(new Qualification() { Code = "PRG-VB", Description = "Programmer, Visual Basic", }); QualificationsService.AddQualification(new Qualification() { Code = "PRG-C++", Description = "Programmer, C++", }); QualificationsService.AddQualification(new Qualification() { Code = "DBA-ORA", Description = "Database Administrator, Oracle", }); QualificationsService.AddQualification(new Qualification() { Code = "DBA-DB2", Description = "Database Administrator, IBMDB2", }); QualificationsService.AddQualification(new Qualification() { Code = "DBA-SQLSERV", Description = "Database Administrator, MS SQL Server", }); QualificationsService.AddQualification(new Qualification() { Code = "SYS-1", Description = "Systems Analyst, level 1", }); QualificationsService.AddQualification(new Qualification() { Code = "SYS-2", Description = "Systems Analyst, level 2", }); QualificationsService.AddQualification(new Qualification() { Code = "NW-NOV", Description = "Network Administrator, Novell experience", }); QualificationsService.AddQualification(new Qualification() { Code = "WD-CF", Description = "Web Developer, ColdFusion", }); }
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); } }