-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #862 from octokit/haacked/836-handle-empty-content
Handle empty content better
- Loading branch information
Showing
14 changed files
with
196 additions
and
86 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,46 @@ | ||
using System; | ||
using Octokit.Helpers; | ||
using Xunit; | ||
|
||
public class UnixTimestampExtensionsTests | ||
{ | ||
public class TheToUnixTimeMethod | ||
{ | ||
[Fact] | ||
public void ReturnsUnixEpochCorrectly() | ||
{ | ||
var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); | ||
Assert.Equal(0, epoch.ToUnixTime()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsRandomDateCorrectly() | ||
{ | ||
var epoch = new DateTimeOffset(1975, 1, 23, 1, 1, 1, TimeSpan.Zero); | ||
Assert.Equal(159670861, epoch.ToUnixTime()); | ||
} | ||
} | ||
|
||
public class TheFromUnixTimeMethod | ||
{ | ||
[Fact] | ||
public void ReturnsDateFromUnixEpochCorrectly() | ||
{ | ||
var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); | ||
|
||
var result = ((long)0).FromUnixTime(); | ||
|
||
Assert.Equal(epoch, result); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsDateFromRandomTimeCorrectly() | ||
{ | ||
var expected = new DateTimeOffset(1975, 1, 23, 1, 1, 2, TimeSpan.Zero); | ||
|
||
var result = ((long)159670862).FromUnixTime(); | ||
|
||
Assert.Equal(expected, result); | ||
} | ||
} | ||
} |
Oops, something went wrong.