public void EnumerateFilesWithGlob(string pattern, string expectedFileMatchName, int expectedQty = 1) { var content = "file-content" + Environment.NewLine; var configPath = Path.Combine(rootPath, "Config"); Directory.CreateDirectory(configPath); Directory.CreateDirectory(Path.Combine(configPath, "Feature1")); Directory.CreateDirectory(Path.Combine(configPath, "Feature2")); Action <string, string, string> writeFile = (p1, p2, p3) => fileSystem.OverwriteFile(p3 == null ? Path.Combine(p1, p2) : Path.Combine(p1, p2, p3), content); // NOTE: create all the files in *every case*, and TestCases help supply the assert expectations writeFile(rootPath, "root.config", null); writeFile(rootPath, "r.txt", null); writeFile(configPath, "c.config", null); writeFile(configPath, "Feature1", "f1.txt"); writeFile(configPath, "Feature1", "f1-a.config"); writeFile(configPath, "Feature1", "f1-b.config"); writeFile(configPath, "Feature2", "f2.config"); var result = fileSystem.EnumerateFilesWithGlob(rootPath, pattern).ToList(); result.Should() .HaveCount(expectedQty, $"{pattern} should have found {expectedQty}, but found {result.Count}"); result.Should() .Contain(r => Path.GetFileName(r) == expectedFileMatchName, $"{pattern} should have found {expectedFileMatchName}, but didn't"); }