Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add unit tests for throwing DirectoryNotFoundExceptions.

  • Loading branch information...
commit 218b53bcfbd507193001d4fff04d0b34254200e8 1 parent 4400858
@kyle-fritz-zocdoc kyle-fritz-zocdoc authored committed
Showing with 29 additions and 0 deletions.
  1. +29 −0 TestHelpers.Tests/MockDirectoryTests.cs
View
29 TestHelpers.Tests/MockDirectoryTests.cs
@@ -558,6 +558,35 @@ public void MockDirectory_GetDirectories_Returns_Child_Directories()
}
[Test]
+ public void MockDirectory_GetDirectories_ShouldThrowWhenPathIsNotMocked()
+ {
+ // Arrange
+ var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
+ {
+ { @"c:\a.gif", new MockFileData("Demo text content") },
+ { @"c:\b.txt", new MockFileData("Demo text content") },
+ { @"c:\c.txt", new MockFileData("Demo text content") },
+ { @"c:\a\a.txt", new MockFileData("Demo text content") },
+ { @"c:\a\b.gif", new MockFileData("Demo text content") },
+ { @"c:\a\c.txt", new MockFileData("Demo text content") },
+ { @"c:\a\a\a.txt", new MockFileData("Demo text content") },
+ { @"c:\a\a\b.txt", new MockFileData("Demo text content") },
+ { @"c:\a\a\c.gif", new MockFileData("Demo text content") },
+ });
+
+ // Act
+ try
+ {
+ var result = fileSystem.Directory.GetDirectories(@"c:\d").ToArray();
+ // Assert
+ Assert.Fail();
+ }
+ catch (DirectoryNotFoundException)
+ {
+ }
+ }
+
+ [Test]
public void MockDirectory_Move_ShouldMove()
{
var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
Please sign in to comment.
Something went wrong with that request. Please try again.