Exemple #1
0
        public void TestEnumerateFilesWithSearchWithNoResults()
        {
            var files = Directory.EnumerateFiles(longPathDirectory, "giberish").ToArray();

            Assert.AreEqual(0, files.Length);
            Assert.IsFalse(files.Contains(longPathFilename));
        }
Exemple #2
0
        public void TestEnumerateFilesWithSearch()
        {
            var files = Directory.EnumerateFiles(longPathDirectory, "*").ToArray();

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

            tempLongPathFilename.CreateDirectory();

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

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