public async Task RequestsCorrectUrlWithRequestWithApiOptionsWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableCheckRunsClient(gitHubClient); var request = new CheckRunRequest { CheckName = "build", Filter = CheckRunCompletedAtFilter.Latest, Status = CheckStatusFilter.InProgress }; var options = new ApiOptions { PageSize = 1 }; client.GetAllForCheckSuite(1, 1, request, options); connection.Received().Get <List <CheckRunsResponse> >( Arg.Is <Uri>(u => u.ToString() == "repositories/1/check-suites/1/check-runs"), Arg.Is <Dictionary <string, string> >(x => x.Count == 4 && x["per_page"] == "1" && x["check_name"] == "build" && x["status"] == "in_progress" && x["filter"] == "latest"), "application/vnd.github.antiope-preview+json"); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableCheckRunsClient(gitHubClient); client.GetAllForCheckSuite(1, 1); connection.Received().Get <List <CheckRunsResponse> >( Arg.Is <Uri>(u => u.ToString() == "repositories/1/check-suites/1/check-runs"), Args.EmptyDictionary, "application/vnd.github.antiope-preview+json"); }
public async Task EnsuresNonEmptyArguments() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableCheckRunsClient(gitHubClient); var request = new CheckRunRequest { CheckName = "build" }; Assert.Throws <ArgumentException>(() => client.GetAllForCheckSuite("", "repo", 1)); Assert.Throws <ArgumentException>(() => client.GetAllForCheckSuite("fake", "", 1)); Assert.Throws <ArgumentException>(() => client.GetAllForCheckSuite("", "repo", 1, request)); Assert.Throws <ArgumentException>(() => client.GetAllForCheckSuite("fake", "", 1, request)); Assert.Throws <ArgumentException>(() => client.GetAllForCheckSuite("", "repo", 1, request, ApiOptions.None)); Assert.Throws <ArgumentException>(() => client.GetAllForCheckSuite("fake", "", 1, request, ApiOptions.None)); }