You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
regards efef77
The text was updated successfully, but these errors were encountered:
efef77
changed the title
Some NUnit Tests failed due to current drive of installation
Some NUnit Tests failed due to current drive of installation - proposed solution enclosed
Jun 17, 2017
Regarding Pri.LongPath AssemblyVersion 2.0.1.0
Failed unit tests running the tests on D: drive instead of C: drive
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
may some one update the test cases?
thx for great work on library
regards efef77
The text was updated successfully, but these errors were encountered: