diff --git a/System.IO.Abstractions.TestingHelpers.Tests/FileInfoBaseConversionTests.cs b/System.IO.Abstractions.TestingHelpers.Tests/FileInfoBaseConversionTests.cs
new file mode 100644
index 000000000..bf3a9fdc5
--- /dev/null
+++ b/System.IO.Abstractions.TestingHelpers.Tests/FileInfoBaseConversionTests.cs
@@ -0,0 +1,26 @@
+namespace System.IO.Abstractions.TestingHelpers.Tests
+{
+ using NUnit.Framework;
+
+ ///
+ /// Unit tests for the conversion operators of the class.
+ ///
+ public class FileInfoBaseConversionTests
+ {
+ ///
+ /// Tests that a null is correctly converted to a null without exception.
+ ///
+ [Test]
+ public void FileInfoBase_FromFileInfo_ShouldReturnNullIfFileInfoIsNull()
+ {
+ // Arrange
+ FileInfo fileInfo = null;
+
+ // Act
+ FileInfoBase actual = fileInfo;
+
+ // Assert
+ Assert.IsNull(actual);
+ }
+ }
+}
diff --git a/System.IO.Abstractions/FileInfoBase.cs b/System.IO.Abstractions/FileInfoBase.cs
index 6dfea9c41..bc5fb2742 100644
--- a/System.IO.Abstractions/FileInfoBase.cs
+++ b/System.IO.Abstractions/FileInfoBase.cs
@@ -81,7 +81,12 @@ public abstract class FileInfoBase : FileSystemInfoBase
public static implicit operator FileInfoBase(FileInfo fileInfo)
{
+ if (fileInfo == null)
+ {
+ return null;
+ }
+
return new FileInfoWrapper(fileInfo);
}
}
-}
\ No newline at end of file
+}