Adds TreeClient.GetRecursive method.

Initially I implemented this as an optional parameter that would append "?recursive=1" to the end of the URI if an optional recursive boolean was supplied to the TreeClient.Get method.  Unfortunately, code analysis complained about that so I went with a set of new overloads instead.

Let me know if a different approach is preferred for adding optional query string parameters to API methods or if this is the preferred solution.  The problem with this solution is that it doesn't scale out well with multiple optional parameters.
This commit is contained in:
Micah
2015-01-10 17:31:43 -08:00
parent e15ad91165
commit b141703dbd
7 changed files with 129 additions and 0 deletions
@@ -37,6 +37,33 @@ namespace Octokit.Tests
}
}
public class TheGetRecursiveMethod
{
[Fact]
public void GetsFromClientIssueIssue()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableTreesClient(gitHubClient);
client.GetRecursive("fake", "repo", "123456ABCD");
gitHubClient.GitDatabase.Tree.Received().GetRecursive("fake", "repo", "123456ABCD");
}
[Fact]
public async Task EnsuresNonNullArguments()
{
var client = new ObservableTreesClient(Substitute.For<IGitHubClient>());
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetRecursive(null, "name", "123456ABCD"));
await AssertEx.Throws<ArgumentException>(async () => await client.GetRecursive("", "name", "123456ABCD"));
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetRecursive("owner", null, "123456ABCD"));
await AssertEx.Throws<ArgumentException>(async () => await client.GetRecursive("owner", "", "123456ABCD"));
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetRecursive("owner", "name", null));
await AssertEx.Throws<ArgumentException>(async () => await client.GetRecursive("owner", "name", ""));
}
}
public class TheCreateMethod
{
[Fact]