So far I created the following interface:
public interface IDirectoryInfoWrapper
{
public IFileInfoWrapper[] GetFiles(string searchPattern, SearchOption searchType);
public IDirectoryInfoWrapper[] GetDirectories();
}
I've been going through the code replacing DirectoryInfo with IDirectoryInfoWrapper
. All was going well until I found this:
// Check that the directory is valid
DirectoryInfo directoryInfo = new DirectoryInfo( argPath );
if ( directoryInfo.Exists == false )
{
throw new ArgumentException
("Invalid IFileFinder.FindFiles Directory Path: " + argPath);
}
It makes no sense to put the constructor in the interface, so what should I do with this line of code:
DirectoryInfo directoryInfo = new DirectoryInfo( argPath );