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

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Commits(null, "name", 1));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Commits("owner", null, 1));

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.Commits("", null, 1));
            }
コード例 #2
0
            public async void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                client.Commits("fake", "repo", 42);

                connection.Received().GetAll <PullRequestCommit>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/pulls/42/commits"));
            }
コード例 #3
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                await client.Commits(1, 42);

                connection.Received()
                .GetAll <PullRequestCommit>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/pulls/42/commits"));
            }
コード例 #4
0
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Commits(null, "name", 1));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Commits("owner", null, 1));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Commits(null, "", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Commits("", null, 1));
            }
コード例 #5
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                await client.Commits("fake", "repo", 42);
				
                connection.Received()
                    .GetAll<PullRequestCommit>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls/42/commits"));
            }