public void CreatesReleaseNotesForClosedGitHubIssues()
        {
            issuesClient
            .GetForRepository("Org", "Repo", Arg.Any <RepositoryIssueRequest>())
            .Returns(Task.FromResult <IReadOnlyList <Issue> >(new List <Issue>
            {
                new Issue
                {
                    Number      = 1,
                    Title       = "Issue Title",
                    Labels      = new Collection <Label>(),
                    ClosedAt    = DateTimeOffset.Now,
                    PullRequest = new PullRequest(),
                    User        = new User
                    {
                        Login   = "******",
                        Name    = "Foo",
                        HtmlUrl = "http://github.com/foo"
                    }
                }
            }.AsReadOnly()));

            var closedIssues = sut.GetClosedIssues(DateTimeOffset.Now.AddDays(-2));
            var onlineIssue  = closedIssues.Single();

            onlineIssue.Title.ShouldBe("Issue Title");
            onlineIssue.Id.ShouldBe("#1");
            onlineIssue.Contributors.ShouldContain(c => c.Username == "User" && c.Name == "Foo" && c.Url == "http://github.com/foo");
        }
Ejemplo n.º 2
0
    public async Task CanCreateRetrieveAndCloseIssue()
    {
        string owner = _repository.Owner.Login;

        var newIssue = new NewIssue("a test issue")
        {
            Body = "A new unassigned issue"
        };
        var issue = await _issuesClient.Create(owner, _repository.Name, newIssue);

        try
        {
            Assert.NotNull(issue);

            var retrieved = await _issuesClient.Get(owner, _repository.Name, issue.Number);

            var all = await _issuesClient.GetForRepository(owner, _repository.Name);

            Assert.NotNull(retrieved);
            Assert.True(all.Any(i => i.Number == retrieved.Number));
        }
        finally
        {
            var closed = _issuesClient.Update(owner, _repository.Name, issue.Number,
                                              new IssueUpdate {
                State = ItemState.Closed
            })
                         .Result;
            Assert.NotNull(closed);
        }
    }
        public void CreatesReleaseNotesForClosedGitHubIssues()
        {
            issuesClient
            .GetForRepository("Org", "Repo", Arg.Any <RepositoryIssueRequest>())
            .Returns(Task.FromResult <IReadOnlyList <Issue> >(new List <Issue>
            {
                new Issue(null, null, 1, ItemState.Closed, "Issue Title", string.Empty, new TestUser("User", "Foo", "http://github.com/name"),
                          new Collection <Label>(), null, null, 0, new PullRequest(), DateTimeOffset.Now, DateTimeOffset.Now, DateTimeOffset.Now)
            }.AsReadOnly()));

            var closedIssues = sut.GetClosedIssues(new GitHubContext(), DateTimeOffset.Now.AddDays(-2));
            var onlineIssue  = closedIssues.Single();

            onlineIssue.Title.ShouldBe("Issue Title");
            onlineIssue.Id.ShouldBe("#1");
            onlineIssue.Contributors.ShouldContain(c => c.Username == "User" && c.Name == "Foo" && c.Url == "http://github.com/name");
        }