public void CheckUrlsAreCorrect() { //Arrange var cvService = new CvService(new CvRepository(GetSqlLiteContext()), new Mapper().GetMapper()); var testCvs = new List <Models.Cv>() { new Models.Cv { Name = "Cv1", Blurb = "Test 1" }, new Models.Cv { Name = "Cv2", Blurb = "Test 2" }, new Models.Cv { Name = "Cv3", Blurb = "Test 3" } }; //Act foreach (var cv in testCvs) { cvService.Add(cv, Constants.RootUrl); } //Assert var cvs = cvService.Get(Constants.RootUrl); foreach (var cv in cvs) { Assert.AreEqual($"{Constants.RootUrl}/cv/{cv.Id}", cv.Links.Single(o => o.Rel == "self").Href); Assert.AreEqual($"{Constants.RootUrl}/cv/{cv.Id}/companies", cv.Links.Single(o => o.Rel == "companies").Href); Assert.AreEqual($"{Constants.RootUrl}/cv/{cv.Id}/skills", cv.Links.Single(o => o.Rel == "skills").Href); } }
public async Task <IActionResult> Post(List <IFormFile> files) { List <TechnoDuree> listTechnoDuree = new List <TechnoDuree>(); CvAnalysisResult cvAnalysisResult = null; List <CvQuality> listCvQuality = new List <CvQuality>(); string error = ""; foreach (var formFile in files) { if (formFile.Length > 0) { using (var stream = new MemoryStream()) { await formFile.CopyToAsync(stream); cvAnalysisResult = new CvService().TextFromWord(formFile.FileName, stream); listTechnoDuree.AddRange(cvAnalysisResult.ListTechnoDuree); listCvQuality.AddRange(cvAnalysisResult.ListCvQuality); error = cvAnalysisResult.Error; } } } cvAnalysisResult = new CvAnalysisResult(listCvQuality, listTechnoDuree, error); return(new JsonResult(cvAnalysisResult)); }
public void UpdateSkills() { //Arrange var context = GetSqlLiteContext(); var cvService = new CvService(new CvRepository(context), new Mapper().GetMapper()); var skillService = new SkillService(new SkillRepository(context), new Mapper().GetMapper()); var cv = new Cv() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; var cvId = cvService.Add(cv, Constants.RootUrl).Id; var skill = new Skill() { Name = "Continuous Delivery", Blurb = "Awesome at CI and CD", Order = 12 }; var newSkill = skillService.AddToCv(skill, cvId, Constants.RootUrl); var skillId = newSkill.Id; //Act var skillUpdate = new Skill() { Name = "C#", Blurb = "Been using it since 2001.", Order = 24 }; skillService.Update(skillId, skillUpdate); //Assert var result = skillService.Get(skillId, Constants.RootUrl); Assert.AreEqual(skillUpdate.Name, result.Name); Assert.AreEqual(skillUpdate.Blurb, result.Blurb); Assert.AreEqual(skillUpdate.Order, result.Order); Assert.AreEqual(cvId, result.CvId); }
public void UpdateCv() { //Arrange var cvService = new CvService(new CvRepository(GetSqlLiteContext()), new Mapper().GetMapper()); var cv = new Models.Cv() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; cvService.Add(cv, Constants.RootUrl); var cvId = cvService.Get(Constants.RootUrl)[0].Id; //Act var cvUpdate = new Models.CvData() { Name = Constants.CvNameUpdate, TagLine = Constants.CvTagLineUpdate, Blurb = Constants.CvBlurbUpdate }; cvService.Update(cvId, cvUpdate); //Assert var result = cvService.Get(cvId, Constants.RootUrl); Assert.AreEqual(Constants.CvNameUpdate, result.Name); Assert.AreEqual(Constants.CvTagLineUpdate, result.TagLine); Assert.AreEqual(Constants.CvBlurbUpdate, result.Blurb); }
public void AddAndRetieveSkill() { //Arrange var context = GetSqlLiteContext(); var cvService = new CvService(new CvRepository(context), new Mapper().GetMapper()); var skillService = new SkillService(new SkillRepository(context), new Mapper().GetMapper()); var cv = new Cv() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; var cvId = cvService.Add(cv, Constants.RootUrl).Id; //Act var skill = new Skill() { Name = "Continuous Delivery", Blurb = "Awesome at CI and CD", Order = 12 }; var newSkill = skillService.AddToCv(skill, cvId, Constants.RootUrl); //Assert var skills = skillService.GetForCv(cvId, Constants.RootUrl); var result = skills[0]; Assert.AreEqual(skill.Name, result.Name); Assert.AreEqual(skill.Blurb, result.Blurb); Assert.AreEqual(skill.Order, result.Order); Assert.AreEqual(cvId, result.CvId); }
public void AddAndRetieveCompany() { //Arrange var context = GetSqlLiteContext(); var cvService = new CvService(new CvRepository(context), new Mapper().GetMapper()); var companyService = new CompanyService(new CompanyRepository(context), new Mapper().GetMapper()); var cv = new Cv() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; var cvId = cvService.Add(cv, Constants.RootUrl).Id; //Act var company = new Company() { Start = DateTime.Parse("2000-08-01"), End = DateTime.Parse("2002-05-01"), CompanyName = "Carlsberg UK", Role = "Quality Assurance Technician", Location = "Leeds" }; var newCompany = companyService.AddToCv(company, cvId, Constants.RootUrl); //Assert var companies = companyService.GetForCv(cvId, Constants.RootUrl); var result = companies[0]; Assert.AreEqual(company.Start, result.Start); Assert.AreEqual(company.End, result.End); Assert.AreEqual(company.CompanyName, result.CompanyName); Assert.AreEqual(company.Role, result.Role); Assert.AreEqual(company.Location, result.Location); Assert.AreEqual(company.Blurb, result.Blurb); Assert.AreEqual(cvId, result.CvId); }
public void CheckUrlsAreCorrect() { //Arrange var context = GetSqlLiteContext(); var cvService = new CvService(new CvRepository(context), new Mapper().GetMapper()); var skillService = new SkillService(new SkillRepository(context), new Mapper().GetMapper()); var cv = new Cv() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; var cvId = cvService.Add(cv, Constants.RootUrl).Id; //Act var skill1 = new Skill() { Name = "Continuous Delivery", Blurb = "Awesome at CI and CD", Order = 5 }; skillService.AddToCv(skill1, cvId, Constants.RootUrl); var skill2 = new Skill() { Name = "DevOps", Blurb = "DevOps Master", Order = 3 }; skillService.AddToCv(skill2, cvId, Constants.RootUrl); var skill3 = new Skill() { Name = "Agile", Blurb = "Agile Expert", Order = 1 }; skillService.AddToCv(skill3, cvId, Constants.RootUrl); var skill4 = new Skill() { Name = "Software Engineering", Blurb = "Since 2001", Order = 2 }; skillService.AddToCv(skill4, cvId, Constants.RootUrl); //Assert var skills = skillService.GetForCv(cvId, Constants.RootUrl); foreach (var skill in skills) { Assert.AreEqual($"{Constants.RootUrl}/cv/{skill.CvId}", skill.Links.Single(o => o.Rel == "cv").Href); Assert.AreEqual($"{Constants.RootUrl}/skill/{skill.Id}", skill.Links.Single(o => o.Rel == "self").Href); } }
public void AddAndRetieveCv() { //Arrange var cvService = new CvService(new CvRepository(GetSqlLiteContext()), new Mapper().GetMapper()); var cv = new Models.CvData() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; //Act cvService.Add(cv, Constants.RootUrl); //Assert var cvs = cvService.Get(Constants.RootUrl); var result = cvs[0]; Assert.AreEqual(cv.Name, result.Name); Assert.AreEqual(cv.Blurb, result.Blurb); }
static void Main(string[] args) { Console.WriteLine("Witamy w programie do oczytywania i zarzadania plikami pdf"); Console.WriteLine("Wybierz z menu odpowiednia opcję"); MenuActionService actionService = new MenuActionService(); actionService = Initialize(actionService); var mainMenu = actionService.GetMenuActions("Main"); for (var i = 0; i < mainMenu.Count; i++) { Console.WriteLine($"{mainMenu[i].Id}.{mainMenu[i].Name}"); } var operation = Console.ReadKey(); CvService cvService = new CvService(); switch (operation.KeyChar) { case '1': break; case '2': break; case '3': break; case '4': break; case '5': break; default: Console.WriteLine("Wybrano nie poprawna opcję"); break; } }
public CandidatesController(ICandidatesRepository candidatesRepository, IMapper mapper, CvService cvService) { _candidatesRepo = candidatesRepository; _mapper = mapper; _cvService = cvService; }
public CvController() { _service = new CvService(); }
public void CreateCvTest() { var userData = new List <User> { new User { Id = 1, FirstName = "Stamat", LastName = "Stamatov", Age = 13, Email = "*****@*****.**", PhoneNumber = "0877253698", Username = "******", Password = "******", ConfirmPassword = "******", IsEmployer = false } }.AsQueryable(); var cvData = new List <CV> { new CV { Id = 1, Education = "Bachelors", Experience = 5 } }.AsQueryable(); var userMockSet = new Mock <DbSet <User> >(); userMockSet.As <IQueryable <User> >().Setup(u => u.Provider).Returns(userData.Provider); userMockSet.As <IQueryable <User> >().Setup(u => u.Expression).Returns(userData.Expression); userMockSet.As <IQueryable <User> >().Setup(u => u.ElementType).Returns(userData.ElementType); userMockSet.As <IQueryable <User> >().Setup(u => u.GetEnumerator()).Returns(userData.GetEnumerator()); var cvMockSet = new Mock <DbSet <CV> >(); cvMockSet.As <IQueryable <CV> >().Setup(c => c.Provider).Returns(cvData.Provider); cvMockSet.As <IQueryable <CV> >().Setup(c => c.Expression).Returns(cvData.Expression); cvMockSet.As <IQueryable <CV> >().Setup(c => c.ElementType).Returns(cvData.ElementType); cvMockSet.As <IQueryable <CV> >().Setup(c => c.GetEnumerator()).Returns(cvData.GetEnumerator()); var mockContext = new Mock <JobApplicationDbContext>(); mockContext.Setup(c => c.Users).Returns(userMockSet.Object); mockContext.Setup(c => c.CVs).Returns(cvMockSet.Object); var userService = new UserService(mockContext.Object); var cvService = new CvService(mockContext.Object, userService); var users = userData.ToList(); var cvs = cvData.ToList(); users.ForEach(u => userService.Register(u.FirstName, u.LastName, u.Age.Value, u.Email, u.PhoneNumber, u.Username, u.Password, u.ConfirmPassword, u.IsEmployer)); mockContext.Object.Users.FirstOrDefault(u => u.FirstName == "Stamat").Id = users[0].Id; cvs.ForEach(c => cvService.CreateCv(c.Education, c.Experience, users[0].Id)); mockContext.Object.CVs.FirstOrDefault(c => c.Education == "Bachelors").Id = cvs[0].Id; Assert.AreEqual(1, mockContext.Object.CVs.FirstOrDefault(c => c.Education == "Bachelors").Id); //projects.ForEach(p => service.CreateProject(p.Name, p.Technology, p.Description, p.AchievedGoals, p.FutureGoals)); //projects.FirstOrDefault(p => p.Name == "Qko ime").CvId = cvs.FirstOrDefault(c => c.Education == "Bachelors").Id; //projects.FirstOrDefault(p => p.Name == "Qko ime").Cv = cvs.FirstOrDefault(c => c.Education == "Bachelors"); //Assert.AreEqual("Qko ime", mockContext.Object.Projects.FirstOrDefault(p => p.Name == "Qko ime")); }
public void CheckUrlsAreCorrect() { //Arrange var context = GetSqlLiteContext(); var cvService = new CvService(new CvRepository(context), new Mapper().GetMapper()); var companyService = new CompanyService(new CompanyRepository(context), new Mapper().GetMapper()); var cv = new Cv() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; var cvId = cvService.Add(cv, Constants.RootUrl).Id; //Act var company1 = new Company() { Start = DateTime.Parse("2000-08-01"), End = DateTime.Parse("2002-05-01"), CompanyName = "Carlsberg UK", Role = "Quality Assurance Technician", Location = "Leeds" }; companyService.AddToCv(company1, cvId, Constants.RootUrl); var company2 = new Company() { Start = DateTime.Parse("2017-01-01"), End = null, CompanyName = "Maples Group", Role = "Senior Software Engineering Manager (DevOps)", Location = "Montreal", Blurb = @"• Introduced micro service and event sourcing architecture. • Innovated with infrastructure automation, containers and cloud. • Implemented application monitoring and identity management. • Reduced cycle time to < 2 weeks for all apps. • Reduced production bugs to < 1 per deployment across all apps. • Introduced skills matrix and development plans for Engineers. • Matured test automation and significantly reduced regression time." }; companyService.AddToCv(company2, cvId, Constants.RootUrl); var company3 = new Company() { Start = DateTime.Parse("2012-11-01"), End = DateTime.Parse("2017-01-01"), CompanyName = "Maples and Calder", Role = "Software Development Manger", Location = "Cayman Islands", Blurb = @"• Introduced Continuous Integration and Continuous Delivery. • Reduced cycle time to 4 weeks from over 6 months. • Reduced production bugs from 30+ to <5 per deployment. • Trained engineers in TDD, SOLID and Design Patterns. • Introduced coding and architectural standards and pull requests. • Introduced Git, trunk-based development and database source control." }; companyService.AddToCv(company3, cvId, Constants.RootUrl); var company4 = new Company() { Start = DateTime.Parse("2003-12-01"), End = DateTime.Parse("2007-04-01"), CompanyName = "Carlsberg UK", Role = "Systems Engineer", Location = "Leeds" }; companyService.AddToCv(company4, cvId, Constants.RootUrl); var company5 = new Company() { Start = DateTime.Parse("2002-05-01"), End = DateTime.Parse("2003-12-01"), CompanyName = "Carlsberg UK", Role = "Quality System Manager", Location = "Leeds" }; companyService.AddToCv(company5, cvId, Constants.RootUrl); var company6 = new Company() { Start = DateTime.Parse("2007-04-01"), End = DateTime.Parse("2007-11-01"), CompanyName = "Skipton Financial Services", Role = "Business Systems Developer", Location = "Skipton" }; companyService.AddToCv(company6, cvId, Constants.RootUrl); var company7 = new Company() { Start = DateTime.Parse("2007-11-01"), End = DateTime.Parse("2009-12-01"), CompanyName = "Cascade HR", Role = "Project Web Developer", Location = "Leeds" }; companyService.AddToCv(company7, cvId, Constants.RootUrl); var company8 = new Company() { Start = DateTime.Parse("2010-01-01"), End = DateTime.Parse("2011-12-01"), CompanyName = "Maples and Calder", Role = "Software Developer", Location = "Leeds" }; companyService.AddToCv(company8, cvId, Constants.RootUrl); var company9 = new Company() { Start = DateTime.Parse("2011-12-01"), End = DateTime.Parse("2012-11-01"), CompanyName = "Maples and Calder", Role = "eCommerce Software Team Leader", Location = "Leeds" }; companyService.AddToCv(company9, cvId, Constants.RootUrl); //Assert var companies = companyService.GetForCv(cvId, Constants.RootUrl); foreach (var company in companies) { Assert.AreEqual($"{Constants.RootUrl}/cv/{company.CvId}", company.Links.Single(o => o.Rel == "cv").Href); Assert.AreEqual($"{Constants.RootUrl}/company/{company.Id}", company.Links.Single(o => o.Rel == "self").Href); } }