Add integration tests (including unskipping SearchAll test that should work now)

Fixup doc comments
This commit is contained in:
Ryan Gribble
2016-03-30 00:25:49 +10:00
parent ccd2698ee0
commit 78c77355e5
3 changed files with 74 additions and 6 deletions
@@ -86,7 +86,7 @@ public class SearchClientTests
Assert.NotEmpty(issues.Items);
}
[Fact(Skip = "see https://github.com/octokit/octokit.net/issues/1082 for investigating this failing test")]
[Fact]
public async Task SearchForAllIssues()
{
var request = new SearchIssuesRequest("phone");
@@ -98,7 +98,7 @@ public class SearchClientTests
}
[Fact]
public async Task SearchForAllIssuesWithouTaskUsingTerm()
public async Task SearchForAllIssuesWithoutUsingTerm()
{
var request = new SearchIssuesRequest();
request.Repos.Add("caliburn-micro/caliburn.micro");
@@ -126,4 +126,62 @@ public class SearchClientTests
Assert.NotEmpty(closedIssues);
Assert.NotEmpty(openedIssues);
}
[Fact]
public async Task SearchForMergedPullRequests()
{
var allRequest = new SearchIssuesRequest();
allRequest.Repos.Add("octokit", "octokit.net");
allRequest.Type = IssueTypeQualifier.PR;
var mergedRequest = new SearchIssuesRequest();
mergedRequest.Repos.Add("octokit", "octokit.net");
mergedRequest.Is = new List<IssueIsQualifier> { IssueIsQualifier.PullRequest, IssueIsQualifier.Merged };
var allPullRequests = await _gitHubClient.Search.SearchIssues(allRequest);
var mergedPullRequests = await _gitHubClient.Search.SearchIssues(mergedRequest);
Assert.NotEmpty(allPullRequests.Items);
Assert.NotEmpty(mergedPullRequests.Items);
Assert.NotEqual(allPullRequests.TotalCount, mergedPullRequests.TotalCount);
}
[Fact]
public async Task SearchForLabelsAndExcludedLabels()
{
var labelRequest = new SearchIssuesRequest();
labelRequest.Repos.Add("octokit", "octokit.net");
labelRequest.Labels = new List<string> { "up-for-grabs" };
var notLabelRequest = new SearchIssuesRequest();
notLabelRequest.Repos.Add("octokit", "octokit.net");
notLabelRequest.NotLabels = new List<string> { "up-for-grabs" };
var upForGrabs = await _gitHubClient.Search.SearchIssues(labelRequest);
var notUpForGrabs = await _gitHubClient.Search.SearchIssues(notLabelRequest);
Assert.NotEmpty(upForGrabs.Items);
Assert.NotEmpty(notUpForGrabs.Items);
Assert.NotEqual(upForGrabs.TotalCount, notUpForGrabs.TotalCount);
Assert.False(upForGrabs.Items.Any(x1 => notUpForGrabs.Items.Any(x2 => x2.Number == x1.Number)));
}
[Fact]
public async Task SearchForMissingMetadata()
{
var allRequest = new SearchIssuesRequest();
allRequest.Repos.Add("octokit", "octokit.net");
var noAssigneeRequest = new SearchIssuesRequest();
noAssigneeRequest.Repos.Add("octokit", "octokit.net");
noAssigneeRequest.No = IssueNoMetadataQualifier.Assignee;
var allIssues = await _gitHubClient.Search.SearchIssues(allRequest);
var noAssigneeIssues = await _gitHubClient.Search.SearchIssues(noAssigneeRequest);
Assert.NotEmpty(allIssues.Items);
Assert.NotEmpty(noAssigneeIssues.Items);
Assert.NotEqual(allIssues.TotalCount, noAssigneeIssues.TotalCount);
}
}
@@ -144,7 +144,7 @@ public class SearchIssuesRequestTests
Assert.False(request.MergedQualifiers().Any(x => x.Contains("language:")));
request.Language = Language.CSharp;
Assert.True(request.MergedQualifiers().Contains("language:CSharp"));
Assert.True(request.MergedQualifiers().Contains("language:C#"));
}
[Fact]
+13 -3
View File
@@ -32,6 +32,16 @@ namespace Octokit
Repos = new RepositoryCollection();
}
[Obsolete("this will be deprecated in a future version")]
public SearchIssuesRequest(string term, string owner, string name)
: this(term)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Repos.Add(owner, name);
}
/// <summary>
/// Optional Sort field. One of comments, created, updated or merged
/// If not provided, results are sorted by best match.
@@ -182,13 +192,13 @@ namespace Octokit
/// Searches for issues within repositories that match a certain language.
/// </summary>
/// <remarks>
/// https://help.github.com/articles/searching-issues/#search-by-the-labels-on-an-issue
/// https://help.github.com/articles/searching-issues/#search-by-the-main-language-of-a-repository
/// </remarks>
public Language? Language { get; set; }
private IEnumerable<IssueIsQualifier> _is;
/// <summary>
/// Searches for issues using a more human syntax covering options like state, type and merged status
/// Searches for issues using a more human syntax covering options like state, type, merged status, private/public repository
/// </summary>
/// <remarks>
/// https://help.github.com/articles/searching-issues/#search-based-on-the-state-of-an-issue-or-pull-request
@@ -349,7 +359,7 @@ namespace Octokit
if (Language != null)
{
parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:{0}", Language));
parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:{0}", Language.ToParameter()));
}
if (Is != null)