public void PathWithInvalidCharactersAsPath_ThrowsArgumentException() { var paths = IOInputs.GetPathsWithInvalidCharacters(); Assert.All(paths, (path) => { Assert.Throws <ArgumentException>(() => Create(path)); }); }
public void PathWithIllegalCharacters() { FileInfo testFile = new FileInfo(GetTestFilePath()); testFile.Create().Dispose(); Assert.All(IOInputs.GetPathsWithInvalidCharacters(), (invalid) => { Assert.Throws <ArgumentException>(() => Move(testFile.FullName, invalid)); }); }
public static void Exists_PathWithInvalidCharactersAsPath_ReturnsFalse() { var paths = IOInputs.GetPathsWithInvalidCharacters(); foreach (string path in paths) { bool result = Directory.Exists(path); Assert.False(result, path); } }
public void PathWithInvalidCharactersAsPath_ReturnsFalse() { // Checks that errors aren't thrown when calling Exists() on paths with impossible to create characters Assert.All((IOInputs.GetPathsWithInvalidCharacters()), (component) => { Assert.False(Exists(component)); }); Assert.False(Exists("..")); Assert.False(Exists(".")); }
public static void CreateDirectory_PathWithInvalidCharactersAsPath_ThrowsArgumentException() { var paths = IOInputs.GetPathsWithInvalidCharacters(); foreach (var path in paths) { Assert.Throws <ArgumentException>(() => // BUG 995784: Not setting the parameter name { Directory.CreateDirectory(path); }); } }
public void PathWithInvalidCharactersAsPath_ReturnsFalse() { // Checks that errors aren't thrown when calling Exists() on paths with impossible to create characters char[] trimmed = { (char)0x9, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20, (char)0x85, (char)0xA0 }; Assert.All((IOInputs.GetPathsWithInvalidCharacters()), (component) => { Assert.False(Exists(component)); if (!trimmed.Contains(component.ToCharArray()[0])) { Assert.False(Exists(TestDirectory + Path.DirectorySeparatorChar + component)); } }); }
public void PathWithInvalidCharactersAsPath_ThrowsArgumentException() { var paths = IOInputs.GetPathsWithInvalidCharacters(); Assert.All(paths, (path) => { if (path.Equals(@"\\?\")) { Assert.Throws <IOException>(() => Create(path)); } else if (path.Contains(@"\\?\")) { Assert.Throws <DirectoryNotFoundException>(() => Create(path)); } else { Assert.Throws <ArgumentException>(() => Create(path)); } }); }