Fix existing unit tests

This commit is contained in:
Henrik Andersson
2015-03-16 21:01:05 +10:00
parent edb2a9362e
commit b21fddaea3
2 changed files with 9 additions and 5 deletions
@@ -55,13 +55,15 @@ namespace Octokit.Tests.Clients
var connection = Substitute.For<IApiConnection>();
var client = new PullRequestsClient(connection);
client.GetForRepository("fake", "repo", new PullRequestRequest { Head = "user:ref-head", Base = "fake_base_branch" });
client.GetForRepository("fake", "repo", new PullRequestRequest { Head = "user:ref-head", Base = "fake_base_branch"});
connection.Received().GetAll<PullRequest>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
Arg.Is<Dictionary<string, string>>(d => d.Count == 5
&& d["head"] == "user:ref-head"
&& d["state"] == "open"
&& d["base"] == "fake_base_branch"));
&& d["base"] == "fake_base_branch"
&& d["sort"] == "created"
&& d["direction"] == "desc"));
}
}
@@ -131,10 +131,12 @@ namespace Octokit.Tests.Reactive
);
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Get<List<PullRequest>>(Arg.Is(firstPageUrl),
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
Arg.Is<Dictionary<string, string>>(d => d.Count == 5
&& d["head"] == "user:ref-name"
&& d["state"] == "open"
&& d["base"] == "fake_base_branch"), Arg.Any<string>())
&& d["base"] == "fake_base_branch"
&& d["sort"] == "created"
&& d["direction"] == "desc"), Arg.Any<string>())
.Returns(Task.Factory.StartNew<IApiResponse<List<PullRequest>>>(() => firstPageResponse));
gitHubClient.Connection.Get<List<PullRequest>>(secondPageUrl, null, null)
.Returns(Task.Factory.StartNew<IApiResponse<List<PullRequest>>>(() => secondPageResponse));