nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #00660
[Bug 574408] Re: DirectoryAssert fails to recognise the sub folder using IsWithin
This odd behavior is caused by the fact that GetTempPath() returns a string with a trailing \
while the list of directories to which the comparison is made do not have such a slash.
This will be fixed but DirectoryAssert is likely to be deprecated in favor of the PathConstraints
in the next release.
--
DirectoryAssert fails to recognise the sub folder using IsWithin
https://bugs.launchpad.net/bugs/574408
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
Status in NUnit V2 Test Framework: New
Bug description:
Fails to recognize the second path was the direct sub directory.
var tempPath = Path.GetTempPath();
var tempPathParent = Path.GetDirectoryName(Path.GetDirectoryName(tempPath));
DirectoryAssert.AreEqual(new DirectoryInfo(tempPath), new DirectoryInfo(tempPath));
Assert.That(tempPath, Is.SamePathOrUnder(tempPathParent));
// bugs??
DirectoryAssert.IsWithin(tempPathParent, tempPath); // failed the tests
References