public void DirectoryLongerThanMaxLongPath_DoesntThrow() { Assert.All((IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath())), (path) => { Assert.False(Exists(path), path); }); }
public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsException() { var paths = IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath(), useExtendedSyntax: true); Assert.All(paths, path => AssertExtensions.ThrowsAny <PathTooLongException, DirectoryNotFoundException>(() => Create(path))); }
[PlatformSpecific(TestPlatforms.Windows)] // long directory path throws PathTooLongException public void DirectoryLongerThanMaxLongPath_ThrowsPathTooLongException() { var paths = IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath()); Assert.All(paths, (path) => { Assert.Throws<PathTooLongException>(() => Create(path)); }); }
[PlatformSpecific(TestPlatforms.Windows)] // long directory path with extended syntax throws PathTooLongException public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsPathTooLongException() { var paths = IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath(), useExtendedSyntax: true); Assert.All(paths, (path) => { Assert.Throws <PathTooLongException>(() => Create(path)); }); }
public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsException() { var paths = IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath(), useExtendedSyntax: true); // Ideally this should be PathTooLongException or DirectoryNotFoundException but on some machines // windows gives us ERROR_INVALID_NAME, producing IOException. Assert.All(paths, path => AssertExtensions.ThrowsAny<PathTooLongException, DirectoryNotFoundException, IOException>(() => Create(path))); }
public void Path_Longer_Than_MaxLongPath_Throws_Exception() { string testDir = GetTestFilePath(); Directory.CreateDirectory(testDir); Assert.All((IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath())), (path) => { Assert.Throws<PathTooLongException>(() => Move(testDir, path)); Assert.Throws<PathTooLongException>(() => Move(path, testDir)); }); }
public void LongPath() { string testFileSource = Path.Combine(TestDirectory, GetTestFileName()); File.Create(testFileSource).Dispose(); Assert.All(IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath()), (path) => { AssertExtensions.ThrowsAny <PathTooLongException, FileNotFoundException, DirectoryNotFoundException>(() => Move(testFileSource, path)); File.Delete(testFileSource); AssertExtensions.ThrowsAny <PathTooLongException, FileNotFoundException, DirectoryNotFoundException>(() => Move(path, testFileSource)); }); }
public void LongPath() { //Create a destination path longer than the traditional Windows limit of 256 characters string testFileSource = Path.Combine(TestDirectory, GetTestFileName()); File.Create(testFileSource).Dispose(); Assert.All(IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath()), (path) => { Assert.Throws <PathTooLongException>(() => Move(testFileSource, path)); File.Delete(testFileSource); Assert.Throws <PathTooLongException>(() => Move(path, testFileSource)); }); }
public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsException() { var paths = IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath(), useExtendedSyntax: true); // Long directory path with extended syntax throws PathTooLongException on Desktop. // Everywhere else, it may be either PathTooLongException or DirectoryNotFoundException if (PlatformDetection.IsFullFramework) { Assert.All(paths, path => { Assert.Throws <PathTooLongException>(() => Create(path)); }); } else { Assert.All(paths, path => { AssertExtensions .ThrowsAny <PathTooLongException, DirectoryNotFoundException>( () => Create(path)); }); } }