Пример #1
0
        public void TestEnumerateDirectoriesWithSearch()
        {
            var randomFileName       = Pri.LongPath.Path.GetRandomFileName();
            var tempLongPathFilename = longPathDirectory.Combine(randomFileName);

            tempLongPathFilename.CreateDirectory();

            try {
                var dirs = Directory.EnumerateDirectories(longPathDirectory, "*").ToArray();
                Assert.AreEqual(1, dirs.Length);
                Assert.IsTrue(dirs.Contains(tempLongPathFilename));
            }
            finally {
                Directory.Delete(tempLongPathFilename);
            }
        }
Пример #2
0
        public void TestRecursiveEnumerateDirectoriesWithSearchNoResults()
        {
            var randomFileName       = Pri.LongPath.Path.GetRandomFileName();
            var tempLongPathFilename = longPathDirectory.Combine(randomFileName);

            tempLongPathFilename.CreateDirectory();

            try {
                var dirs = Directory.EnumerateDirectories(longPathDirectory, "gibberish", SearchOption.AllDirectories).ToArray();
                Assert.AreEqual(0, dirs.Length);
                Assert.IsFalse(dirs.Contains(tempLongPathFilename));
            }
            finally {
                Directory.Delete(tempLongPathFilename);
            }
        }
Пример #3
0
        public void TestRecursiveEnumerateDirectoriesWithSingleSubsetSearch()
        {
            const String randomFileName       = "TestRecursiveEnumerateDirectoriesWithSubsetSearch";
            var          tempLongPathFilename = longPathDirectory.Combine(randomFileName);

            tempLongPathFilename.CreateDirectory();

            try {
                var dirs = Directory.EnumerateDirectories(longPathDirectory, "T*", SearchOption.AllDirectories).ToArray();
                Assert.AreEqual(1, dirs.Length);
                Assert.IsTrue(dirs.Contains(tempLongPathFilename));
            }
            finally {
                Directory.Delete(tempLongPathFilename);
            }
        }