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

            await AssertEx.Throws<ArgumentNullException>(async () => await client.GetForCommit(null, "name", "sha"));
            await AssertEx.Throws<ArgumentException>(async () => await client.GetForCommit("", "name", "sha"));
            await AssertEx.Throws<ArgumentNullException>(async () => await client.GetForCommit("owner", null, "sha"));
            await AssertEx.Throws<ArgumentException>(async () => await client.GetForCommit("owner", "", "sha"));
            await AssertEx.Throws<ArgumentNullException>(async () => await client.GetForCommit("owner", "name", null));
            await AssertEx.Throws<ArgumentException>(async () => await client.GetForCommit("owner", "name", ""));
        }
コード例 #2
0
        public void RequestsCorrectUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new RepositoryCommentsClient(connection);

            client.GetForCommit("fake", "repo", "sha");

            connection.Received().GetAll<CommitComment>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/commits/sha/comments"));
        }