public void HandlesInAttributeCorrectly() { var request = new SearchIssuesRequest("test"); Assert.DoesNotContain(request.MergedQualifiers(), x => x.Contains("in:")); request.In = new List <IssueInQualifier> { IssueInQualifier.Body, IssueInQualifier.Comment }; Assert.Contains("in:body,comment", request.MergedQualifiers()); }
public async Task SearchForAllIssues() { var request = new SearchIssuesRequest("phone"); request.Repos.Add("caliburn-micro", "caliburn.micro"); request.State = ItemState.All; var issues = await _gitHubClient.Search.SearchIssues(request); Assert.NotEmpty(issues.Items); }
public async Task SearchForWordInCode() { var request = new SearchIssuesRequest("windows"); request.SortField = IssueSearchSort.Created; request.Order = SortDirection.Descending; var repos = await _gitHubClient.Search.SearchIssues(request); Assert.NotEmpty(repos.Items); }
public void HandlesRepoAttributeCorrectly() { var request = new SearchIssuesRequest("test"); Assert.False(request.MergedQualifiers().Any(x => x.Contains("repo:"))); request.Repos.Add("myorg", "repo1"); request.Repos.Add("myorg", "repo2"); Assert.True(request.MergedQualifiers().Contains("repo:myorg/repo1")); Assert.True(request.MergedQualifiers().Contains("repo:myorg/repo2")); }
public async Task SearchForOpenIssues() { var request = new SearchIssuesRequest("phone"); request.Repo = "caliburn-micro/caliburn.micro"; request.State = ItemState.Open; var issues = await _gitHubClient.Search.SearchIssues(request); Assert.NotEmpty(issues.Items); }
public void HandlesRepoAttributeCorrectly() { var request = new SearchIssuesRequest("test"); Assert.DoesNotContain(request.MergedQualifiers(), x => x.Contains("repo:")); request.Repos.Add("myorg", "repo1"); request.Repos.Add("myorg", "repo2"); Assert.Contains("repo:myorg/repo1", request.MergedQualifiers()); Assert.Contains("repo:myorg/repo2", request.MergedQualifiers()); }
public void HandlesIsAttributeCorrectly() { var request = new SearchIssuesRequest("test"); Assert.DoesNotContain(request.MergedQualifiers(), x => x.Contains("is:")); request.Is = new List <IssueIsQualifier> { IssueIsQualifier.Merged, IssueIsQualifier.PullRequest }; Assert.Contains("is:merged", request.MergedQualifiers()); Assert.Contains("is:pr", request.MergedQualifiers()); }
public async Task <List <IssueAndRepo> > GetAllMyOpenPrs() { var totalIssueList = new List <Issue>(); int page = 1; while (true) { var searchIssuesRequest = new SearchIssuesRequest() { Page = page, PerPage = 100, Author = _config.GitHubUserName, Type = IssueTypeQualifier.PullRequest, State = ItemState.Open, Head = Constants.FeatureName }; var pullRequestsThisPage = await GitHubClient.Search.SearchIssues(searchIssuesRequest); if (pullRequestsThisPage.IncompleteResults) { throw new Exception("Search result was incomplete"); } totalIssueList.AddRange(pullRequestsThisPage.Items); if (pullRequestsThisPage.TotalCount != 100) { break; } } var issueAndRepoList = totalIssueList.Select(t => { var start = "github.com/repos"; var urlShortened = t.Url.Substring(t.Url.IndexOf(start) + start.Length); var split = urlShortened.Split('/', StringSplitOptions.RemoveEmptyEntries); var repoOwner = split[0]; var repoName = split[1]; var issueAndRepo = new IssueAndRepo() { Issue = t, RepoOwner = repoOwner, RepoName = repoName }; return(issueAndRepo); }); return(issueAndRepoList.ToList()); }
public void HandlesIsAttributeCorrectly() { var request = new SearchIssuesRequest("test"); Assert.False(request.MergedQualifiers().Any(x => x.Contains("is:"))); request.Is = new List <IssueIsQualifier> { IssueIsQualifier.Merged, IssueIsQualifier.PullRequest }; Assert.True(request.MergedQualifiers().Contains("is:merged")); Assert.True(request.MergedQualifiers().Contains("is:pr")); }
public static async Task Run([TimerTrigger("0 0 1 */1 * *")] TimerInfo myTimer, [CosmosDB( databaseName: "GithubStats", collectionName: "DocsRepo", ConnectionStringSetting = "CosmosDBConnection")] IAsyncCollector <IssueData> outputData, ILogger log) { log.LogInformation($"C# DataProcessing_3 function executed at: {DateTime.Now}"); var client = new GitHubClient(new ProductHeaderValue("fsharpfunctions")); var tokenAuth = new Credentials(Environment.GetEnvironmentVariable("GithubToken")); // NOTE: not real token client.Credentials = tokenAuth; log.LogInformation("Retrieving Github Issues"); var request = new SearchIssuesRequest() { PerPage = 100, Page = 1, Type = IssueTypeQualifier.Issue, State = ItemState.Open }; request.Repos.Add("MicrosoftDocs", "azure-docs"); var openIssues = await client.Search.SearchIssues(request); log.LogInformation($"Retrieved {openIssues.Items.Count()} Issues");; log.LogInformation(client.GetLastApiInfo().RateLimit.Remaining.ToString()); var byPriority = GetIssueCount(openIssues.Items, "Pri") .ToDictionary(g => g.Key.Remove(0, 3), g => g.Count()); var byService = GetIssueCount(openIssues.Items, "/svc") .ToDictionary(g => g.Key.Substring(0, g.Key.LastIndexOf('/')), g => g.Count()); var document = new IssueData() { id = Guid.NewGuid().ToString(), Source = "CSharp", EntryType = "ByService", Timestamp = DateTime.UtcNow, TotalOpenIssues = openIssues.Items.Count(), MissingTags = openIssues.Items.Count(o => o.Labels.Count() == 0), CountByPriority = byPriority, CountByService = byService }; await outputData.AddAsync(document); }
static async Task <List <Issue> > DoSearch(GitHubClient gitHub, string label) { var request = new SearchIssuesRequest() { Labels = new [] { label }, State = ItemState.Open, Type = IssueTypeQualifier.Issue, Repos = { { "dotnet", "runtime" } } }; var result = await gitHub.Search.SearchIssues(request); return(result.Items.ToList()); }
public IReadOnlyList <Issue> GetAllEffortRelatedIssues(string searchTerm, string involvedPerson) { var relevantIssuesRequest = new SearchIssuesRequest(searchTerm) { Involves = involvedPerson, Type = IssueTypeQualifier.Issue, In = new[] { IssueInQualifier.Comment }, }; SearchIssuesResult potentialEffortIssues = searchClient.SearchIssues(relevantIssuesRequest).GetAwaiter().GetResult(); return(potentialEffortIssues.Items); }
private async Task RequestAsync() { SearchIssuesRequest request = new SearchIssuesRequest(); request.Repos.Add("angular/angular"); request.Created = new DateRange(DateTime.Now.Subtract(TimeSpan.FromDays(7)), SearchQualifierOperator.GreaterThan); request.SortField = IssueSearchSort.Created; request.Order = SortDirection.Descending; searchResults = await client.Search.SearchIssues(request); LastUpdate = DateTime.Now; }
public static void ApplyLabelsFilter(this SearchIssuesRequest request, IEnumerable <string> labels) { if (request.Labels == null) { request.Labels = labels; } else { var result = new List <string>(); result.AddRange(labels); result.AddRange(request.Labels); request.Labels = result.Distinct(StringComparer.InvariantCultureIgnoreCase); } }
private static async Task <Issue> GetPRInfo(GitHubClient github, string commit) { var request = new SearchIssuesRequest(commit) { Type = IssueTypeQualifier.PullRequest, State = ItemState.Closed, }; request.Repos.Add("Vita3K/Vita3K"); var searchResults = (await github.Search.SearchIssues(request)).Items; return(searchResults.FirstOrDefault()); }
private async Task <IReadOnlyList <int> > GetWorkItemIdsByLabel(string label) { var result = new List <int>(); // Search for all issues marked with CodePlex migration labels sorted in ascending fashion by creation date. var searchIssuesRequest = new SearchIssuesRequest { Type = IssueTypeQualifier.Issue, Labels = new[] { label }, Order = SortDirection.Ascending, SortField = IssueSearchSort.Created, Page = 1, }; searchIssuesRequest.Repos.Add(owner: repoOwner, name: repo); int resultCount = 0; SearchIssuesResult searchIssuesResult = await search.SearchIssues(searchIssuesRequest); int totalResultCount = searchIssuesResult.TotalCount; // Extract CodePlex work item ID from issue body, migration state from from assigned labels. while (searchIssuesResult.Items.Count > 0) { foreach (Issue issue in searchIssuesResult.Items) { try { int codePlexWorkItemId = TextUtilities.GetCodePlexWorkItemId(issue.Body); result.Add(codePlexWorkItemId); } catch (Exception ex) { throw new WorkItemIdentificationException( string.Format(Resources.ErrorExtractingCodePlexWorkItemIdFromGitHubIssue, issue.Number, ex.Message), ex); } } resultCount += searchIssuesResult.Items.Count; if (resultCount >= totalResultCount) { break; } searchIssuesRequest.Page += 1; searchIssuesResult = await search.SearchIssues(searchIssuesRequest); } return(result); }
public async Task SearchForAllIssuesUsingTerm() { var request = new SearchIssuesRequest("phone"); request.Repos.Add("caliburn-micro", "caliburn.micro"); var issues = await _gitHubClient.Search.SearchIssues(request); var closedIssues = issues.Items.Where(x => x.State == ItemState.Closed); var openedIssues = issues.Items.Where(x => x.State == ItemState.Open); Assert.NotEmpty(closedIssues); Assert.NotEmpty(openedIssues); }
private async Task <SearchIssuesResult> SearchPullRequestsInternal(ItemState?state, IList <string> repositorynames) { SearchIssuesRequest searchRequest = new SearchIssuesRequest() { Type = IssueTypeQualifier.PullRequest, State = state }; foreach (var repositoryName in repositorynames) { searchRequest.Repos.Add(String.Format(@"{0}/{1}", _owner, repositoryName)); } return(await Client.Search.SearchIssues(searchRequest)); }
private SearchIssuesRequest CreateQuery(RepositoryConfiguration repoInfo) { // Find all open issues // That are marked as customer reported SearchIssuesRequest requestOptions = new SearchIssuesRequest() { Repos = new RepositoryCollection(), Labels = new string[] { Constants.Labels.CustomerReported }, State = ItemState.Open }; requestOptions.Repos.Add(repoInfo.Owner, repoInfo.Name); return(requestOptions); }
/// <summary> /// Searches issues /// </summary> /// <param name="query"></param> /// <returns></returns> public static async Task <ObservableCollection <Issue> > SearchIssues(string query) { try { var client = await UserUtility.GetAuthenticatedClient(); var request = new SearchIssuesRequest(query); var result = await client.Search.SearchIssues(request); return(new ObservableCollection <Issue>(new List <Issue>(result.Items))); } catch { return(null); } }
private SearchIssuesRequest CreateQuery(RepositoryConfiguration repoInfo, string label) { // Find all open issues // That are marked with 'label' SearchIssuesRequest requestOptions = new SearchIssuesRequest() { Repos = new RepositoryCollection(), Labels = new string[] { label }, State = ItemState.Open }; requestOptions.Repos.Add(repoInfo.Owner, repoInfo.Name); return(requestOptions); }
private SearchIssuesRequest CreateQueryForNeedsAttentionItems(RepositoryConfiguration repoInfo) { // Find all open issues // That are marked with 'needs-attention' SearchIssuesRequest requestOptions = new SearchIssuesRequest() { Repos = new RepositoryCollection(), Labels = new string[] { Constants.Labels.NeedsAttention }, Is = new[] { IssueIsQualifier.Issue }, State = ItemState.Open }; requestOptions.Repos.Add(repoInfo.Owner, repoInfo.Name); return(requestOptions); }
async Task <SearchIssuesResult> SearchPullRequests(ItemState?state, DateRange searchDates, IList <string> repoNames) { SearchIssuesRequest searchRequest = new SearchIssuesRequest() { // only search pull requests Type = IssueTypeQualifier.PR, State = state, Updated = searchDates }; foreach (var repoName in repoNames) { searchRequest.Repos.Add(String.Format(@"{0}/{1}", _owner, repoName)); } return(await Client.Search.SearchIssues(searchRequest)); }
/// <summary> /// Searches issues /// </summary> /// <param name="query"></param> /// <returns></returns> public static async Task <ObservableCollection <Issue> > SearchIssues(string query, Language?language = null) { try { var request = new SearchIssuesRequest(query); if (language != null) { request.Language = language; } var result = await GlobalHelper.GithubClient.Search.SearchIssues(request); return(new ObservableCollection <Issue>(result.Items)); } catch { return(null); } }
/// <summary> /// Searches for issues in the appropriate GitHub repo by creation date and returns issues /// with string-tags in the title marking them as critical issues, hotfixes, and rollbacks /// </summary> /// <returns>A list of GitHub issues filed during the rollout window containing string-tags in the title marking them as critical issues, hotfixes, and/or rollbacks</returns> public async Task <List <Issue> > GetRolloutIssuesFromGithubAsync() { SearchIssuesRequest searchIssuesRequest = new SearchIssuesRequest { Created = new DateRange(RolloutStartDate, RolloutEndDate), }; searchIssuesRequest.Repos.Add(GithubConfig.ScorecardsGithubOrg, GithubConfig.ScorecardsGithubRepo); List <Issue> issueSearchResults = await GetAllIssuesFromSearchAsync(searchIssuesRequest); return(issueSearchResults.Where(issue => Utilities.IssueContainsRelevantLabels(issue, GithubLabelNames.IssueLabel, RepoConfig.GithubIssueLabel, Log) || Utilities.IssueContainsRelevantLabels(issue, GithubLabelNames.HotfixLabel, RepoConfig.GithubIssueLabel, Log) || Utilities.IssueContainsRelevantLabels(issue, GithubLabelNames.RollbackLabel, RepoConfig.GithubIssueLabel, Log) || Utilities.IssueContainsRelevantLabels(issue, GithubLabelNames.DowntimeLabel, RepoConfig.GithubIssueLabel, Log) ).ToList()); }
private async Task <SearchIssuesResult> SearchPullRequestsInternal(string repositoryName, string jiraIssueNumber) { SearchIssuesRequest request = new SearchIssuesRequest(jiraIssueNumber) { Type = IssueTypeQualifier.PullRequest }; request.In = new[] { IssueInQualifier.Title, IssueInQualifier.Body }; request.Repos.Add(String.Format(@"{0}/{1}", _owner, repositoryName)); var results = await Client.Search.SearchIssues(request); return(results); }
private SearchIssuesRequest CreateQuery(RepositoryConfiguration repoInfo, Milestone milestone) { // Find all open issues // That are marked with 'Client // In the specified milestone SearchIssuesRequest requestOptions = new SearchIssuesRequest() { Repos = new RepositoryCollection(), Labels = new string[] { }, State = ItemState.Open, Milestone = milestone.Title }; requestOptions.Repos.Add(repoInfo.Owner, repoInfo.Name); return(requestOptions); }
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); }
private SearchIssuesRequest CreateQueryForNewItems(RepositoryConfiguration repoInfo, IssueIsQualifier issueType) { DateTime to = DateTime.UtcNow; DateTime fromTwoDaysBack = DateTime.UtcNow.AddDays(-2); SearchIssuesRequest requestOptions = new SearchIssuesRequest() { #pragma warning disable CS0618 // Type or member is obsolete Created = DateRange.Between(fromTwoDaysBack, to), #pragma warning restore CS0618 // Type or member is obsolete Order = SortDirection.Descending, Is = new[] { IssueIsQualifier.Open, issueType }, Repos = new RepositoryCollection() }; requestOptions.Repos.Add(repoInfo.Owner, repoInfo.Name); return(requestOptions); }
private SearchIssuesRequest CreateQuery(RepositoryConfig repoInfo) { // Find all open PRs // That were created more than 3 months ago SearchIssuesRequest requestOptions = new SearchIssuesRequest() { Repos = new RepositoryCollection(), State = ItemState.Open, #pragma warning disable CS0618 // Type or member is obsolete Created = DateRange.LessThanOrEquals(DateTime.Now.AddMonths(-3)), #pragma warning restore CS0618 // Type or member is obsolete Order = SortDirection.Ascending, Is = new[] { IssueIsQualifier.PullRequest } }; requestOptions.Repos.Add(repoInfo.Owner, repoInfo.Name); return(requestOptions); }
public void TestingTheLabelsQualifier_Multiple() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Labels = new[] { "bug", "feature" }; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+label:bug+label:feature")); }
public void TestingTheStateQualifier_Closed() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.State = ItemState.Closed; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+state:Closed")); }
public void TestingTheInvolvesQualifier() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Involves = "alfhenrik"; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+involves:alfhenrik")); }
/// <summary> /// search issues /// http://developer.github.com/v3/search/#search-issues /// </summary> /// <param name="request"></param> /// <returns>List of issues</returns> public IObservable<Issue> SearchIssues(SearchIssuesRequest request) { Ensure.ArgumentNotNull(request, "request"); return _connection.GetAndFlattenAllPages<Issue>(ApiUrls.SearchIssues(), request.ToParametersDictionary()); }
public void TestingTheCommentsQualifier_Range() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Comments = new Range(10, 20); client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+comments:10..20")); }
public void TestingTheSortParameter() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.SortField = IssueSearchSort.Comments; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["sort"] == "comments")); }
public void TestingTheRepoAndUserAndLabelQualifier() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Repo = "octokit.net"; request.User = "******"; request.Labels = new[] { "bug" }; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+label:bug+user:alfhenrik+repo:octokit.net")); }
/// <summary> /// search issues /// http://developer.github.com/v3/search/#search-issues /// </summary> /// <param name="search"></param> /// <returns>List of issues</returns> public IObservable<SearchIssuesResult> SearchIssues(SearchIssuesRequest search) { Ensure.ArgumentNotNull(search, "search"); return _client.SearchIssues(search).ToObservable(); }
public async Task ErrorOccursWhenSpecifyingInvalidFormatForRepos() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("windows"); request.Repos = new RepositoryCollection { "haha-business" }; request.SortField = IssueSearchSort.Created; request.Order = SortDirection.Descending; await Assert.ThrowsAsync<RepositoryFormatException>( async () => await client.SearchIssues(request)); }
public void TestingTheCreatedQualifier_Between() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Created = DateRange.Between(new DateTime(2014, 1, 1), new DateTime(2014, 2, 2)); client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+created:2014-01-01..2014-02-02")); }
public void TestingTheTermParameter() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("pub"); client.SearchIssues(request); connection.Received().GetAll<Issue>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "pub")); }
public void TestingTheLanguageQualifier() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Language = Language.CSharp; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+language:CSharp")); }
public void TestingTheOrderParameter() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.SortField = IssueSearchSort.Updated; request.Order = SortDirection.Ascending; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["sort"] == "updated" && d["order"] == "asc")); }
public void TestingTheUpdatedQualifier_LessThanOrEquals() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Updated = DateRange.LessThanOrEquals(new DateTime(2014, 1, 1)); client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+updated:<=2014-01-01")); }
public void TestingTheDefaultOrderParameter() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["order"] == "desc")); }
public void TestingTheRepoQualifier() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Repo = "octokit.net"; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+repo:octokit.net")); }
public void TestingTheInQualifiers_Multiple() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.In = new[] { IssueInQualifier.Body, IssueInQualifier.Title }; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+in:body,title")); }
/// <summary> /// search issues /// http://developer.github.com/v3/search/#search-issues /// </summary> /// <param name="search"></param> /// <returns>List of issues</returns> public IObservable<Issue> SearchIssues(SearchIssuesRequest search) { Ensure.ArgumentNotNull(search, "search"); return _connection.GetAndFlattenAllPages<Issue>(ApiUrls.SearchIssues(), search.Parameters); }
public void TestingTheTypeQualifier_PR() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Type = IssueTypeQualifier.PR; client.SearchIssues(request); connection.Received().Get<SearchIssuesResult>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+type:pr")); }
public void TestingTheInQualifier() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.In = new[] { IssueInQualifier.Comment }; client.SearchIssues(request); connection.Received().GetAll<Issue>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+in:comment")); }
public void TestingTheCommentsQualifier_LessThanOrEqual() { var connection = Substitute.For<IApiConnection>(); var client = new SearchClient(connection); var request = new SearchIssuesRequest("something"); request.Comments = Range.LessThanOrEquals(10); client.SearchIssues(request); connection.Received().GetAll<Issue>( Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+comments:<=10")); }