예제 #1
0
        public void TestEnumerateFileSystemEntriesWithSearchWithNoResults()
        {
            var entries = Directory.EnumerateFileSystemEntries(longPathDirectory, "giberish").ToArray();

            Assert.AreEqual(0, entries.Length);
            Assert.IsFalse(entries.Contains(longPathFilename));
        }
예제 #2
0
        public void TestEnumerateFileSystemEntriesWithSearch()
        {
            var entries = Directory.EnumerateFileSystemEntries(longPathDirectory, "*").ToArray();

            Assert.AreEqual(1, entries.Length);
            Assert.IsTrue(entries.Contains(longPathFilename));
        }
예제 #3
0
        public void TestEnumerateRecursiveFileSystemEntriesWithSearch()
        {
            var tempLongPathFilename = longPathDirectory.Combine(Pri.LongPath.Path.GetRandomFileName());

            tempLongPathFilename.CreateDirectory();

            try {
                Assert.IsTrue(tempLongPathFilename.Exists());
                var randomFileName = Util.CreateNewEmptyFile(tempLongPathFilename);

                var entries = Directory.EnumerateFileSystemEntries(longPathDirectory, "*", SearchOption.AllDirectories).ToArray();
                Assert.AreEqual(3, entries.Length);
                Assert.IsTrue(entries.Contains(longPathFilename));
                Assert.IsTrue(entries.Contains(randomFileName));
            }
            finally {
                const Boolean recursive = true;
                Directory.Delete(tempLongPathFilename, recursive);
            }
        }