public async Task EnsuresNonNullArguments() { var client = new IssuesClient(Substitute.For<IApiConnection>()); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", 1)); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, 1)); }
public async Task EnsuresNonNullArguments() { var client = new IssuesClient(Substitute.For <IApiConnection>()); await AssertEx.Throws <ArgumentNullException>(async() => await client.Get(null, "name", 1)); await AssertEx.Throws <ArgumentNullException>(async() => await client.Get("owner", null, 1)); }
/// <summary> /// Gets a single issue in a repository. /// </summary> /// <param name="repositoryId"></param> /// <param name="issueNumber"></param> /// <param name="authorizedGitHubClient"></param> /// <returns></returns> public async Task <Issue> GetIssueForRepository(long repositoryId, int issueNumber, GitHubClient authorizedGitHubClient) { if (_issuesClient == null) { _issuesClient = new IssuesClient(new ApiConnection(authorizedGitHubClient.Connection)); } return(await _issuesClient.Get(repositoryId, issueNumber)); }
public void RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new IssuesClient(connection); client.Get("fake", "repo", 42); connection.Received().Get <Issue>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42")); }
public void RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new IssuesClient(connection); client.Get("fake", "repo", 42); connection.Received().Get<Issue>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new IssuesClient(connection); await client.Get(1, 42); connection.Received().Get <Issue>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42"), Arg.Any <Dictionary <string, string> >(), "application/vnd.github.squirrel-girl-preview+json"); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new IssuesClient(connection); await client.Get(1, 42); connection.Received().Get<Issue>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42"), Arg.Any<Dictionary<string, string>>(), "application/vnd.github.squirrel-girl-preview"); }