public void TestEnumerateDirectoriesWithSearchRecursiveNoResults() { var tempLongPathFilename = longPathDirectory.Combine(Path.GetRandomFileName()); tempLongPathFilename.CreateDirectory(); try { var di = new DirectoryInfo(longPathDirectory); Assert.AreEqual(0, di.EnumerateDirectories("gibberish*", SearchOption.AllDirectories).Count()); } finally { Directory.Delete(tempLongPathFilename); } }
public void TestEnumerateDirectoriesWithWildcardSearchAndOptionNoResults() { var tempLongPathFilename = uncDirectory.Combine(Path.GetRandomFileName()); tempLongPathFilename.CreateDirectory(); try { var di = new DirectoryInfo(uncDirectory); Assert.AreEqual(0, di.EnumerateDirectories("gibberish*", SearchOption.TopDirectoryOnly).Count()); } finally { Pri.LongPath.Directory.Delete(tempLongPathFilename); } }
public void TestEnumerateDirectoriesWithSearchWithNoResults() { var randomFileName = Path.GetRandomFileName(); var tempLongPathFilename = uncDirectory.Combine(randomFileName); tempLongPathFilename.CreateDirectory(); try { var di = new DirectoryInfo(uncDirectory); var dirs = di.EnumerateDirectories("gibberish").ToArray(); Assert.AreEqual(0, dirs.Length); } finally { Pri.LongPath.Directory.Delete(tempLongPathFilename); } }
public void TestRecursiveEnumerateDirectoriesWithSearchNoResults() { var randomFileName = Path.GetRandomFileName(); var tempLongPathFilename = longPathDirectory.Combine(randomFileName); tempLongPathFilename.CreateDirectory(); try { var di = new DirectoryInfo(longPathDirectory); var dirs = di.EnumerateDirectories("gibberish", SearchOption.AllDirectories).ToArray(); Assert.AreEqual(0, dirs.Length); } finally { Directory.Delete(tempLongPathFilename); } }
public void TestEnumerateDirectoriesWithSearchRecursive() { var randomFileName = Path.GetRandomFileName(); var tempLongPathFilename = uncDirectory.Combine(randomFileName); tempLongPathFilename.CreateDirectory(); try { var di = new DirectoryInfo(uncDirectory); var dirs = di.EnumerateDirectories("*", SearchOption.AllDirectories).ToArray(); Assert.AreEqual(1, dirs.Length); Assert.IsTrue(dirs.Any(f => f.Name == randomFileName)); } finally { Pri.LongPath.Directory.Delete(tempLongPathFilename); } }
public void TestEnumerateDirectories() { var randomFileName = Path.GetRandomFileName(); var tempLongPathFilename = longPathDirectory.Combine(randomFileName); tempLongPathFilename.CreateDirectory(); try { var di = new DirectoryInfo(longPathDirectory); var dirs = di.EnumerateDirectories().ToArray(); Assert.AreEqual(1, dirs.Length); Assert.IsTrue(dirs.Any(f => f.Name == randomFileName)); } finally { Directory.Delete(tempLongPathFilename); } }
public void TestMoveTo() { var randomFileName = Path.GetRandomFileName(); var randomFileName2 = Path.GetRandomFileName(); var tempLongPathFilename = uncDirectory.Combine(randomFileName); var tempLongPathFilename2 = uncDirectory.Combine(randomFileName2); tempLongPathFilename.CreateDirectory(); try { var di = new DirectoryInfo(tempLongPathFilename); di.MoveTo(tempLongPathFilename2); di = new DirectoryInfo(uncDirectory); var dirs = di.EnumerateDirectories("*", SearchOption.TopDirectoryOnly).ToArray(); Assert.AreEqual(1, dirs.Length); Assert.IsTrue(dirs.Any(f => f.Name == randomFileName2)); Assert.IsFalse(dirs.Any(f => f.Name == randomFileName)); } finally { Pri.LongPath.Directory.Delete(tempLongPathFilename2); } Assert.IsFalse(tempLongPathFilename.Exists()); }