예제 #1
0
        public void CanCreate()
        {
            var skillToCreateDto = new SkillDto { Name = "Bakken" };
            var createdSkill = new Skill { Id = 1, Name = skillToCreateDto.Name };

            _skillRepository.Create(Arg.Any<Skill>()).Returns(createdSkill);

            var createdSkillDto = _skillFacade.Create(skillToCreateDto);

            _skillRepository.Received().Create(Arg.Any<Skill>());
            Assert.NotNull(createdSkillDto);
            Assert.Equal(createdSkill.Id, createdSkillDto.Id);
        }
예제 #2
0
        public void CanUpdate()
        {
            var updatedSkill = new Skill { Id = 1, Name = "Bakken" };
            var skillToUpdateDto = new SkillDto { Id = updatedSkill.Id, Name = updatedSkill.Name };

            _skillRepository.Update(Arg.Any<Skill>()).Returns(updatedSkill);

            var updatedSkillDto = _skillFacade.Update(skillToUpdateDto);

            _skillRepository.Received().Update(Arg.Any<Skill>());
            Assert.NotNull(updatedSkillDto);
            Assert.Equal(updatedSkillDto.Id, updatedSkillDto.Id);
            Assert.Equal(updatedSkillDto.Name, updatedSkillDto.Name);
        }
예제 #3
0
        public void CanGet()
        {
            _server.Run((baseUri, server) =>
            {
                server.RegisterInstance(_skillFacade);

                var skill = new SkillDto { Id = 1, Name = "Snijden" };

                _skillFacade.Get(skill.Id).ReturnsForAnyArgs(skill);

                var foundSkill = DomainAgent.CreateSkillRestClient(baseUri).Get(skill.Id);

                _skillFacade.Received().Get(skill.Id);
                Assert.NotNull(foundSkill);
                Assert.Equal(skill.Id, foundSkill.Id);
            });
        }
예제 #4
0
        public void CanCreate()
        {
            _server.Run((baseUri, server) =>
            {
                server.RegisterInstance(_skillFacade);

                var skillToCreateDto = new SkillDto { Name = "Bakken" };
                var createdSkillDto = new SkillDto { Id = 1, Name = skillToCreateDto.Name };

                _skillFacade.Create(Arg.Any<SkillDto>()).ReturnsForAnyArgs(createdSkillDto);

                var skill = DomainAgent.CreateSkillRestClient(baseUri).Create(skillToCreateDto);

                _skillFacade.Received().Create(Arg.Any<SkillDto>());
                Assert.NotNull(skill);
                Assert.True(skill.Id > 0);
                Assert.Equal(skillToCreateDto.Name, skill.Name);
            });
        }
예제 #5
0
        public SkillDto Update(SkillDto skill)
        {
            var updatedSkill = _skillRepository.Update(new Skill
            {
                Id = skill.Id,
                Name = skill.Name,
                Weight = skill.Weight
            });

            if (updatedSkill == null)
            {
                return null;
            }

            return new SkillDto
            {
                Id = updatedSkill.Id,
                Name = updatedSkill.Name,
                Weight = updatedSkill.Weight
            };
        }
예제 #6
0
        public SkillDto Create(SkillDto skill)
        {
            var createdSkill = _skillRepository.Create(new Skill
            {
                Id = skill.Id,
                Name = skill.Name,
                Weight = skill.Weight
            });

            if (createdSkill == null)
            {
                return null;
            }

            return new SkillDto
            {
                Id = createdSkill.Id,
                Name = createdSkill.Name,
                Weight = createdSkill.Weight
            };
        }
예제 #7
0
 public SkillDto Update(SkillDto skill)
 {
     return Put<SkillDto, SkillDto>("api/skill", skill);
 }
예제 #8
0
 public SkillDto Create(SkillDto skill)
 {
     return Post<SkillDto, SkillDto>("api/skill", skill);
 }
예제 #9
0
 public SkillDto Update(SkillDto skill)
 {
     return _skillClient.Update(skill);
 }
예제 #10
0
 public SkillDto Create(SkillDto skill)
 {
     return _skillClient.Create(skill);
 }
예제 #11
0
 public SkillDto Update(SkillDto skill)
 {
     return _skillFacade.Update(skill);
 }
예제 #12
0
 public SkillDto Create(SkillDto skill)
 {
     return _skillFacade.Create(skill);
 }