public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CheckRunsClient(connection);

                await client.GetAllForCheckSuite(1, 1);

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

                var request = new CheckRunRequest {
                    CheckName = "build", Filter = CheckRunCompletedAtFilter.Latest, Status = CheckStatusFilter.InProgress
                };

                await client.GetAllForCheckSuite(1, 1, request);

                connection.Received().GetAll <CheckRunsResponse>(
                    Arg.Is <Uri>(u => u.ToString() == "repositories/1/check-suites/1/check-runs"),
                    Arg.Is <Dictionary <string, string> >(x =>
                                                          x.Count == 3 &&
                                                          x["check_name"] == "build" &&
                                                          x["status"] == "in_progress" &&
                                                          x["filter"] == "latest"),
                    "application/vnd.github.antiope-preview+json",
                    Args.ApiOptions);
            }
            public async Task EnsuresNonEmptyArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new CheckRunsClient(connection);

                var request = new CheckRunRequest {
                    CheckName = "build"
                };

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

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

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

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

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

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