Exemplo n.º 1
0
            public void EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssuesClient(connection);

                Assert.Throws <ArgumentNullException>(() => client.Update(null, "name", 1, new IssueUpdate()));
                Assert.Throws <ArgumentException>(() => client.Update("", "name", 1, new IssueUpdate()));
                Assert.Throws <ArgumentNullException>(() => client.Update("owner", null, 1, new IssueUpdate()));
                Assert.Throws <ArgumentException>(() => client.Update("owner", "", 1, new IssueUpdate()));
                Assert.Throws <ArgumentNullException>(() => client.Update("owner", "name", 1, null));
            }
 public async Task <Issue> UpdateIssue(long repositoryId, int issueNumber, IssueUpdate updatedIssueDetails,
                                       GitHubClient authorizedGitHubClient)
 {
     if (_issuesClient == null)
     {
         _issuesClient = new IssuesClient(new ApiConnection(authorizedGitHubClient.Connection));
     }
     return(await _issuesClient.Update(repositoryId, issueNumber, updatedIssueDetails));
 }
Exemplo n.º 3
0
            public void PostsToCorrectUrl()
            {
                var issueUpdate = new IssueUpdate();
                var connection  = Substitute.For <IApiConnection>();
                var client      = new IssuesClient(connection);

                client.Update("fake", "repo", 42, issueUpdate);

                connection.Received().Patch <Issue>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42"), issueUpdate);
            }
Exemplo n.º 4
0
            public void PostsToCorrectUrlWithRepositoryId()
            {
                var issueUpdate = new IssueUpdate();
                var connection  = Substitute.For <IApiConnection>();
                var client      = new IssuesClient(connection);

                client.Update(1, 42, issueUpdate);

                connection.Received().Patch <Issue>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42"),
                                                    issueUpdate);
            }
Exemplo n.º 5
0
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update(null, "name", 1, new IssueUpdate()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", null, 1, new IssueUpdate()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", "name", 1, null));

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update(1, 1, null));

                await Assert.ThrowsAsync<ArgumentException>(() => client.Update("", "name", 1, new IssueUpdate()));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Update("owner", "", 1, new IssueUpdate()));
            }
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update(null, "name", 1, new IssueUpdate()));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Update("", "name", 1, new IssueUpdate()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", null, 1, new IssueUpdate()));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Update("owner", "", 1, new IssueUpdate()));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", "name", 1, null));
            }
            public void PostsToCorrectUrl()
            {
                var issueUpdate = new IssueUpdate();
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                client.Update("fake", "repo", 42, issueUpdate);

                connection.Received().Patch<Issue>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42"),
                    issueUpdate);
            }
Exemplo n.º 8
0
            public void PostsToCorrectUrlWithRepositoryId()
            {
                var issueUpdate = new IssueUpdate();
                var connection = Substitute.For<IApiConnection>();
                var client = new IssuesClient(connection);

                client.Update(1, 42, issueUpdate);

                connection.Received().Patch<Issue>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42"),
                    issueUpdate);
            }