Exemple #1
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CheckSuitesClient(connection);

                await client.GetAllForReference(1, "ref");

                connection.Received().GetAll <CheckSuitesResponse>(
                    Arg.Is <Uri>(u => u.ToString() == "repositories/1/commits/ref/check-suites"),
                    Args.EmptyDictionary,
                    "application/vnd.github.antiope-preview+json",
                    Args.ApiOptions);
            }
Exemple #2
0
            public async Task RequestsCorrectUrlWithRequestWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CheckSuitesClient(connection);

                var request = new CheckSuiteRequest
                {
                    AppId     = 123,
                    CheckName = "build"
                };

                await client.GetAllForReference(1, "ref", request);

                connection.Received().GetAll <CheckSuitesResponse>(
                    Arg.Is <Uri>(u => u.ToString() == "repositories/1/commits/ref/check-suites"),
                    Arg.Is <Dictionary <string, string> >(x =>
                                                          x["app_id"] == "123" &&
                                                          x["check_name"] == "build"),
                    "application/vnd.github.antiope-preview+json",
                    Args.ApiOptions);
            }
Exemple #3
0
            public async Task EnsuresNonEmptyArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CheckSuitesClient(connection);

                var request = new CheckSuiteRequest();

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("", "repo", "ref"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("fake", "", "ref"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("fake", "repo", ""));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("", "repo", "ref", request));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("fake", "", "ref", request));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("fake", "repo", "", request));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("", "repo", "ref", request, ApiOptions.None));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("fake", "", "ref", request, ApiOptions.None));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference("fake", "repo", "", request, ApiOptions.None));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference(1, ""));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference(1, "", request));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForReference(1, "", request, ApiOptions.None));
            }