private IDirectoryInfo CreateDirectoryInternal(string path, DirectorySecurity directorySecurity)
{
if (path == null)
{
throw new ArgumentNullException(nameof(path));
}
if (path.Length == 0)
{
throw new ArgumentException(StringResources.Manager.GetString("PATH_CANNOT_BE_THE_EMPTY_STRING_OR_ALL_WHITESPACE"), "path");
}
path = mockFileDataAccessor.Path.GetFullPath(path).TrimSlashes();
if (!Exists(path))
{
mockFileDataAccessor.AddDirectory(path);
}
var created = new MockDirectoryInfo(mockFileDataAccessor, path);
if (directorySecurity != null)
{
created.SetAccessControl(directorySecurity);
}
return(created);
}