public void InMemoryParticipantStore_canAdd() { var participantAdded = new Participant(1, "Bob", "Smith"); IRepository <Participant> store = new InMemoryParticipantStore(); store.Add(participantAdded); var resultParticipant = store.Single(a => a.ID == participantAdded.ID); Assert.That(resultParticipant, Is.EqualTo(participantAdded)); }
public void InMemoryParticipantStore_canUpsertAndThenSelect() { var participantAdded = new Participant(null, "Bob", "Smith"); IRepository <Participant> store = new InMemoryParticipantStore(); store.Add(participantAdded); var resultParticipant = store.Single(a => a.FirstName == participantAdded.FirstName); Assert.That(resultParticipant.FirstName, Is.EqualTo(participantAdded.FirstName)); Assert.That(resultParticipant.ID, Is.Not.Null); }
public void InMemoryParticipantStore_CanLookup() { //Setup List <Participant> originalList = new List <Participant>(); var expectedParticipant = new Participant(1, "Bob", "Smith"); originalList.Add(expectedParticipant); IRepository <Participant> store = new InMemoryParticipantStore(originalList); var result = store.Single(p => p.ID == expectedParticipant.ID); //Assert Results Assert.That(result, Is.EqualTo(expectedParticipant)); }
public void InMemoryParticipantStore_canUpsertManyAndThenSelect() { var participant1 = new Participant(null, "Bob", "Smith"); var participant2 = new Participant(null, "John", "Doe"); var participantArray = new Participant[] { participant1, participant2 }; IRepository <Participant> store = new InMemoryParticipantStore(); store.Add(participantArray); var resultParticipant = store.Single(a => a.FirstName == participant1.FirstName); Assert.That(resultParticipant.FirstName, Is.EqualTo(participant1.FirstName)); Assert.That(resultParticipant.ID, Is.Not.Null); }
public void InMemoryParticipantStore_ReturnsNullWhenNotFound() { //Setup List <Participant> originalList = new List <Participant>(); var participant = new Participant(1, "Bob", "Smith"); originalList.Add(participant); var nonExistantID = 12345; IRepository <Participant> store = new InMemoryParticipantStore(originalList); var result = store.Single(p => p.ID == nonExistantID); //Assert Results Assert.That(result, Is.Null); }