public void Should_Return_Null_Azure_DevOps_Pull_Request_By_Branch() { // Given var fixture = new PullRequestFixture(BasePullRequestFixture.ValidAzureDevOpsUrl, "somebranch") { GitClientFactory = new FakeNullGitClientFactory(), Settings = { ThrowExceptionIfPullRequestCouldNotBeFound = false }, }; // When var pullRequest = new TfsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory); // Then pullRequest.ShouldNotBe(null); pullRequest.HasPullRequestLoaded.ShouldBe(false); pullRequest.RepositoryName.ShouldBe("MyRepoName"); pullRequest.CollectionName.ShouldBe("DefaultCollection"); pullRequest.ProjectName.ShouldBe("MyProject"); pullRequest.PullRequestId.ShouldBe(0); pullRequest.PullRequestStatus.ShouldBe(TfsPullRequestState.NotSet); pullRequest.CodeReviewId.ShouldBe(0); pullRequest.SourceRefName.ShouldBeEmpty(); pullRequest.TargetRefName.ShouldBeEmpty(); pullRequest.LastSourceCommitId.ShouldBeEmpty(); pullRequest.LastTargetCommitId.ShouldBeEmpty(); }
public void Should_Return_Valid_Azure_DevOps_Pull_Request_By_Source_Branch() { // Given var fixture = new PullRequestFixture(BasePullRequestFixture.ValidAzureDevOpsUrl, "feature"); // When var pullRequest = new TfsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory); // Then pullRequest.ShouldNotBe(null); pullRequest.HasPullRequestLoaded.ShouldBe(true); pullRequest.PullRequestId.ShouldBe(777); pullRequest.PullRequestStatus.ShouldBe(TfsPullRequestState.Active); pullRequest.RepositoryName.ShouldBe("MyRepoName"); pullRequest.CollectionName.ShouldBe("DefaultCollection"); pullRequest.CodeReviewId.ShouldBe(123); pullRequest.ProjectName.ShouldBe("MyProject"); pullRequest.SourceRefName.ShouldBe("feature"); pullRequest.TargetRefName.ShouldBe("master"); pullRequest.LastSourceCommitId.ShouldBe("4a92b977"); pullRequest.LastTargetCommitId.ShouldBe("78a3c113"); }