public async void Should_UpdateMember() { UpdateMemberInput input = new UpdateMemberInput { UserName = "******", Member = new MemberDto { UserName = "******", Name = "Hess", Surname = "Johann", IsMale = true, IsSingle = true // changed field } }; var userOutput = await _userAppService.GetUsers(); User user = _userRepository.FirstOrDefault(x => x.UserName == input.UserName); Member member = _memberRepository.FirstOrDefault(m => m.UserName == input.UserName); long userId = user.Id; long memberId = member.Id; DateTime?modificationTime = user.LastModificationTime; _memberAppService.UpdateMember(input); member = _memberRepository.Get(memberId); member.IsSingle.ShouldBe(true); user = _userRepository.Get(userId); // keine Änderung in User // user.LastModificationTime.ShouldBe(modificationTime); // Änderung des UserName bewirkt Änderung in Member und User input.Member.UserName = "******"; _memberAppService.UpdateMember(input); member = _memberRepository.Get(memberId); member.UserName.ShouldBe(input.Member.UserName); user = _userRepository.Get(userId); user.UserName.ShouldBe(input.Member.UserName); }
public void Update(UpdateMemberInput input) { Models.Member output = Mapper.Map <UpdateMemberInput, Models.Member>(input); _memberManager.Update(output); }
public async Task UpdateMember(UpdateMemberInput input) { var member = await _memberRepository.GetAsync(input.Id); input.MapTo(member); await _memberRepository.UpdateAsync(member); }