mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-09 13:01:36 +00:00
Merge pull request #481 from octokit/sort-is-actually-case-sensitive
searching for issues hits a case-sensitive field
This commit is contained in:
@@ -54,4 +54,16 @@ public class SearchClientTests
|
||||
|
||||
Assert.NotEmpty(repos.Items);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Octokit.Internal;
|
||||
@@ -7,18 +8,20 @@ namespace Octokit
|
||||
{
|
||||
static class EnumExtensions
|
||||
{
|
||||
[SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
|
||||
public static string ToParameter(this Enum prop)
|
||||
{
|
||||
if (prop == null) return null;
|
||||
|
||||
var member = prop.GetType().GetMember(prop.ToString()).FirstOrDefault();
|
||||
|
||||
var propString = prop.ToString();
|
||||
var member = prop.GetType().GetMember(propString).FirstOrDefault();
|
||||
if (member == null) return null;
|
||||
|
||||
var attribute = member.GetCustomAttributes(typeof(ParameterAttribute), false)
|
||||
.Cast<ParameterAttribute>()
|
||||
.FirstOrDefault();
|
||||
|
||||
return attribute != null ? attribute.Value : null;
|
||||
return attribute != null ? attribute.Value : propString.ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,9 +217,9 @@ namespace Octokit
|
||||
parameters.Add(String.Format(CultureInfo.InvariantCulture, "involves:{0}", Involves));
|
||||
}
|
||||
|
||||
if (State != null)
|
||||
if (State.HasValue)
|
||||
{
|
||||
parameters.Add(String.Format(CultureInfo.InvariantCulture, "state:{0}", State));
|
||||
parameters.Add(String.Format(CultureInfo.InvariantCulture, "state:{0}", State.Value.ToParameter()));
|
||||
}
|
||||
|
||||
if (Labels != null)
|
||||
|
||||
Reference in New Issue
Block a user