Failed unit tests running the tests on D: drive instead of C: drive
UncDirectoryTests.TestGetDirectoryRoot()
UncDirectoryTests.TestGetPathRoot()
DirectoryInfoTests.TestMoveToDifferentRoot()
These test where depending on a certain drive (C:)
I did some work on it:
So I recommend fixed test cases as follows.
They will run on any drive
-------------------------------
public class UncDirectoryTests
-------------------------------
[Test]
public void TestGetDirectoryRoot()
{
string plain = Directory.GetDirectoryRoot(directory);
string unc = Directory.GetDirectoryRoot(uncDirectory);
string must = @"\\localhost\X$\".Replace('X', plain[0]); // use current drive letter
Assert.IsTrue(must.Equals(unc, StringComparison.InvariantCultureIgnoreCase));
}
[Test]
public void TestGetPathRoot()
{
var root = Path.GetPathRoot(uncDirectory);
Assert.IsNotNull(root);
Assert.AreEqual(15, root.Length);
var plain = Path.GetPathRoot(directory);
string must = @"\\localhost\X$\".Replace('X', plain[0]); // use current drive letter
Assert.IsTrue(must.Equals(root, StringComparison.InvariantCultureIgnoreCase));
}
-------------------------------
public class DirectoryInfoTests
-------------------------------
[Test]
public void TestMoveToDifferentRoot()
{
var randomFileName = Path.GetRandomFileName();
var tempLongPathDirectory = Path.Combine(longPathDirectory, randomFileName);
var di = new DirectoryInfo(tempLongPathDirectory);
// get other drive letter
char letter = longPathDirectory[0];
if (letter < 'A' || letter >= 'Z') throw new Exception("invalid letter " + letter);
letter = (char)(letter + 1); // next other drive
string target = @"" + letter + @":\";
Assert.Throws<IOException>(() => di.MoveTo(target)); // move to other drive
}
may some one update the test cases?
thx for great work on library
Regarding Pri.LongPath AssemblyVersion 2.0.1.0
Failed unit tests running the tests on D: drive instead of C: drive
I did some work on it: So I recommend fixed test cases as follows. They will run on any drive
may some one update the test cases? thx for great work on library
regards efef77