diff --git a/Octokit.Tests/Clients/StatisticsClientTests.cs b/Octokit.Tests/Clients/StatisticsClientTests.cs index 26a380c0..804b60fb 100644 --- a/Octokit.Tests/Clients/StatisticsClientTests.cs +++ b/Octokit.Tests/Clients/StatisticsClientTests.cs @@ -81,5 +81,37 @@ namespace Octokit.Tests.Clients await AssertEx.Throws(() => statisticsClient.GetCommitActivityForTheLastYear("owner", null)); } } + + public class TheGetAdditionsAndDeletionsPerWeekMethod + { + [Fact] + public void RequestsCorrectUrl() + { + var expectedEndPoint = new Uri("/repos/username/repositoryName/stats/code_frequency", UriKind.Relative); + + var connection = Substitute.For(); + var client = Substitute.For(); + client.Connection.Returns(connection); + var statisticsClient = new StatisticsClient(client); + + statisticsClient.GetAdditionsAndDeletionsPerWeek("username", "repositoryName"); + + connection.Received().GetAsync>(expectedEndPoint); + } + + [Fact] + public async Task ThrowsIfGivenNullOwner() + { + var statisticsClient = new StatisticsClient(Substitute.For()); + await AssertEx.Throws(() => statisticsClient.GetAdditionsAndDeletionsPerWeek(null, "repositoryName")); + } + + [Fact] + public async Task ThrowsIfGivenNullRepositoryName() + { + var statisticsClient = new StatisticsClient(Substitute.For()); + await AssertEx.Throws(() => statisticsClient.GetAdditionsAndDeletionsPerWeek("owner", null)); + } + } } } \ No newline at end of file