Added overloads with a single string

This commit is contained in:
Kristian Hellang
2015-07-19 13:30:32 +02:00
parent 7bd0447bd6
commit f98ff15211
3 changed files with 24 additions and 3 deletions
@@ -76,7 +76,7 @@ public class SearchClientTests
public async Task SearchForAllIssuesWithouTaskUsingTerm()
{
var request = new SearchIssuesRequest();
request.Repos.Add("caliburn-micro", "caliburn.micro");
request.Repos.Add("caliburn-micro/caliburn.micro");
var issues = await _gitHubClient.Search.SearchIssues(request);
+2 -2
View File
@@ -1184,7 +1184,7 @@ namespace Octokit.Tests.Clients
var connection = Substitute.For<IApiConnection>();
var client = new SearchClient(connection);
var request = new SearchIssuesRequest("something");
request.Repos.Add("octokit", "octokit.net");
request.Repos.Add("octokit/octokit.net");
request.User = "alfhenrik";
request.Labels = new[] { "bug" };
@@ -1513,7 +1513,7 @@ namespace Octokit.Tests.Clients
var request = new SearchCodeRequest("windows");
request.Repos = new RepositoryCollection {
{ "haha-business", "some&name" }
"haha-business"
};
request.Order = SortDirection.Descending;
@@ -359,6 +359,13 @@ namespace Octokit
_repositories.Add(GetRepositoryName(owner, name));
}
public void Add(string nameWithOwner)
{
Ensure.ArgumentNotNullOrEmptyString(nameWithOwner, "nameWithOwner");
_repositories.Add(nameWithOwner);
}
public void Clear()
{
_repositories.Clear();
@@ -372,6 +379,13 @@ namespace Octokit
return _repositories.Contains(GetRepositoryName(owner, name));
}
public bool Contains(string nameWithOwner)
{
Ensure.ArgumentNotNullOrEmptyString(nameWithOwner, "nameWithOwner");
return _repositories.Contains(nameWithOwner);
}
public bool Remove(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -380,6 +394,13 @@ namespace Octokit
return _repositories.Remove(GetRepositoryName(owner, name));
}
public bool Remove(string nameWithOwner)
{
Ensure.ArgumentNotNullOrEmptyString(nameWithOwner, "nameWithOwner");
return _repositories.Remove(nameWithOwner);
}
private static string GetRepositoryName(string owner, string name)
{
return string.Format(CultureInfo.InvariantCulture, "{0}/{1}", owner, name);