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); }
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)); }
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); }