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.
adapted tests for correctness added tests
- Loading branch information
Showing
20 changed files
with
687 additions
and
115 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
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,50 @@ | ||
using NUnit.Framework; | ||
|
||
namespace System.IO.Abstractions.TestingHelpers.Tests | ||
{ | ||
[TestFixture] | ||
public class MockFileGetCreationTimeTests | ||
{ | ||
[Test] | ||
public void MockFile_GetCreationTime_ShouldThrowArgumentNullExceptionIfPathIsNull() | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
TestDelegate action = () => fileSystem.File.GetCreationTime(null); | ||
|
||
// Assert | ||
var exception = Assert.Throws<ArgumentNullException>(action); | ||
Assert.That(exception.ParamName, Is.EqualTo("path")); | ||
} | ||
|
||
[TestCase(" ")] | ||
[TestCase(" ")] | ||
public void MockFile_GetCreationTime_ShouldThrowArgumentExceptionIfPathContainsOnlyWhitespaces(string path) | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
TestDelegate action = () => fileSystem.File.GetCreationTime(path); | ||
|
||
// Assert | ||
var exception = Assert.Throws<ArgumentException>(action); | ||
Assert.That(exception.ParamName, Is.EqualTo("path")); | ||
} | ||
|
||
[Test] | ||
public void MockFile_GetCreationTime_ShouldReturnDefaultTimeIfFileDoesNotExist() | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
var actualCreationTime = fileSystem.File.GetCreationTime(@"c:\does\not\exist.txt"); | ||
|
||
// Assert | ||
Assert.AreEqual(new DateTime(1601, 01, 01, 01, 00, 00, DateTimeKind.Utc), actualCreationTime); | ||
} | ||
} | ||
} |
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,50 @@ | ||
using NUnit.Framework; | ||
|
||
namespace System.IO.Abstractions.TestingHelpers.Tests | ||
{ | ||
[TestFixture] | ||
public class MockFileGetCreationTimeUtcTests | ||
{ | ||
[Test] | ||
public void MockFile_GetCreationTimeUtc_ShouldThrowArgumentNullExceptionIfPathIsNull() | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
TestDelegate action = () => fileSystem.File.GetCreationTimeUtc(null); | ||
|
||
// Assert | ||
var exception = Assert.Throws<ArgumentNullException>(action); | ||
Assert.That(exception.ParamName, Is.EqualTo("path")); | ||
} | ||
|
||
[TestCase(" ")] | ||
[TestCase(" ")] | ||
public void MockFile_GetCreationTimeUtc_ShouldThrowArgumentExceptionIfPathContainsOnlyWhitespaces(string path) | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
TestDelegate action = () => fileSystem.File.GetCreationTimeUtc(path); | ||
|
||
// Assert | ||
var exception = Assert.Throws<ArgumentException>(action); | ||
Assert.That(exception.ParamName, Is.EqualTo("path")); | ||
} | ||
|
||
[Test] | ||
public void MockFile_GetCreationTimeUtc_ShouldReturnDefaultTimeIfFileDoesNotExist() | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
var actualCreationTime = fileSystem.File.GetCreationTimeUtc(@"c:\does\not\exist.txt"); | ||
|
||
// Assert | ||
Assert.AreEqual(new DateTime(1601, 01, 01, 00, 00, 00, DateTimeKind.Utc), actualCreationTime); | ||
} | ||
} | ||
} |
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,50 @@ | ||
using NUnit.Framework; | ||
|
||
namespace System.IO.Abstractions.TestingHelpers.Tests | ||
{ | ||
[TestFixture] | ||
public class MockFileGetLastAccessTimeTests | ||
{ | ||
[Test] | ||
public void MockFile_GetLastAccessTime_ShouldThrowArgumentNullExceptionIfPathIsNull() | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
TestDelegate action = () => fileSystem.File.GetLastAccessTime(null); | ||
|
||
// Assert | ||
var exception = Assert.Throws<ArgumentNullException>(action); | ||
Assert.That(exception.ParamName, Is.EqualTo("path")); | ||
} | ||
|
||
[TestCase(" ")] | ||
[TestCase(" ")] | ||
public void MockFile_GetLastAccessTime_ShouldThrowArgumentExceptionIfPathContainsOnlyWhitespaces(string path) | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
TestDelegate action = () => fileSystem.File.GetLastAccessTime(path); | ||
|
||
// Assert | ||
var exception = Assert.Throws<ArgumentException>(action); | ||
Assert.That(exception.ParamName, Is.EqualTo("path")); | ||
} | ||
|
||
[Test] | ||
public void MockFile_GetLastAccessTime_ShouldReturnDefaultTimeIfFileDoesNotExist() | ||
{ | ||
// Arrange | ||
var fileSystem = new MockFileSystem(); | ||
|
||
// Act | ||
var actualLastAccessTime = fileSystem.File.GetLastAccessTime(@"c:\does\not\exist.txt"); | ||
|
||
// Assert | ||
Assert.AreEqual(new DateTime(1601, 01, 01, 01, 00, 00, DateTimeKind.Utc), actualLastAccessTime); | ||
} | ||
} | ||
} |
Oops, something went wrong.