Skip to content

Commit

Permalink
Merge pull request #1463 from dampir/fix1459
Browse files Browse the repository at this point in the history
Fix of bug with search of C# code
  • Loading branch information
shiftkey authored Sep 15, 2016
2 parents 5883360 + 3bde78b commit 14ba023
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
20 changes: 19 additions & 1 deletion Octokit.Tests.Integration/Clients/SearchClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using Octokit;
Expand Down Expand Up @@ -57,6 +56,25 @@ public async Task SearchForFileNameInCode()
Assert.NotEmpty(repos.Items);
}

[IntegrationTest]
public async Task SearchForLanguageInCode()
{
var request = new SearchCodeRequest("AnonymousAuthenticator")
{
Language = Language.CSharp
};
request.Repos.Add("octokit/octokit.net");

var searchResults = await _gitHubClient.Search.SearchCode(request);

Assert.NotEmpty(searchResults.Items);

foreach (var code in searchResults.Items)
{
Assert.True(code.Name.EndsWith(".cs"));
}
}

[IntegrationTest]
public async Task SearchForFileNameInCodeWithoutTerm()
{
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Clients/SearchClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ public void TestingTheLanguageQualifier()

connection.Received().Get<SearchIssuesResult>(
Arg.Is<Uri>(u => u.ToString() == "search/issues"),
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+language:C#"));
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+language:CSharp"));
}

[Fact]
Expand Down Expand Up @@ -1446,7 +1446,7 @@ public void TestingTheLanguageQualifier()

connection.Received().Get<SearchCodeResult>(
Arg.Is<Uri>(u => u.ToString() == "search/code"),
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+language:C#"));
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+language:CSharp"));
}

[Fact]
Expand Down
3 changes: 1 addition & 2 deletions Octokit.Tests/Models/SearchIssuesRequestExclusionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using Octokit;
using Octokit.Tests.Helpers;
using Xunit;

public class SearchIssuesRequestExclusionsTests
Expand Down Expand Up @@ -68,7 +67,7 @@ public void HandlesLanguageAttributeCorrectly()

request.Language = Language.CSharp;

Assert.True(request.MergedQualifiers().Contains("-language:C#"));
Assert.True(request.MergedQualifiers().Contains("-language:CSharp"));
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion Octokit.Tests/Models/SearchIssuesRequestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void HandlesLanguageAttributeCorrectly()
Assert.False(request.MergedQualifiers().Any(x => x.Contains("language:")));

request.Language = Language.CSharp;
Assert.True(request.MergedQualifiers().Contains("language:C#"));
Assert.True(request.MergedQualifiers().Contains("language:CSharp"));
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/SearchRepositoriesRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public enum Language
Coq,
[Parameter(Value = "C++")]
CPlusPlus,
[Parameter(Value = "C#")]
[Parameter(Value = "CSharp")]
CSharp,
Css,
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cpp")]
Expand Down

0 comments on commit 14ba023

Please sign in to comment.