Exemplo n.º 1
0
            public async Task EnsuresNonEmptyArguments()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableCheckRunsClient(gitHubClient);

                Assert.Throws <ArgumentException>(() => client.GetAllAnnotations("", "repo", 1));
                Assert.Throws <ArgumentException>(() => client.GetAllAnnotations("fake", "", 1));

                Assert.Throws <ArgumentException>(() => client.GetAllAnnotations("", "repo", 1, ApiOptions.None));
                Assert.Throws <ArgumentException>(() => client.GetAllAnnotations("fake", "", 1, ApiOptions.None));
            }
Exemplo n.º 2
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableCheckRunsClient(gitHubClient);

                client.GetAllAnnotations(1, 1);

                connection.Received().Get <List <CheckRunAnnotation> >(
                    Arg.Is <Uri>(u => u.ToString() == "repositories/1/check-runs/1/annotations"),
                    Args.EmptyDictionary,
                    "application/vnd.github.antiope-preview+json");
            }
Exemplo n.º 3
0
            public async Task RequestsCorrectUrlWithApiOptionsWithRepositoryId()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableCheckRunsClient(gitHubClient);

                var options = new ApiOptions {
                    PageSize = 1
                };

                client.GetAllAnnotations(1, 1, options);

                connection.Received().Get <List <CheckRunAnnotation> >(
                    Arg.Is <Uri>(u => u.ToString() == "repositories/1/check-runs/1/annotations"),
                    Arg.Is <Dictionary <string, string> >(x =>
                                                          x.Count == 1 &&
                                                          x["per_page"] == "1"),
                    "application/vnd.github.antiope-preview+json");
            }