public void load_posts_by_tag() { //// Arrange var filesystem = Substitute.For<FileSystem>(string.Empty); filesystem.GetFiles(Arg.Any<string>()) .Returns(info => new[] {GetFileMock("Code, sitecore"), GetFileMock("Sitecore, Test"), GetFileMock("Test, Code")}); var repository = new PostRepository(filesystem); //// Act var posts = repository.FindByTag("sitecore").ToList(); //// Assert posts.Should().HaveCount(2); foreach (var post in posts) { post.Tags.Count.Should().Be(2); post.Tags.Should().Contain(new Tag("Sitecore")); } }