public void Should_Throw_If_Tfs_Pull_Request_Status_Is_Null() { // Given var fixture = new PullRequestFixture(BasePullRequestFixture.ValidTfsUrl, 16); var pullRequest = new TfsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory); // When var result = Record.Exception(() => pullRequest.SetStatus(null)); // Then result.IsArgumentNullException("status"); }
public void Should_Set_Valid_Status_On_Tfs_Pull_Request() { // Given var fixture = new PullRequestFixture(BasePullRequestFixture.ValidTfsUrl, 16); var pullRequest = new TfsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory); var status = new TfsPullRequestStatus("Hello") { State = TfsPullRequestStatusState.Succeeded }; // When pullRequest.SetStatus(status); // Then // ?? Nothing to validate here since the method returns void }
public void Should_Throw_If_Tfs_Pull_Request_State_Is_Invalid() { // Given var fixture = new PullRequestFixture(BasePullRequestFixture.ValidTfsUrl, 16); var pullRequest = new TfsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory); var status = new TfsPullRequestStatus("whatever") { State = (TfsPullRequestStatusState)123 }; // When var result = Record.Exception(() => pullRequest.SetStatus(status)); // Then result.ShouldNotBe(null); result.IsExpected("SetStatus"); result.Message.ShouldBe("Unknown value"); }
public void Should_Throw_If_Null_Is_Returned_On_Tfs_Pull_Request() { // Given var fixture = new PullRequestFixture(BasePullRequestFixture.ValidTfsUrl, 16) { GitClientFactory = new FakeNullForMethodsGitClientFactory(), }; var pullRequest = new TfsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory); var status = new TfsPullRequestStatus("One") { State = TfsPullRequestStatusState.Failed }; // When var result = Record.Exception(() => pullRequest.SetStatus(status)); // Then result.ShouldNotBe(null); result.IsExpected("SetStatus"); result.IsTfsPullRequestNotFoundException(); }