Permalink
Browse files

Merge pull request #61 from KallDrexx/MockFileSystemDirectoryCreation

Added code and test to create the mocked directory when called MockFileS...
  • Loading branch information...
tathamoddie committed Mar 2, 2014
2 parents 9ac8f5b + 0bc2853 commit f8c7cb4d682de8078b6d094e964de58d9619c7e1
Showing with 15 additions and 0 deletions.
  1. +14 −0 TestHelpers.Tests/MockFileSystemTests.cs
  2. +1 −0 TestingHelpers/MockFileSystem.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));
+ }
}
}
@@ -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);
}
}

0 comments on commit f8c7cb4

Please sign in to comment.