public void When_obtaining_all_items_they_are_obtained() { // Arrange var Notes = FizzWare.NBuilder.Builder <Note> .CreateListOfSize(10).Build(); var simpleDbNotes = new SdbCollection <Note>(); Notes.ToList().ForEach(simpleDbNotes.Add); var db = MockRepository.GenerateStub <IDb>(); db.Stub(d => d.Query <Note>()).Return(simpleDbNotes); var provider = new SimpleDBProvider <Note, string>(db); // Act var result = provider.GetAll(); // Assert Assert.That(result, Is.EquivalentTo(Notes)); }
public void When_searching_then_all_matching_items_are_obtained() { // Arrange var Notes = FizzWare.NBuilder.Builder <Note> .CreateListOfSize(10).Build(); Notes[3].NoteId = "some other id"; var simpleDbNotes = new SdbCollection <Note>(); Notes.ToList().ForEach(simpleDbNotes.Add); var db = MockRepository.GenerateStub <IDb>(); db.Stub(d => d.Query <Note>()).Return(simpleDbNotes); var provider = new SimpleDBProvider <Note, string>(db); // Act var result = provider.Search((Note) => Note.NoteId == "some other id"); // Assert Assert.That(result.ToArray(), Is.EquivalentTo(new[] { Notes[3] })); }