public async Task EnsuresNonNullArguments()
            {
                var client = new ObservableMilestonesClient(Substitute.For <IGitHubClient>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(null, "name", 1).ToTask());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get("owner", null, 1).ToTask());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(null, "", 1).ToTask());

                await Assert.ThrowsAsync <ArgumentException>(() => client.Get("", null, 1).ToTask());
            }
            public void GetsFromClientIssueMilestone()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableMilestonesClient(gitHubClient);

                client.Get("fake", "repo", 42);

                gitHubClient.Issue.Milestone.Received().Get("fake", "repo", 42);
            }
            public void GetsFromClientIssueMilestoneWithRepositoryId()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableMilestonesClient(gitHubClient);

                client.Get(1, 42);

                gitHubClient.Issue.Milestone.Received().Get(1, 42);
            }
            public async Task ReturnsSpecifiedMilestone()
            {
                var github = Helper.GetAuthenticatedClient();

                var client     = new ObservableMilestonesClient(github);
                var observable = client.Get("libgit2", "libgit2sharp", 1);
                var milestone  = await observable;

                Assert.Equal(1, milestone.Number);
                Assert.Equal("v0.4.0", milestone.Title);
                Assert.Equal(7, milestone.ClosedIssues);
            }
Ejemplo n.º 5
0
            public async Task ReturnsSpecifiedMilestone()
            {
                var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
                {
                    Credentials = Helper.Credentials
                };
                var client     = new ObservableMilestonesClient(github);
                var observable = client.Get("libgit2", "libgit2sharp", 1);
                var milestone  = await observable;

                Assert.Equal(1, milestone.Number);
                Assert.Equal("v0.4.0", milestone.Title);
                Assert.Equal(7, milestone.ClosedIssues);
            }