-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: null-handling in Wrap-Method in factories for
IDirectoryInfo
o…
…r `IFileInfo` (#976) Fixes #975: When providing `null` as parameter to the implementations of `IFileInfoFactory` or `IDirectoryInfoFactory` return `null` instead of throwing an exception.
- Loading branch information
Showing
8 changed files
with
86 additions
and
2 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
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
18 changes: 18 additions & 0 deletions
18
...s/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryInfoFactoryTests.cs
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,18 @@ | ||
using NUnit.Framework; | ||
|
||
namespace System.IO.Abstractions.TestingHelpers.Tests | ||
{ | ||
[TestFixture] | ||
public class MockDirectoryInfoFactoryTests | ||
{ | ||
[Test] | ||
public void MockDirectoryInfoFactory_Wrap_WithNull_ShouldReturnNull() | ||
{ | ||
var fileSystem = new MockFileSystem(); | ||
|
||
var result = fileSystem.DirectoryInfo.Wrap(null); | ||
|
||
Assert.IsNull(result); | ||
} | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoFactoryTests.cs
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,18 @@ | ||
using NUnit.Framework; | ||
|
||
namespace System.IO.Abstractions.Tests | ||
{ | ||
[TestFixture] | ||
public class DirectoryInfoFactoryTests | ||
{ | ||
[Test] | ||
public void Wrap_WithNull_ShouldReturnNull() | ||
{ | ||
var fileSystem = new FileSystem(); | ||
|
||
var result = fileSystem.DirectoryInfo.Wrap(null); | ||
|
||
Assert.IsNull(result); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoFactoryTests.cs
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,18 @@ | ||
using NUnit.Framework; | ||
|
||
namespace System.IO.Abstractions.Tests | ||
{ | ||
[TestFixture] | ||
public class FileInfoFactoryTests | ||
{ | ||
[Test] | ||
public void Wrap_WithNull_ShouldReturnNull() | ||
{ | ||
var fileSystem = new FileSystem(); | ||
|
||
var result = fileSystem.FileInfo.Wrap(null); | ||
|
||
Assert.IsNull(result); | ||
} | ||
} | ||
} |