Пример #1
0
        public async Task <ActionResult> Put(long id, [FromBody] ModifiedSkill skill)
        {
            var updatedEntity = await _codingSkillService.Update(id, _mapper.Map <CodingSkillEntity>(skill));

            await _dbTransaction.CompleteAsync();

            return(Ok(_mapper.Map <CodingSkill>(updatedEntity)));
        }
Пример #2
0
        public async Task UpdateCodingSkill()
        {
            var testSkill = (await Get <List <CodingSkill> >(API_URL)).First();
            var modified  = new ModifiedSkill
            {
                Name  = testSkill.Name + "-334",
                Level = (int)testSkill.Level != 1 ? testSkill.Level - 1 : CodingSkillLevel.Master
            };

            CodingSkill updatedSkill = await Put <CodingSkill>($"{API_URL}/{testSkill.Id}", modified);

            Assert.True(updatedSkill != null, $"Test skill with id {testSkill.Id} should found from the API.");
            Assert.True(updatedSkill.Name == modified.Name, $"Found coding skill name doesn't match to updated one.");
            Assert.True(updatedSkill.Level == modified.Level, $"Found coding skill level doesn't match to updated one.");
        }