-
-
Notifications
You must be signed in to change notification settings - Fork 939
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests for SetLastAccessTime(Utc) to also verify the time compo…
…nent and the Kind of the DateTime value returned by GetLastAccessTime(Utc). (#1198)
- Loading branch information
Showing
4 changed files
with
49 additions
and
22 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/Renci.SshNet.IntegrationTests/Common/DateTimeAssert.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,11 @@ | ||
namespace Renci.SshNet.IntegrationTests.Common | ||
{ | ||
public static class DateTimeAssert | ||
{ | ||
public static void AreEqual(DateTime expected, DateTime actual) | ||
{ | ||
Assert.AreEqual(expected, actual, $"Expected {expected:o}, but was {actual:o}."); | ||
Assert.AreEqual(expected.Kind, actual.Kind); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Renci.SshNet.IntegrationTests/Common/DateTimeExtensions.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,12 @@ | ||
namespace Renci.SshNet.IntegrationTests.Common | ||
{ | ||
public static class DateTimeExtensions | ||
{ | ||
public static DateTime TruncateToWholeSeconds(this DateTime dateTime) | ||
{ | ||
return dateTime.AddMilliseconds(-dateTime.Millisecond) | ||
.AddMicroseconds(-dateTime.Microsecond) | ||
.AddTicks(-(dateTime.Nanosecond / 100)); | ||
} | ||
} | ||
} |
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