public async Task EnsuresNonNullArguments() { var client = new PullRequestsClient(Substitute.For<IApiConnection>()); await AssertEx.Throws<ArgumentNullException>(() => client.Get(null, "name", 1)); await AssertEx.Throws<ArgumentNullException>(() => client.Get("owner", null, 1)); await AssertEx.Throws<ArgumentException>(() => client.Get(null, "", 1)); await AssertEx.Throws<ArgumentException>(() => client.Get("", null, 1)); }
public async Task EnsuresNonNullArguments() { var client = new PullRequestsClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(null, "name", 1)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get("owner", null, 1)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(null, "", 1)); await Assert.ThrowsAsync <ArgumentException>(() => client.Get("", null, 1)); }
public void RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestsClient(connection); client.Get("fake", "repo", 42); connection.Received().Get<PullRequest>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls/42")); }
public void RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new PullRequestsClient(connection); client.Get("fake", "repo", 42); connection.Received().Get <PullRequest>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/pulls/42")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new PullRequestsClient(connection); await client.Get(1, 42); connection.Received().Get <PullRequest>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/pulls/42"), Arg.Any <Dictionary <string, string> >(), "application/vnd.github.shadow-cat-preview+json"); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new PullRequestsClient(connection); await client.Get(1, 42); connection.Received().Get <PullRequest>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/pulls/42")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestsClient(connection); await client.Get(1, 42); connection.Received().Get<PullRequest>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/pulls/42")); }