Exemplo n.º 1
0
        public void GetSkillById()
        {
            //Arrange
            ISkillRepository sut    = GetInMemorySkillRepository();
            Skill            skill1 = new Skill()
            {
                Id          = 1,
                Name        = "Weaves",
                Description = "Follow Instruction",
                IKC         = "The minimum number of poles should be five...",
                Image       = "weaves.jpeg"
            };

            Skill skill2 = new Skill()
            {
                Id          = 2,
                Name        = "Dog Walk",
                Description = "Contact",
                IKC         = "A walk plank of 1.2m minimum...",
                Image       = "dogwalk.jpg"
            };

            //Act
            Skill savedSkill  = sut.CreateSkill(skill1);
            Skill savedSkill2 = sut.CreateSkill(skill2);

            //Assert
            var foundSkillById = sut.GetSkillById(2);

            Assert.Equal("Dog Walk", foundSkillById.Name);
        }
Exemplo n.º 2
0
        public void Index_Update_Skill_Name()
        {
            //Arrange
            ISkillRepository sut    = GetInMemorySkillRepository();
            Skill            skill1 = new Skill()
            {
                Id          = 1,
                Name        = "Weaves",
                Description = "Follow Instruction",
                IKC         = "The minimum number of poles should be five...",
                Image       = "weaves.jpeg"
            };

            Skill skill2 = new Skill()
            {
                Id          = 1,
                Name        = "Weave Poles",
                Description = "Follow Instruction",
                IKC         = "The minimum number of poles should be five...",
                Image       = "weaves.jpeg"
            };

            //Act
            Skill savedSkill  = sut.CreateSkill(skill1);
            Skill savedSkill1 = sut.UpdateSkill(skill2);

            //Assert
            Assert.Single(sut.AllSkills);
            Assert.Equal("Weave Poles", skill2.Name);
        }
Exemplo n.º 3
0
        public async Task <Guid> CreateSkillAsync(SkillDto skillDto)
        {
            var skill = _mapper.Map <SkillDto, Skill>(skillDto);

            _skillRepository.CreateSkill(skill);

            await _skillRepository.CommitAsync();

            return(skill.ID);
        }
Exemplo n.º 4
0
        public void Index_DeleteSkill()
        {
            //Arrange
            ISkillRepository sut   = GetInMemorySkillRepository();
            Skill            skill = new Skill()
            {
                Id          = 1,
                Name        = "Weaves",
                Description = "Follow Instruction",
                IKC         = "The minimum number of poles should be five...",
                Image       = "weaves.jpeg"
            };

            //Act
            Skill savedSkill  = sut.CreateSkill(skill);
            Skill savedSkill1 = sut.DeleteSkill(skill);

            //Assert
            Assert.Empty(sut.AllSkills);
        }
Exemplo n.º 5
0
 public Skill CreateSkill(InputSkillCreate input) => _skills.CreateSkill(input);