forked from TestableIO/System.IO.Abstractions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed exception type in case of invalid characters in path
- Loading branch information
Showing
10 changed files
with
104 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Collections.Generic; | ||
using System.Security.AccessControl; | ||
using NUnit.Framework; | ||
|
||
namespace System.IO.Abstractions.TestingHelpers.Tests | ||
{ | ||
public class MockDirectoryArgumentPathTests | ||
{ | ||
private static IEnumerable<Action<DirectoryBase>> GetFileSystemActionsForArgumentNullException() | ||
{ | ||
yield return ds => ds.Delete(null); | ||
yield return ds => ds.Delete(null, true); | ||
yield return ds => ds.CreateDirectory(null); | ||
yield return ds => ds.CreateDirectory(null, new DirectorySecurity()); | ||
yield return ds => ds.SetCreationTime(null, DateTime.Now); | ||
yield return ds => ds.SetCreationTimeUtc(null, DateTime.Now); | ||
yield return ds => ds.SetLastAccessTime(null, DateTime.Now); | ||
yield return ds => ds.SetLastAccessTimeUtc(null, DateTime.Now); | ||
yield return ds => ds.SetLastWriteTime(null, DateTime.Now); | ||
yield return ds => ds.SetLastWriteTimeUtc(null, DateTime.Now); | ||
yield return ds => ds.EnumerateDirectories(null); | ||
yield return ds => ds.EnumerateDirectories(null, "foo"); | ||
yield return ds => ds.EnumerateDirectories(null, "foo", SearchOption.AllDirectories); | ||
} | ||
|
||
[TestCaseSource("GetFileSystemActionsForArgumentNullException")] | ||
public void Operations_ShouldThrowArgumentNullExceptionIfPathIsNull(Action<DirectoryBase> action) | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
TestDelegate wrapped = () => action(fileSystem.Directory); | ||
|
||
// Assert | ||
var exception = Assert.Throws<ArgumentNullException>(wrapped); | ||
Assert.AreEqual("path", exception.ParamName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters