public static FolderStatus Validate(string path) { FolderStatus status = FolderStatus.Valid; if (String.IsNullOrEmpty(path)) { status |= FolderStatus.NullPath; } else if (!FileSupport.IsValidPath(path)) { status |= FolderStatus.InvalidPath; } else if (!System.IO.Path.IsPathFullyQualified(path)) { status |= FolderStatus.NotFullyQualified; } else if (!Directory.Exists(path)) { status |= FolderStatus.Nonextant; } else if (!FileSupport.IsFolderReadable(path)) { status |= FolderStatus.Unreadable; } return(status); }
public void IsValidPathTest() { Assert.True(FileSupport.IsValidPath(_fixture.WritableFilePath)); Assert.True(FileSupport.IsValidPath(Path.GetFileName(_fixture.WritableFilePath))); Assert.True(FileSupport.IsValidPath("..")); Assert.False(FileSupport.IsValidPath(" ")); Assert.False(FileSupport.IsValidPath("")); Assert.False(FileSupport.IsValidPath(_fixture.InvalidFilePath)); }
public void IsvalidPathTest(string path, bool valid, OSCompatibility platform) { if (OSCompatibilitySupport.IsComplatible(platform)) { bool v1 = FileSupport.IsValidPath(path); Assert.Equal(valid, v1); } else { Assert.True(true); } }