コード例 #1
0
        public void TestGetDirectoriesWithSingleResultSubsetSearch()
        {
            const String randomFileName       = "TestGetDirectoriesWithSubsetSearch";
            var          tempLongPathFilename = uncDirectory.Combine(randomFileName);

            tempLongPathFilename.CreateDirectory();

            try {
                var di   = new DirectoryInfo(uncDirectory);
                var dirs = di.GetDirectories("A*").ToArray();
                Assert.AreEqual(0, dirs.Length);
                Assert.IsFalse(dirs.Any(f => f.Name == randomFileName));
            }
            finally {
                Pri.LongPath.Directory.Delete(tempLongPathFilename);
            }
        }
コード例 #2
0
        public void TestGetDirectoriesWithAllSearch()
        {
            var randomFileName       = Path.GetRandomFileName();
            var tempLongPathFilename = uncDirectory.Combine(randomFileName);

            tempLongPathFilename.CreateDirectory();

            try {
                var di   = new DirectoryInfo(uncDirectory);
                var dirs = di.GetDirectories("*").ToArray();
                Assert.AreEqual(1, dirs.Length);
                Assert.IsTrue(dirs.Any(f => f.Name == randomFileName));
            }
            finally {
                Pri.LongPath.Directory.Delete(tempLongPathFilename);
            }
        }
コード例 #3
0
        public void TestGetDirectories()
        {
            var randomFileName       = Path.GetRandomFileName();
            var tempLongPathFilename = longPathDirectory.Combine(randomFileName);

            tempLongPathFilename.CreateDirectory();

            try {
                var di   = new DirectoryInfo(longPathDirectory);
                var dirs = di.GetDirectories();
                Assert.AreEqual(1, dirs.Count());
                Assert.IsTrue(dirs.Any(f => f.Name == randomFileName));
            }
            finally {
                Directory.Delete(tempLongPathFilename);
            }
        }
コード例 #4
0
        public void TestRecursiveGetDirectoriesWithSearch()
        {
            var randomFileName       = Path.GetRandomFileName();
            var tempLongPathFilename = longPathDirectory.Combine(randomFileName);

            tempLongPathFilename.CreateDirectory();

            try {
                var di   = new DirectoryInfo(longPathDirectory);
                var dirs = di.GetDirectories("*", SearchOption.AllDirectories).ToArray();
                Assert.AreEqual(1, dirs.Length);
                Assert.IsTrue(dirs.Any(f => f.Name == randomFileName));
            }
            finally {
                Directory.Delete(tempLongPathFilename);
            }
        }
コード例 #5
0
        public void TestGetDirectoriesWithMultipleResultSubsetSearch()
        {
            const String randomFileName        = "TestGetDirectoriesWithMultipleResultSubsetSearch";
            const String randomFileName2       = "ATestGetDirectoriesWithMultipleResultSubsetSearch";
            var          tempLongPathFilename  = longPathDirectory.Combine(randomFileName);
            var          tempLongPathFilename2 = longPathDirectory.Combine(randomFileName2);

            tempLongPathFilename.CreateDirectory();
            tempLongPathFilename2.CreateDirectory();

            try {
                var di   = new DirectoryInfo(longPathDirectory);
                var dirs = di.GetDirectories("A*").ToArray();
                Assert.AreEqual(1, dirs.Length);
                Assert.IsTrue(dirs.Any(f => f.Name == randomFileName2));
                Assert.IsFalse(dirs.Any(f => f.Name == randomFileName));
            }
            finally {
                Directory.Delete(tempLongPathFilename);
                Directory.Delete(tempLongPathFilename2);
            }
        }