示例#1
0
            public void Should_Call_InternalFetchDiscussionThreads()
            {
                // Given
                var log = new FakeLog();
                var pullRequestSystem = new FakePullRequestSystem(log);
                var settings          = new ReportIssuesToPullRequestSettings(@"c:\repo");
                var discussionThreads =
                    new List <IPullRequestDiscussionThread>
                {
                    new PullRequestDiscussionThread(
                        1,
                        PullRequestDiscussionStatus.Active,
                        new FilePath(@"src\Cake.Issues.Tests\FakeIssueProvider.cs"),
                        new List <IPullRequestDiscussionComment>
                    {
                        new PullRequestDiscussionComment()
                        {
                            Content   = "Message Foo",
                            IsDeleted = false
                        }
                    })
                    {
                        CommentSource = settings.CommentSource,
                    }
                };
                var capability = new FakeDiscussionThreadsCapability(log, pullRequestSystem, discussionThreads);

                // When
                pullRequestSystem.Initialize(settings);
                var result = capability.FetchDiscussionThreads(settings.CommentSource);

                // Then
                result.ShouldBe(discussionThreads);
            }
示例#2
0
            public void Should_Throw_If_Not_Initialized()
            {
                // Given
                var log = new FakeLog();
                var pullRequestSystem = new FakePullRequestSystem(log);
                var discussionThreads = new List <IPullRequestDiscussionThread>();
                var capability        = new FakeDiscussionThreadsCapability(log, pullRequestSystem, discussionThreads);

                // When
                var result =
                    Record.Exception(() =>
                                     capability.FetchDiscussionThreads("foo"));

                // Then
                result.IsInvalidOperationException("Initialize needs to be called first.");
            }