Beispiel #1
0
        public void PathWithInvalidCharactersAsPath_ThrowsArgumentException()
        {
            var paths = IOInputs.GetPathsWithInvalidCharacters();

            Assert.All(paths, (path) =>
            {
                Assert.Throws <ArgumentException>(() => Create(path));
            });
        }
Beispiel #2
0
        public void PathWithIllegalCharacters()
        {
            FileInfo testFile = new FileInfo(GetTestFilePath());

            testFile.Create().Dispose();
            Assert.All(IOInputs.GetPathsWithInvalidCharacters(), (invalid) =>
            {
                Assert.Throws <ArgumentException>(() => Move(testFile.FullName, invalid));
            });
        }
Beispiel #3
0
    public static void Exists_PathWithInvalidCharactersAsPath_ReturnsFalse()
    {
        var paths = IOInputs.GetPathsWithInvalidCharacters();

        foreach (string path in paths)
        {
            bool result = Directory.Exists(path);

            Assert.False(result, path);
        }
    }
Beispiel #4
0
        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("."));
        }
Beispiel #5
0
    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);
            });
        }
    }
Beispiel #6
0
 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));
         }
     });
 }
Beispiel #7
0
        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));
                }
            });
        }