public void DirectoryLongerThanMaxDirectoryAsPath_DoesntThrow() { Assert.All((IOInputs.GetPathsLongerThanMaxDirectory(GetTestFilePath())), (path) => { Assert.False(Exists(path)); }); }
public void DirectoryLongerThanMaxDirectoryAsPath_ThrowsPathTooLongException() { var paths = IOInputs.GetPathsLongerThanMaxDirectory(); Assert.All(paths, (path) => { Assert.Throws <PathTooLongException>(() => Create(path)); }); }
[PlatformSpecific(TestPlatforms.Windows)] // long directory path succeeds public void DirectoryLongerThanMaxDirectoryAsPath_Succeeds() { var paths = IOInputs.GetPathsLongerThanMaxDirectory(GetTestFilePath()); Assert.All(paths, (path) => { var result = Create(path); Assert.True(Directory.Exists(result.FullName)); }); }
public void DirectoryLongerThanMaxDirectoryAsPath_ThrowsPathTooLongException() { var paths = IOInputs.GetPathsLongerThanMaxDirectory(); Assert.All(paths, (path) => { Assert.Throws <PathTooLongException>(() => Create(path)); Directory.Delete(Path.Combine(Path.GetPathRoot(Directory.GetCurrentDirectory()), path.Split(Path.DirectorySeparatorChar)[1]), true); }); }
public static void Exists_DirectoryLongerThanMaxDirectoryAsPath_ReturnsFalse() { var paths = IOInputs.GetPathsLongerThanMaxDirectory(); foreach (string path in paths) { bool result = Directory.Exists(path); Assert.False(result, path); } }
public void Path_With_Longer_Than_MaxDirectory_Throws_Exception() { string testDir = GetTestFilePath(); Directory.CreateDirectory(testDir); Assert.All((IOInputs.GetPathsLongerThanMaxDirectory()), (path) => { Assert.Throws <PathTooLongException>(() => Move(testDir, path)); Assert.Throws <PathTooLongException>(() => Move(path, testDir)); }); }
[PlatformSpecific(PlatformID.Windows)] // max directory size not fixed on Unix public static void CreateDirectory_DirectoryLongerThanMaxDirectoryAsPath_ThrowsPathTooLongException() { var paths = IOInputs.GetPathsLongerThanMaxDirectory(); foreach (var path in paths) { Assert.Throws <PathTooLongException>(() => { Directory.CreateDirectory(path); }); } }
public void Path_With_Longer_Than_MaxDirectory_Succeeds() { string testDir = GetTestFilePath(); Directory.CreateDirectory(testDir); Assert.True(Directory.Exists(testDir), "test directory should exist"); Assert.All((IOInputs.GetPathsLongerThanMaxDirectory(GetTestFilePath())), (path) => { string baseDestinationPath = Path.GetDirectoryName(path); if (!Directory.Exists(baseDestinationPath)) { Directory.CreateDirectory(baseDestinationPath); } Assert.True(Directory.Exists(baseDestinationPath), "base destination path should exist"); Move(testDir, path); Assert.False(Directory.Exists(testDir), "source directory should exist"); Assert.True(Directory.Exists(path), "destination directory should exist"); Move(path, testDir); Assert.False(Directory.Exists(path), "source directory should exist"); Assert.True(Directory.Exists(testDir), "destination directory should exist"); }); }