public void TestDeleteAll() { // Arrange const int EXPECTED = 0; const int START_COUNT = 5; IPartyInvitesR vRepository = new PartyInvitesR(); List <GuestResponse> vList = vRepository.GetAll(); foreach (GuestResponse vRec in vList) { vRepository.Delete(vRec.Id); } int vInitialCount = vRepository.Count(); // Should be zero GuestResponse vNewRec = MakeNewRecord(); vRepository.Add(vNewRec); vNewRec = MakeNewRecord(); vRepository.Add(vNewRec); vNewRec = MakeNewRecord(); vRepository.Add(vNewRec); vNewRec = MakeNewRecord(); vRepository.Add(vNewRec); vNewRec = MakeNewRecord(); vRepository.Add(vNewRec); int vStartCount = vRepository.Count(); // Act vRepository.DeleteAll(); // Assert vInitialCount.Should().Be(0); vStartCount.Should().Be(START_COUNT); vRepository.Count().Should().Be(EXPECTED); }
public void TestAdd() { // Arrange PrepareStorage(); int vExpected = 1; IPartyInvitesR vRepository = new PartyInvitesR(); vRepository.DeleteAll(); int vCount = vRepository.Count(); GuestResponse vRecord = MakeNewRecord(); // Act vRepository.Add(vRecord); int vResult = vRepository.Count(); // Assert vCount.Should().Be(0); vResult.Should().Be(vExpected); }
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); }
private void PrepareStorage() { IPartyInvitesR vRepository = new PartyInvitesR(); vRepository.DeleteAll(); }