Skip to content

Commit

Permalink
Merge pull request #61 from KallDrexx/MockFileSystemDirectoryCreation
Browse files Browse the repository at this point in the history
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 f8c7cb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions TestHelpers.Tests/MockFileSystemTests.cs
Expand Up @@ -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));
}
}
}
1 change: 1 addition & 0 deletions TestingHelpers/MockFileSystem.cs
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit f8c7cb4

Please sign in to comment.