예제 #1
0
        public static TfsPullRequest TfsPullRequestUsingTfsBuildOAuthToken(
            this ICakeContext context)
        {
            context.NotNull(nameof(context));

            var settings = TfsPullRequestSettings.UsingTfsBuildOAuthToken();

            return(TfsPullRequest(context, settings));
        }
            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_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_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_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);
            }