mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Basic unit tests for hourly commits
This commit is contained in:
@@ -145,5 +145,37 @@ namespace Octokit.Tests.Clients
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetCommitCountsPerWeek("owner", null));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetHourlyCommitCountsMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var expectedEndPoint = new Uri("/repos/username/repositoryName/stats/punch_card", UriKind.Relative);
|
||||
|
||||
var connection = Substitute.For<IConnection>();
|
||||
var client = Substitute.For<IApiConnection>();
|
||||
client.Connection.Returns(connection);
|
||||
var statisticsClient = new StatisticsClient(client);
|
||||
|
||||
statisticsClient.GetCommitPerHour("username", "repositoryName");
|
||||
|
||||
connection.Received().GetAsync<IEnumerable<int[]>>(expectedEndPoint);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsIfGivenNullOwner()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetCommitPerHour(null, "repositoryName"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsIfGivenNullRepositoryName()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetCommitPerHour("owner", null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user