public void ByCategoryReturnsAllPostsContainingCategory() { const string expectedTitle = "Expected"; var expectedCategory = new Category { UrlName = "Expected Category" }; var otherCategory = new Category { UrlName = "Other Category" }; var session = WithSessionContainingPosts( new Post { Title = expectedTitle, Category = expectedCategory }, new Post { Title = "Not Expected", Category = otherCategory }, new Post { Title = "Not Expected" }); var repository = new PostRepository(session); var result = repository.ByCategory(expectedCategory); Assert.That(result.All(p => p.Title == expectedTitle)); }