diff --git a/Octokit.Tests/Clients/SearchClientTests.cs b/Octokit.Tests/Clients/SearchClientTests.cs index 4260a8b0e6..93da7a4ded 100644 --- a/Octokit.Tests/Clients/SearchClientTests.cs +++ b/Octokit.Tests/Clients/SearchClientTests.cs @@ -463,7 +463,7 @@ public void TestingTheLangaugeQualifier() request.Language = Language.Ruby; client.SearchRepo(request); connection.Received().Get(Arg.Is(u => u.ToString() == "search/repositories"), - Arg.Is>(d => d["q"] == "github+language:Ruby")); + Arg.Is>(d => d["q"] == "github+language:ruby")); } [Fact] diff --git a/Octokit.Tests/Models/SearchRepositoryRequestTests.cs b/Octokit.Tests/Models/SearchRepositoryRequestTests.cs index e49d9d151b..c01c7288a0 100644 --- a/Octokit.Tests/Models/SearchRepositoryRequestTests.cs +++ b/Octokit.Tests/Models/SearchRepositoryRequestTests.cs @@ -25,5 +25,13 @@ public void SortNotSpecifiedByDefault() Assert.True(string.IsNullOrWhiteSpace(request.Sort)); Assert.False(request.Parameters.ContainsKey("sort")); } + + [Fact] + public void LanguageUsesParameterTranslation() + { + var request = new SearchRepositoriesRequest() { Language = Language.CPlusPlus }; + var result = request.MergedQualifiers(); + Assert.Contains(result, x => string.Equals(x, "language:cpp")); + } } } diff --git a/Octokit/Models/Request/SearchRepositoriesRequest.cs b/Octokit/Models/Request/SearchRepositoriesRequest.cs index 78c7d889c2..d9fe40e69d 100644 --- a/Octokit/Models/Request/SearchRepositoriesRequest.cs +++ b/Octokit/Models/Request/SearchRepositoriesRequest.cs @@ -148,7 +148,7 @@ public override IReadOnlyList MergedQualifiers() if (Language != null) { - parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:{0}", Language)); + parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:{0}", Language.ToParameter())); } if (User.IsNotBlank()) @@ -557,7 +557,7 @@ public enum Language ColdFusion, CommonLisp, Coq, - [Parameter(Value = "C++")] + [Parameter(Value = "cpp")] CPlusPlus, [Parameter(Value = "CSharp")] CSharp,