public void verify_deletion_of_a_test_document() { var item = new TestDocument { Id = Guid.NewGuid(), Name = "foo" }; using (var sessionProvider = new TestSessionProvider()) { var repo = new BlogFlowRepository(sessionProvider.Session); repo.Add(item); repo.Save(); var retrievedItem = repo.SingleOrDefault<TestDocument>(p => p.Name == "foo"); Assert.That(retrievedItem, Is.Not.Null); repo.Delete(retrievedItem); repo.Save(); retrievedItem = repo.SingleOrDefault<TestDocument>(p => p.Name == "foo"); Assert.That(retrievedItem, Is.Null); } }
public void verify_retrieval_of_multiple_documents() { var item1 = new TestDocument { Id = Guid.NewGuid(), Name = "foo1" }; var item2 = new TestDocument { Id = Guid.NewGuid(), Name = "foo2" }; using (var sessionProvider = new TestSessionProvider()) { var repo = new BlogFlowRepository(sessionProvider.Session); repo.Add(item1); repo.Add(item2); repo.Save(); var retrievedItems = repo.All<TestDocument>(); Assert.That(retrievedItems.Count(), Is.EqualTo(2)); Assert.That(retrievedItems.Where(p => p.Name == "foo1").Count(), Is.EqualTo(1)); Assert.That(retrievedItems.Where(p => p.Name == "foo2").Count(), Is.EqualTo(1)); } }