public static TfsPullRequest TfsPullRequestUsingTfsBuildOAuthToken( this ICakeContext context) { context.NotNull(nameof(context)); var settings = TfsPullRequestSettings.UsingTfsBuildOAuthToken(); return(TfsPullRequest(context, settings)); }
public static void TfsVotePullRequest( this ICakeContext context, TfsPullRequestSettings settings, TfsPullRequestVote vote) { context.NotNull(nameof(context)); settings.NotNull(nameof(settings)); new TfsPullRequest(context.Log, settings, new GitClientFactory()).Vote(vote); }
public static void TfsSetPullRequestStatus( this ICakeContext context, TfsPullRequestSettings settings, TfsPullRequestStatus status) { context.NotNull(nameof(context)); settings.NotNull(nameof(settings)); status.NotNull(nameof(status)); new TfsPullRequest(context.Log, settings, new GitClientFactory()).SetStatus(status); }
public void Should_Throw_If_Settings_Are_Null() { // Given TfsPullRequestSettings settings = null; // When var result = Record.Exception(() => new TfsPullRequestSettings(settings)); // Then result.IsArgumentNullException("settings"); }
public void Should_Throw_If_System_Access_Token_Env_Var_Is_Not_Set() { // Given Environment.SetEnvironmentVariable("BUILD_REPOSITORY_URI", "http://example.com"); Environment.SetEnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTID", "42"); // When var result = Record.Exception(() => TfsPullRequestSettings.UsingTfsBuildOAuthToken()); // Then result.IsInvalidOperationException(); }
public void Should_Throw_If_Pull_Request_Id_Env_Var_Is_Not_Set() { // Given Environment.SetEnvironmentVariable("BUILD_REPOSITORY_URI", "http://example.com"); Environment.SetEnvironmentVariable("SYSTEM_ACCESSTOKEN", "foo"); // When var result = Record.Exception(() => TfsPullRequestSettings.UsingTfsBuildOAuthToken()); // Then result.IsInvalidOperationException(); }
public void Should_Throw_If_Repository_Url_Env_Var_Is_Not_Set() { // Given Environment.SetEnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTID", "42"); Environment.SetEnvironmentVariable("SYSTEM_ACCESSTOKEN", "foo"); // When var result = Record.Exception(() => TfsPullRequestSettings.UsingTfsBuildOAuthToken()); // Then result.IsInvalidOperationException(); }
public void Should_Set_PullRequestId(int pullRequestId) { // Given var repositoryUrl = new Uri("http://example.com"); var credentials = AuthenticationProvider.AuthenticationNtlm(); // When var result = new TfsPullRequestSettings(repositoryUrl, pullRequestId, credentials); // Then result.PullRequestId.ShouldBe(pullRequestId); }
public void Should_Set_Repository_Url() { // Given var repositoryUrl = new Uri("http://example.com"); var sourceBranch = "foo"; var credentials = AuthenticationProvider.AuthenticationNtlm(); // When var result = new TfsPullRequestSettings(repositoryUrl, sourceBranch, credentials); // Then result.RepositoryUrl.ShouldBe(repositoryUrl); }
public void Should_Set_Pull_Request_Id() { // Given Environment.SetEnvironmentVariable("BUILD_REPOSITORY_URI", "http://example.com"); Environment.SetEnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTID", "42"); Environment.SetEnvironmentVariable("SYSTEM_ACCESSTOKEN", "foo"); // When var settings = TfsPullRequestSettings.UsingTfsBuildOAuthToken(); // Then settings.PullRequestId.ShouldBe(42); }
public void Should_Set_SourceRefName() { // Given var repositoryUrl = new Uri("http://example.com"); var sourceRefName = "foo"; var credentials = AuthenticationProvider.AuthenticationNtlm(); // When var result = new TfsPullRequestSettings(repositoryUrl, sourceRefName, credentials); // Then result.SourceRefName.ShouldBe(sourceRefName); }
public void Should_Set_Pull_Request_Id() { // Given var creds = new TfsNtlmCredentials(); Environment.SetEnvironmentVariable("BUILD_REPOSITORY_URI", "http://example.com"); Environment.SetEnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTID", "42"); // When var settings = new TfsPullRequestSettings(creds); // Then settings.PullRequestId.ShouldBe(42); }
public void Should_Set_Credentials() { // Given var repositoryUrl = new Uri("http://example.com"); var pullRequestId = 41; var credentials = AuthenticationProvider.AuthenticationNtlm(); var settings = new TfsPullRequestSettings(repositoryUrl, pullRequestId, credentials); // When var result = new TfsPullRequestSettings(settings); // Then result.Credentials.ShouldBe(credentials); }
public static TfsPullRequest TfsPullRequest( this ICakeContext context, TfsPullRequestSettings settings) { context.NotNull(nameof(context)); settings.NotNull(nameof(settings)); var pullRequest = new TfsPullRequest(context.Log, settings, new GitClientFactory()); if (pullRequest.HasPullRequestLoaded) { return(pullRequest); } return(null); }
public void Should_Set_ThrowExceptionIfPullRequestCouldNotBeFound(bool value) { // Given var repositoryUrl = new Uri("http://example.com"); var pullRequestId = 41; var credentials = AuthenticationProvider.AuthenticationNtlm(); var settings = new TfsPullRequestSettings(repositoryUrl, pullRequestId, credentials) { ThrowExceptionIfPullRequestCouldNotBeFound = value, }; // When var result = new TfsPullRequestSettings(settings); // Then result.ThrowExceptionIfPullRequestCouldNotBeFound.ShouldBe(value); }
/// <summary> /// Initializes a new instance of the <see cref="TfsPullRequestSystemSettings"/> class /// based on the instance of a <see cref="TfsPullRequestSettings"/> class. /// </summary> /// <param name="settings">Settings containing the parameters.</param> public TfsPullRequestSystemSettings(TfsPullRequestSettings settings) : base(settings) { }