コード例 #1
0
            public void EnsuresNonEmptyArguments()
            {
                var githubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryPagesClient(githubClient);

                Assert.Throws<ArgumentException>(() => client.GetAll("", "repo", new ApiOptions()));
                Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", new ApiOptions()));
            }
コード例 #2
0
            public void RequestsCorrectUrl()
            {
                var githubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryPagesClient(githubClient);
                var options = new ApiOptions();

                client.GetAll("fake", "repo", options);
                githubClient.Received().Repository.Page.GetAll("fake", "repo", options);
            }
コード例 #3
0
            public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryPagesClient(gitHubClient);

                client.GetAll(1);

                gitHubClient.Received().Repository.Page.GetAll(1);
            }
コード例 #4
0
            public void RequestsCorrectUrlWithApiOptionsWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryPagesClient(gitHubClient);

                var options = new ApiOptions
                {
                    PageCount = 1,
                    StartPage = 1,
                    PageSize = 1
                };

                client.GetAll(1, options);

                gitHubClient.Received().Repository.Page.GetAll(1, options);
            }
コード例 #5
0
            public void EnsuresNonNullArguments()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryPagesClient(gitHubClient);

                Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "repo", ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "repo", null));

                Assert.Throws<ArgumentNullException>(() => client.GetAll(1, null));

                Assert.Throws<ArgumentException>(() => client.GetAll("", "repo", ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", ApiOptions.None));
            }