Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added code and test to create the mocked directory when called MockFi…

…leSystem.AddDirectory()
  • Loading branch information...
commit 0bc285352bb02ed46020b0d18627cb080c40f82d 1 parent 7aed17b
@KallDrexx KallDrexx authored
View
14 TestHelpers.Tests/MockFileSystemTests.cs
@@ -92,5 +92,19 @@ public void Is_Serializable()
Assert.That(memoryStream.Length > 0, "Length didnt 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
@@ -96,6 +96,7 @@ public void AddDirectory(string path)
throw new UnauthorizedAccessException(string.Format("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.