Exemplo n.º 1
0
            public void GetsFromCorrectUrl()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableGitHubAppInstallationsClient(gitHubClient);

                client.GetAllRepositoriesForCurrentUser(1234);

                connection.Received().Get <List <RepositoriesResponse> >(
                    Arg.Is <Uri>(u => u.ToString() == "user/installations/1234/repositories"),
                    Args.EmptyDictionary,
                    "application/vnd.github.machine-man-preview+json");
            }
Exemplo n.º 2
0
            public void GetsFromCorrectUrllWithApiOptions()
            {
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableGitHubAppInstallationsClient(gitHubClient);

                var options = new ApiOptions
                {
                    PageSize = 1
                };

                client.GetAllRepositoriesForCurrentUser(1234, options);

                connection.Received().Get <List <RepositoriesResponse> >(
                    Arg.Is <Uri>(u => u.ToString() == "user/installations/1234/repositories"),
                    Arg.Is <Dictionary <string, string> >(x =>
                                                          x.Count == 1 &&
                                                          x["per_page"] == "1"),
                    "application/vnd.github.machine-man-preview+json");
            }