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); }
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); }); }
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 }; }
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 }; }
public SkillDto Update(SkillDto skill) { return Put<SkillDto, SkillDto>("api/skill", skill); }
public SkillDto Create(SkillDto skill) { return Post<SkillDto, SkillDto>("api/skill", skill); }
public SkillDto Update(SkillDto skill) { return _skillClient.Update(skill); }
public SkillDto Create(SkillDto skill) { return _skillClient.Create(skill); }
public SkillDto Update(SkillDto skill) { return _skillFacade.Update(skill); }
public SkillDto Create(SkillDto skill) { return _skillFacade.Create(skill); }