Beispiel #1
0
        // GET: api/Skill
        public HttpResponseMessage Get()
        {
            var skills = _skillService.Get();

            if (skills != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, skills));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound
                                                   , "No skills found"));
            }
        }
        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);
        }
Beispiel #3
0
        public ActionResult <Skill> Get()
        {
            var result = _skillService.Get();

            return(Ok(result));
        }
 public ActionResult <List <Skill> > Get()
 {
     return(_skillService.Get());
 }