public void ByTagReturnsAllPostsContainingTag() { const string expectedTitle = "Expected"; var expectedTag = new Tag { UrlName = "Expected Tag" }; var otherTag = new Tag { UrlName = "Other Tag" }; var session = WithSessionContainingPosts( new Post { Title = expectedTitle, Tags = new List <Tag> { expectedTag, otherTag } }, new Post { Title = expectedTitle, Tags = new List <Tag> { expectedTag } }, new Post { Title = "Not Expected", Tags = new List <Tag> { otherTag } }, new Post { Title = "Not Expected" }); var repository = new PostRepository(session); var result = repository.ByTag(expectedTag); Assert.That(result.All(p => p.Title == expectedTitle)); }