Example #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);
        }
Example #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);
        }
        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);
            });
        }
        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);
            });
        }
Example #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
            };
        }
Example #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
            };
        }
Example #7
0
 public SkillDto Update(SkillDto skill)
 {
     return Put<SkillDto, SkillDto>("api/skill", skill);
 }
Example #8
0
 public SkillDto Create(SkillDto skill)
 {
     return Post<SkillDto, SkillDto>("api/skill", skill);
 }
Example #9
0
 public SkillDto Update(SkillDto skill)
 {
     return _skillClient.Update(skill);
 }
Example #10
0
 public SkillDto Create(SkillDto skill)
 {
     return _skillClient.Create(skill);
 }
Example #11
0
 public SkillDto Update(SkillDto skill)
 {
     return _skillFacade.Update(skill);
 }
Example #12
0
 public SkillDto Create(SkillDto skill)
 {
     return _skillFacade.Create(skill);
 }