Exemplo n.º 1
0
        public void CanPersistACompany()
        {
            //Arrange
            var context           = GetSqlLiteContext();
            var cvRepository      = new CvRepository(context);
            var companyRepository = new CompanyRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId = cvRepository.Get()[0].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"
            };

            companyRepository.AddToCv(company, cvId);

            //Assert
            var result = companyRepository.GetForCv(cvId)[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.Cv.Id);
        }
Exemplo n.º 2
0
        public void CanDeleteCompany()
        {
            //Arrange
            var context           = GetSqlLiteContext();
            var cvRepository      = new CvRepository(context);
            var companyRepository = new CompanyRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId    = cvRepository.Get()[0].Id;
            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"
            };

            companyRepository.AddToCv(company, cvId);
            var companyId = companyRepository.GetForCv(cvId)[0].Id;

            //Act
            companyRepository.Delete(companyId);

            //Assert
            Assert.AreEqual(0, companyRepository.GetForCv(cvId).Count);
        }
        public void CanPersistASkill()
        {
            //Arrange
            var context         = GetSqlLiteContext();
            var cvRepository    = new CvRepository(context);
            var skillRepository = new SkillRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId = cvRepository.Get()[0].Id;

            //Act
            var skill = new Skill()
            {
                Name = "Continuous Delivery", Blurb = "Awesome at CI and CD"
            };

            skillRepository.AddToCv(skill, cvId);

            //Assert
            var result = skillRepository.GetForCv(cvId)[0];

            Assert.AreEqual(skill.Name, result.Name);
            Assert.AreEqual(skill.Blurb, result.Blurb);
            Assert.AreEqual(cvId, result.Cv.Id);
        }
Exemplo n.º 4
0
        public void CanUpdateCv()
        {
            //Arrange
            var cvRepository = new CvRepository(GetSqlLiteContext());
            var cv           = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId = cvRepository.Get()[0].Id;

            //Act
            var cvUpdate = new Cv()
            {
                Id = cvId, Name = Constants.CvNameUpdate, TagLine = Constants.CvTagLineUpdate, Blurb = Constants.CvBlurbUpdate
            };

            cvRepository.Update(cvUpdate);

            //Assert
            var result = cvRepository.Get(cvId);

            Assert.AreEqual(Constants.CvNameUpdate, result.Name);
            Assert.AreEqual(Constants.CvTagLineUpdate, result.TagLine);
            Assert.AreEqual(Constants.CvBlurbUpdate, result.Blurb);
        }
        public void CanDeleteSkill()
        {
            //Arrange
            var context         = GetSqlLiteContext();
            var cvRepository    = new CvRepository(context);
            var skillRepository = new SkillRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId  = cvRepository.Get()[0].Id;
            var skill = new Skill()
            {
                Name = "Continuous Delivery", Blurb = "Awesome at CI and CD"
            };

            skillRepository.AddToCv(skill, cvId);
            var skillId = skillRepository.GetForCv(cvId)[0].Id;

            //Act
            skillRepository.Delete(skillId);

            //Assert
            Assert.AreEqual(0, skillRepository.GetForCv(cvId).Count);
        }
Exemplo n.º 6
0
        public void BeforeEachTest()
        {
            _repository = new CvRepository();
            _cv = new Cv();

            var cv = _repository.GetElizabethsCv();
            _cv.Id = cv.Id;
            _cv.Educations = cv.Educations;
            _cv.Achievements = cv.Achievements;
        }
        public void MultipleSkillsAreReturnedInOrder()
        {
            //Arrange
            var context         = GetSqlLiteContext();
            var cvRepository    = new CvRepository(context);
            var skillRepository = new SkillRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId = cvRepository.Get()[0].Id;

            //Act
            var skill1 = new Skill()
            {
                Name = "Continuous Delivery", Blurb = "Awesome at CI and CD", Order = 5
            };

            skillRepository.AddToCv(skill1, cvId);
            var skill2 = new Skill()
            {
                Name = "DevOps", Blurb = "DevOps Master", Order = 3
            };

            skillRepository.AddToCv(skill2, cvId);
            var skill3 = new Skill()
            {
                Name = "Agile", Blurb = "Agile Expert", Order = 1
            };

            skillRepository.AddToCv(skill3, cvId);
            var skill4 = new Skill()
            {
                Name = "Software Engineering", Blurb = "Since 2001", Order = 2
            };

            skillRepository.AddToCv(skill4, cvId);

            //Assert
            var results = skillRepository.GetForCv(cvId);

            var order = 0;

            foreach (var result in results)
            {
                Assert.IsTrue(result.Order > order);
                order = result.Order;
            }
        }
