コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
            }
        }