Basic unit tests for hourly commits

This commit is contained in:
Amy Palamountain
2014-02-02 14:29:00 +13:00
parent c209e2a3d0
commit 3580c13623

View File

@@ -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));
}
}
}
}