public void NestedFoldersWilcard()
            {
                // Given
                TestFileProvider fileProvider = new TestFileProvider
                {
                    { "/a/b/c/x.txt" },
                    { "/a/bar/foo/y.txt" }
                };
                IDirectory directory = fileProvider.GetDirectory("/a");

                // When
                IEnumerable <IFile> matches = Globber.GetFiles(directory, new[] { "**/*.txt" });

                // Then
                CollectionAssert.AreEquivalent(new[] { "/a/b/c/x.txt", "/a/bar/foo/y.txt" }, matches.Select(x => x.Path.FullPath));
            }
            public void RecursiveWildcardTests(string directoryPath, string[] patterns, string[] resultPaths)
            {
                // Given
                TestFileProvider fileProvider = new TestFileProvider
                {
                    { "/a/b/c/d/e/1/2/3.txt" }
                };
                IDirectory directory = fileProvider.GetDirectory(directoryPath);

                // When
                IEnumerable <IFile> matches = Globber.GetFiles(directory, patterns);
                IEnumerable <IFile> matchesReversedSlash = Globber.GetFiles(directory, patterns.Select(x => x.Replace("/", "\\")));

                // Then
                CollectionAssert.AreEquivalent(resultPaths, matches.Select(x => x.Path.FullPath));
                CollectionAssert.AreEquivalent(resultPaths, matchesReversedSlash.Select(x => x.Path.FullPath));
            }
            public void DoubleWildcardShouldMatchZeroOrMorePathSegments()
            {
                // Given
                TestFileProvider fileProvider = new TestFileProvider
                {
                    { "/root/a/x.txt" },
                    { "/root/a/b/x.txt" },
                    { "/root/d/x.txt" }
                };
                IDirectory directory = fileProvider.GetDirectory("/");

                // When
                IEnumerable <IFile> matches = Globber.GetFiles(directory, new[] { "root/{a,}/**/x.txt" });

                // Then
                matches.Select(x => x.Path.FullPath).ShouldBe(
                    new[] { "/root/a/x.txt", "/root/a/b/x.txt", "/root/d/x.txt" }, true);
            }
            public void WildcardShouldMatchZeroOrMore()
            {
                // Given
                TestFileProvider fileProvider = new TestFileProvider();

                fileProvider.AddDirectory("/");
                fileProvider.AddDirectory("/root");
                fileProvider.AddDirectory("/root/a");
                fileProvider.AddDirectory("/root/a/b");
                fileProvider.AddDirectory("/root/d");
                fileProvider.AddFile("/root/a/x.txt");
                fileProvider.AddFile("/root/a/b/x.txt");
                fileProvider.AddFile("/root/a/b/.txt");
                fileProvider.AddFile("/root/d/x.txt");
                IDirectory directory = fileProvider.GetDirectory("/");

                // When
                IEnumerable <IFile> matches = Globber.GetFiles(directory, new[] { "root/**/*.txt" });

                // Then
                matches.Select(x => x.Path.FullPath).ShouldBe(
                    new[] { "/root/a/x.txt", "/root/a/b/x.txt", "/root/a/b/.txt", "/root/d/x.txt" }, true);
            }