diff --git a/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockPath.cs b/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockPath.cs index b7d7f4edc..1ed5c01ab 100644 --- a/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockPath.cs +++ b/src/TestableIO.System.IO.Abstractions.TestingHelpers/MockPath.cs @@ -39,7 +39,7 @@ public override string GetFullPath(string path) throw new ArgumentNullException(nameof(path), StringResources.Manager.GetString("VALUE_CANNOT_BE_NULL")); } - if (path.Length == 0) + if (string.IsNullOrWhiteSpace(path)) { throw CommonExceptions.PathIsNotOfALegalForm(nameof(path)); } diff --git a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockPathTests.cs b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockPathTests.cs index df3bb3da4..69e8b80bb 100644 --- a/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockPathTests.cs +++ b/tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockPathTests.cs @@ -266,6 +266,16 @@ public void GetFullPath_EmptyValue_ShouldThrowArgumentException() Assert.Throws(action); } + [Test] + public void GetFullPath_WithWhiteSpace_ShouldThrowArgumentException() + { + var mockFileSystem = new MockFileSystem(); + + TestDelegate action = () => mockFileSystem.Path.GetFullPath(" "); + + Assert.Throws(action); + } + [Test] public void GetFullPath_WithMultipleDirectorySeparators_ShouldReturnTheNormalizedForm() {