Ejemplo n.º 1
0
        public void TestDoPullRequestRetrieval_GetsActivePullRequestsForTheProject()
        {
            var systemUnderTest = new TfProject(new TeamProject(), _tfsConnection, _logger);

            _tfsConnection.GetActivePullRequestsInProject(systemUnderTest).Returns(Enumerable.Empty <IPullRequest>());

            systemUnderTest.DoPullRequestRetrieval();

            _tfsConnection.Received().GetActivePullRequestsInProject(systemUnderTest);
        }
Ejemplo n.º 2
0
        public void TestDoPullRequestRetrieval_SetsPullRequestRetrievalStatusToOngoing()
        {
            var observedRetrievalStatus = RetrievalStatus.Unstarted;
            var systemUnderTest         = new TfProject(new TeamProject(), _tfsConnection, _logger);

            _tfsConnection.GetActivePullRequestsInProject(systemUnderTest).Returns(info =>
            {
                observedRetrievalStatus = systemUnderTest.PullRequestRetrievalStatus;
                return(Enumerable.Empty <IPullRequest>());
            });

            systemUnderTest.DoPullRequestRetrieval();

            Assert.That(observedRetrievalStatus, Is.EqualTo(RetrievalStatus.Ongoing));
        }
Ejemplo n.º 3
0
        public void TestApprovedPullRequestBecomingUnapprovedIsNotDuplicated()
        {
            var systemUnderTest = new TfProject(new TeamProject(), _tfsConnection, _logger);

            const int pullRequestId = 8793;
            var       pullRequest   = Substitute.For <IPullRequest>();

            pullRequest.Id.Returns(pullRequestId);
            pullRequest.IsApproved.Returns(false);
            systemUnderTest.Approved.AddOrUpdate(pullRequestId, pullRequest, (id, request) => request);
            _tfsConnection.GetActivePullRequestsInProject(systemUnderTest).Returns(new[] { pullRequest });

            systemUnderTest.DoPullRequestRetrieval();

            Assert.That(systemUnderTest.Approved.ContainsKey(pullRequestId), Is.False);
            Assert.That(systemUnderTest.Unapproved.ContainsKey(pullRequestId), Is.True);
        }