Exemple #1
0
        public void TestGetFileSystemInfosWithSearchAndOptionMultipleResults()
        {
            var di             = new DirectoryInfo(uncDirectory);
            var randomFileName = Path.GetRandomFileName();
            var newDi          = di.CreateSubdirectory(randomFileName);

            try {
                var fi = new FileInfo(newDi.FullName.Combine("filename"));

                using (fi.Create()) { }

                try {
                    Assert.AreEqual(2, di.GetFileSystemInfos("*", SearchOption.TopDirectoryOnly).Count());
                }
                finally {
                    fi.Delete();
                }
            }
            finally {
                newDi.Delete(true);
            }
        }
Exemple #2
0
        public void TestGetFileSystemInfosWithSearchRecursiveNoResults()
        {
            var di             = new DirectoryInfo(uncDirectory);
            var randomFileName = Path.GetRandomFileName();
            var newDi          = di.CreateSubdirectory(randomFileName);

            try {
                var fi = new FileInfo(newDi.FullName.Combine("filename"));

                using (fi.Create()) { }

                try {
                    Assert.AreEqual(0, di.GetFileSystemInfos("gibberish", SearchOption.AllDirectories).Count());
                }
                finally {
                    fi.Delete();
                }
            }
            finally {
                newDi.Delete(true);
            }
        }
Exemple #3
0
        public void TestGetFileSystemInfosWithSearch()
        {
            var di             = new DirectoryInfo(longPathDirectory);
            var randomFileName = Path.GetRandomFileName();
            var newDi          = di.CreateSubdirectory(randomFileName);

            try {
                var fi = new FileInfo(newDi.FullName.Combine("filename"));

                using (fi.Create()) { }

                try {
                    Assert.AreEqual(2, di.GetFileSystemInfos("*").Count());
                }
                finally {
                    fi.Delete();
                }
            }
            finally {
                newDi.Delete(true);
            }
        }