There is a difference between how the real FS does searchPatterns and how System.IO.Abstractions does them.
With a filesystem like this:
_fs = new MockFileSystem(new Dictionary<string, MockFileData>()
{
{ @"C:\Folder\a.foo", new MockFileData("aaa") },
{ @"C:\Folder\.foo\a.file", new MockFileData("bbb") }
}
Looking for *.foo we have two things, a file (a.foo) and a directory (C:\Folder.foo). However, this fails to find the directory (doing this in a similar setup in the real FS finds both):
var dir = _fs.DirectoryInfo.FromDirectoryName("C:\\");
var directories = dir.GetDirectories("*.foo"); //Nothing is found!
To make this work I need to use a slightly different search pattern:
Which finds the folder (but not the file a.foo).
I suspect the internal searching system (a quick glance shows it builds a regex) is being overly restrictive. The regex obviously wants directories (which are stored ending with a ) to have that double slash, even though windows file globs don't demand this.
There is a difference between how the real FS does searchPatterns and how System.IO.Abstractions does them.
With a filesystem like this:
Looking for *.foo we have two things, a file (a.foo) and a directory (C:\Folder.foo). However, this fails to find the directory (doing this in a similar setup in the real FS finds both):
To make this work I need to use a slightly different search pattern:
Which finds the folder (but not the file a.foo).
I suspect the internal searching system (a quick glance shows it builds a regex) is being overly restrictive. The regex obviously wants directories (which are stored ending with a ) to have that double slash, even though windows file globs don't demand this.