public void Update(GuestResponse aGuestResponse) { GuestResponse vGuest = _Storage.FirstOrDefault(_ => _.Id.Equals(aGuestResponse.Id)); vGuest?.AssignFrom(aGuestResponse); }
public List <GuestResponse> GetAll() { List <GuestResponse> vResult = new List <GuestResponse>(); foreach (GuestResponse vRec in _Storage) { GuestResponse vNewRec = new GuestResponse(); vNewRec.AssignFrom(vRec); vResult.Add(vNewRec); } return(vResult); }
public void TestUpdate() { // Arrange const bool EXPECTED = false; PrepareStorage(); IPartyInvitesR vRepository = new PartyInvitesR(); vRepository.DeleteAll(); GuestResponse vNewRec = MakeNewRecord(true); vRepository.Add(vNewRec); GuestResponse vUpdatedRec = new GuestResponse(); vUpdatedRec.AssignFrom(vNewRec); vUpdatedRec.WillAttend = EXPECTED; // Act vRepository.Update(vUpdatedRec); GuestResponse vResult = vRepository.Get(vUpdatedRec.Id); // Assert vResult.WillAttend.Should().Be(EXPECTED); }