mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
Add support for code searches without a search term (#1338)
This commit is contained in:
committed by
maddin2016
parent
bbcfae3050
commit
93f9ecb433
@@ -57,6 +57,20 @@ public class SearchClientTests
|
||||
Assert.NotEmpty(repos.Items);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task SearchForFileNameInCodeWithoutTerm()
|
||||
{
|
||||
var request = new SearchCodeRequest()
|
||||
{
|
||||
FileName = "readme.md",
|
||||
Repos = new RepositoryCollection { "octokit/octokit.net" }
|
||||
};
|
||||
|
||||
var repos = await _gitHubClient.Search.SearchCode(request);
|
||||
|
||||
Assert.NotEmpty(repos.Items);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task SearchForWordInCode()
|
||||
{
|
||||
|
||||
@@ -85,7 +85,14 @@ namespace Octokit
|
||||
get
|
||||
{
|
||||
var mergedParameters = string.Join("+", MergedQualifiers());
|
||||
return Term + (mergedParameters.IsNotBlank() ? "+" + mergedParameters : "");
|
||||
if (string.IsNullOrEmpty(Term))
|
||||
{
|
||||
return mergedParameters;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Term + (mergedParameters.IsNotBlank() ? "+" + mergedParameters : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,14 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SearchCodeRequest : BaseSearchRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SearchCodeRequest"/> class.
|
||||
/// </summary>
|
||||
public SearchCodeRequest() : base()
|
||||
{
|
||||
Repos = new RepositoryCollection();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SearchCodeRequest"/> class.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user