public async Task EnsuresNonNullArguments() { var client = new ObservableMilestonesClient(Substitute.For<IGitHubClient>()); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", 1)); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, 1)); await AssertEx.Throws<ArgumentException>(async () => await client.Get(null, "", 1)); await AssertEx.Throws<ArgumentException>(async () => await client.Get("", null, 1)); }
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 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); }