コード例 #1
0
        public async Task EnsuresArgumentsNotNull()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new IssueCommentsClient(connection);

            await AssertEx.Throws <ArgumentNullException>(async() => await client.Update(null, "name", 42, "title"));

            await AssertEx.Throws <ArgumentException>(async() => await client.Update("", "name", 42, "x"));

            await AssertEx.Throws <ArgumentNullException>(async() => await client.Update("owner", null, 42, "x"));

            await AssertEx.Throws <ArgumentException>(async() => await client.Update("owner", "", 42, "x"));

            await AssertEx.Throws <ArgumentNullException>(async() => await client.Update("owner", "name", 42, null));
        }
コード例 #2
0
        public void PostsToCorrectUrl()
        {
            const string issueCommentUpdate = "Worthwhile update";
            var          connection         = Substitute.For <IApiConnection>();
            var          client             = new IssueCommentsClient(connection);

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

            connection.Received().Patch <IssueComment>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/comments/42"), Arg.Any <object>());
        }
コード例 #3
0
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new IssueCommentsClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Update(null, "name", 42, "x"));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Update("owner", null, 42, "x"));

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

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.Update("", "name", 42, "x"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Update("owner", "", 42, "x"));
            }
コード例 #4
0
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new IssueCommentsClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update(null, "name", 42, "x"));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", null, 42, "x"));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", "name", 42, null));

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

                await Assert.ThrowsAsync<ArgumentException>(() => client.Update("", "name", 42, "x"));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Update("owner", "", 42, "x"));
            }
コード例 #5
0
            public void PostsToCorrectUrlWithRepositoryId()
            {
                const string issueCommentUpdate = "Worthwhile update";
                var connection = Substitute.For<IApiConnection>();
                var client = new IssueCommentsClient(connection);

                client.Update(1, 42, issueCommentUpdate);

                connection.Received().Patch<IssueComment>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/comments/42"), Arg.Any<object>());
            }