-
-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
I've come across unexpected behaviour of the filesystem initializer. When creating directories with absolute paths, their children end up in unexpected places.
Example (using NUnit):
using NUnit.Framework;
using Testably.Abstractions.Testing;
using Testably.Abstractions.Testing.Initializer;
namespace TestablyAbstractionsTest
{
[TestFixture]
public class AbstractionsTest
{
private const string DirectoryPath = @"C:\foo\bar";
[Test]
public void TestInitialization()
{
var fileSystem = new MockFileSystem();
fileSystem.Initialize().With(
new DirectoryDescription(DirectoryPath,
new FileDescription("baz.txt", "Hello, world!")
)
);
Assert.False(fileSystem.Directory.Exists(@"C:\bar"), @"The directory `C:\bar` should not even exist.");
Assert.False(fileSystem.File.Exists(@"C:\bar\baz.txt"), @"The file should not be in `C:\bar`.");
Assert.That(fileSystem.File.Exists(@"C:\foo\bar\baz.txt"), @"The file is not at the expected location.");
Assert.AreEqual("Hello, world!", fileSystem.File.ReadAllText(@"C:\foo\bar\baz.txt"));
}
}
}All assertions in this test case fail. The file baz.txt is created at C:\bar\baz.txt instead of C:\foo\bar\baz.txt.
None of the documentation uses absolute paths, so I can't say with absolute certainty that this is a bug. At the very least, it's very unexpected behaviour. Did I miss something?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers