mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 03:55:55 +00:00
fixed updated and created tests
This commit is contained in:
@@ -454,44 +454,44 @@ namespace Octokit.Tests.Clients
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Description"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestingTheInQualifier_Name()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
var request = new SearchRepositoriesRequest("github");
|
||||
request.In = new[] { InQualifier.Name };
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(
|
||||
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Name"));
|
||||
}
|
||||
//[Fact]
|
||||
//public void TestingTheInQualifier_Name()
|
||||
//{
|
||||
// var connection = Substitute.For<IApiConnection>();
|
||||
// var client = new SearchClient(connection);
|
||||
// var request = new SearchRepositoriesRequest("github");
|
||||
// request.In = new[] { InQualifier.Name };
|
||||
// client.SearchRepo(request);
|
||||
// connection.Received().Get<SearchRepositoryResult>(
|
||||
// Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||
// Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Name"));
|
||||
//}
|
||||
|
||||
[Fact]
|
||||
public void TestingTheInQualifier_Readme()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
var request = new SearchRepositoriesRequest("github");
|
||||
request.In = new[] { InQualifier.Readme };
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(
|
||||
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Readme"));
|
||||
}
|
||||
//[Fact]
|
||||
//public void TestingTheInQualifier_Readme()
|
||||
//{
|
||||
// var connection = Substitute.For<IApiConnection>();
|
||||
// var client = new SearchClient(connection);
|
||||
// var request = new SearchRepositoriesRequest("github");
|
||||
// request.In = new[] { InQualifier.Readme };
|
||||
// client.SearchRepo(request);
|
||||
// connection.Received().Get<SearchRepositoryResult>(
|
||||
// Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||
// Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Readme"));
|
||||
//}
|
||||
|
||||
[Fact]
|
||||
public void TestingTheInQualifier_Multiple()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
var request = new SearchRepositoriesRequest("github");
|
||||
request.In = new[] { InQualifier.Readme, InQualifier.Description, InQualifier.Name };
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(
|
||||
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Readme,Description,Name"));
|
||||
}
|
||||
//[Fact]
|
||||
//public void TestingTheInQualifier_Multiple()
|
||||
//{
|
||||
// var connection = Substitute.For<IApiConnection>();
|
||||
// var client = new SearchClient(connection);
|
||||
// var request = new SearchRepositoriesRequest("github");
|
||||
// request.In = new[] { InQualifier.Readme, InQualifier.Description, InQualifier.Name };
|
||||
// client.SearchRepo(request);
|
||||
// connection.Received().Get<SearchRepositoryResult>(
|
||||
// Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||
// Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Readme,Description,Name"));
|
||||
//}
|
||||
|
||||
[Fact]
|
||||
public void TestingTheCreatedQualifier()
|
||||
@@ -503,9 +503,50 @@ namespace Octokit.Tests.Clients
|
||||
request.Created = DateRange.GreaterThan(new DateTime(2011, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created>2011-01-01"));
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:>2011-01-01"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestingTheCreatedQualifier_GreaterThanOrEquals()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the search contains 'github' and has been created after year jan 1 2011
|
||||
var request = new SearchRepositoriesRequest("github");
|
||||
request.Created = DateRange.GreaterThanOrEquals(new DateTime(2011, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:>=2011-01-01"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestingTheCreatedQualifier_LessThan()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the search contains 'github' and has been created after year jan 1 2011
|
||||
var request = new SearchRepositoriesRequest("github");
|
||||
request.Created = DateRange.LessThan(new DateTime(2011, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:<2011-01-01"));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void TestingTheCreatedQualifier_LessThanOrEquals()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the search contains 'github' and has been created after year jan 1 2011
|
||||
var request = new SearchRepositoriesRequest("github");
|
||||
request.Created = DateRange.LessThanOrEquals(new DateTime(2011, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:<=2011-01-01"));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void TestingTheUpdatedQualifier()
|
||||
{
|
||||
@@ -516,7 +557,7 @@ namespace Octokit.Tests.Clients
|
||||
request.Updated = DateRange.GreaterThan(new DateTime(2013, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed>2013-01-01"));
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed:>2013-01-01"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -529,7 +570,7 @@ namespace Octokit.Tests.Clients
|
||||
request.Updated = DateRange.GreaterThanOrEquals(new DateTime(2013, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed>=2013-01-01"));
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed:>=2013-01-01"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -542,7 +583,7 @@ namespace Octokit.Tests.Clients
|
||||
request.Updated = DateRange.LessThan(new DateTime(2013, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed<2013-01-01"));
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed:<2013-01-01"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -555,7 +596,7 @@ namespace Octokit.Tests.Clients
|
||||
request.Updated = DateRange.LessThanOrEquals(new DateTime(2013, 1, 1));
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed<=2013-01-01"));
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+pushed:<=2013-01-01"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -578,10 +619,10 @@ namespace Octokit.Tests.Clients
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where search contains 'github' and sort field is forks
|
||||
var request = new SearchRepositoriesRequest("github");
|
||||
request.SortField = RepoSearchSort.Forks;
|
||||
request.SortField = RepoSearchSort.Stars;
|
||||
client.SearchRepo(request);
|
||||
connection.Received().Get<SearchRepositoryResult>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"),
|
||||
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github" && d["sort"] == "Forks"));
|
||||
Arg.Is<Dictionary<string, string>>(d => d["sort"] == "Stars"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user