#418 Add repo parameters for code search

This commit is contained in:
Kori Francis
2015-02-17 14:39:10 -05:00
parent 9d57bca27a
commit 4a8877cc43
2 changed files with 21 additions and 0 deletions
@@ -1441,6 +1441,21 @@ namespace Octokit.Tests.Clients
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+repo:octokit.net"));
}
[Fact]
public void TestingTheRepoQualifier_InConstructor()
{
var connection = Substitute.For<IApiConnection>();
var client = new SearchClient(connection);
var request = new SearchCodeRequest("something", "octokit.net");
client.SearchCode(request);
connection.Received().Get<SearchCodeResult>(
Arg.Is<Uri>(u => u.ToString() == "search/code"),
Arg.Is<Dictionary<string, string>>(d =>
d["q"] == "something+repo:octokit.net"));
}
[Fact]
public void TestingTheRepoAndPathAndExtensionQualifiers()
{
@@ -18,6 +18,12 @@ namespace Octokit
{
public SearchCodeRequest(string term) : base(term) { }
public SearchCodeRequest(string term, string repo)
: this(term)
{
this.Repo = repo;
}
/// <summary>
/// Optional Sort field. Can only be indexed, which indicates how recently
/// a file has been indexed by the GitHub search infrastructure.