예제 #1
0
 public void DirectoryLongerThanMaxDirectoryAsPath_DoesntThrow()
 {
     Assert.All((IOInputs.GetPathsLongerThanMaxDirectory(GetTestFilePath())), (path) =>
     {
         Assert.False(Exists(path));
     });
 }
예제 #2
0
        public void DirectoryLongerThanMaxDirectoryAsPath_ThrowsPathTooLongException()
        {
            var paths = IOInputs.GetPathsLongerThanMaxDirectory();

            Assert.All(paths, (path) =>
            {
                Assert.Throws <PathTooLongException>(() => Create(path));
            });
        }
예제 #3
0
 [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));
     });
 }
예제 #4
0
        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);
            });
        }
예제 #5
0
파일: Exists.cs 프로젝트: yang73137/corefx
    public static void Exists_DirectoryLongerThanMaxDirectoryAsPath_ReturnsFalse()
    {
        var paths = IOInputs.GetPathsLongerThanMaxDirectory();

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

            Assert.False(result, path);
        }
    }
예제 #6
0
        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));
            });
        }
예제 #7
0
    [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);
            });
        }
    }
예제 #8
0
        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");
            });
        }