Exemplo n.º 8
0
        public void CanDeleteCv()
        {
            //Arrange
            var cvRepository = new CvRepository(GetSqlLiteContext());
            var cv           = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId = cvRepository.Get()[0].Id;

            //Act
            cvRepository.Delete(cvId);

            //Assert
            Assert.AreEqual(0, cvRepository.Get().Count);
        }
Exemplo n.º 9
0
        public void CanPersistACv()
        {
            //Arrange
            var cvRepository = new CvRepository(GetSqlLiteContext());
            var cv           = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            //Act
            cvRepository.Add(cv);

            //Assert
            var cvs    = cvRepository.Get();
            var result = cvs[0];

            Assert.AreEqual(cv.Name, result.Name);
            Assert.AreEqual(cv.Blurb, result.Blurb);
        }
Exemplo n.º 10
0
        public void CanUpdateSkill()
        {
            //Arrange
            var context         = GetSqlLiteContext();
            var cvRepository    = new CvRepository(context);
            var skillRepository = new SkillRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId  = cvRepository.Get()[0].Id;
            var skill = new Skill()
            {
                Name = "Continuous Delivery", Blurb = "Awesome at CI and CD"
            };

            skillRepository.AddToCv(skill, cvId);
            var skillId = skillRepository.GetForCv(cvId)[0].Id;

            //Act
            var skillUpdate = new Skill()
            {
                Id = skillId, Name = "C#", Blurb = "Been using it since 2001."
            };

            skillRepository.Update(skillUpdate);

            //Assert
            var result = skillRepository.Get(skillId);

            Assert.AreEqual(skillUpdate.Name, result.Name);
            Assert.AreEqual(skillUpdate.Blurb, result.Blurb);
            Assert.AreEqual(cvId, result.Cv.Id);
        }
Exemplo n.º 11
0
 public void Test1()
 {
     var repository = new CvRepository();
 }
Exemplo n.º 12
0
        public void MultipleCompaniesAreReturnedInDateOrder()
        {
            //Arrange
            var context           = GetSqlLiteContext();
            var cvRepository      = new CvRepository(context);
            var companyRepository = new CompanyRepository(context);

            var cv = new Cv()
            {
                Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb
            };

            cvRepository.Add(cv);
            var cvId = cvRepository.Get()[0].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"
            };

            companyRepository.AddToCv(company1, cvId);
            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."
            };

            companyRepository.AddToCv(company2, cvId);
            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."
            };

            companyRepository.AddToCv(company3, cvId);
            var company4 = new Company()
            {
                Start = DateTime.Parse("2003-12-01"), End = DateTime.Parse("2007-04-01"), CompanyName = "Carlsberg UK", Role = "Systems Engineer", Location = "Leeds"
            };

            companyRepository.AddToCv(company4, cvId);
            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"
            };

            companyRepository.AddToCv(company5, cvId);
            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"
            };

            companyRepository.AddToCv(company6, cvId);
            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"
            };

            companyRepository.AddToCv(company7, cvId);
            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"
            };

            companyRepository.AddToCv(company8, cvId);
            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"
            };

            companyRepository.AddToCv(company9, cvId);

            //Assert
            var results = companyRepository.GetForCv(cvId);

            var startDate = DateTime.Parse("3000-01-01");

            foreach (var result in results)
            {
                Assert.IsTrue(result.Start < startDate);
                startDate = result.Start;
            }
        }
 public void BeforeEachTest()
 {
     _repository = new CvRepository();
     _cv = _repository.GetElizabethsCv();
 }
Exemplo n.º 14
0
 private Cv GetUpdatedCv()
 {
     var repo = new CvRepository();
     repo.SaveNewCv(_cv);
     return repo.GetElizabethsCv();
 }