Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #61 from KallDrexx/MockFileSystemDirectoryCreation

Added code and test to create the mocked directory when called MockFileS...
  • Loading branch information...
commit f8c7cb4d682de8078b6d094e964de58d9619c7e1 2 parents 9ac8f5b + 0bc2853
@tathamoddie authored
View
14 TestHelpers.Tests/MockFileSystemTests.cs
@@ -92,5 +92,19 @@ public void Is_Serializable()
Assert.That(memoryStream.Length > 0, "Length didn't increase after serialization task.");
}
+
+ [Test]
+ public void MockFileSystem_AddDirectory_ShouldCreateDirectory()
+ {
+ // Arrange
+ const string baseDirectory = @"C:\Test";
+ var fileSystem = new MockFileSystem();
+
+ // Act
+ fileSystem.AddDirectory(baseDirectory);
+
+ // Assert
+ Assert.IsTrue(fileSystem.Directory.Exists(baseDirectory));
+ }
}
}
View
1  TestingHelpers/MockFileSystem.cs
@@ -97,6 +97,7 @@ public void AddDirectory(string path)
throw new UnauthorizedAccessException(string.Format(CultureInfo.InvariantCulture, "Access to the path '{0}' is denied.", path));
files[fixedPath] = new MockDirectoryData();
+ directory.CreateDirectory(fixedPath);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.