Example #1
0
            public void Should_Throw_If_Target_Branch_Not_Found()
            {
                // Given
                var fixture =
                    new CreatePullRequestFixture(
                        BasePullRequestFixture.ValidAzureDevOpsServerUrl,
                        "testBranch",
                        "NotExistingBranch",
                        "test",
                        "test");

                // When
                var result =
                    Record.Exception(() => AzureDevOpsPullRequest.Create(fixture.Log, fixture.GitClientFactory, fixture.Settings));

                // Then
                result.IsAzureDevOpsBranchNotFoundException($"Branch not found \"NotExistingBranch\"");
            }
Example #2
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture =
                    new CreatePullRequestFixture(
                        BasePullRequestFixture.ValidAzureDevOpsServerUrl,
                        "testBranch",
                        "NotExistingBranch",
                        "test",
                        "test");
                AzureDevOpsCreatePullRequestSettings settings = null;

                // When
                var result =
                    Record.Exception(() => AzureDevOpsPullRequest.Create(fixture.Log, fixture.GitClientFactory, settings));

                // Then
                result.IsArgumentNullException("settings");
            }
Example #3
0
            public void Should_Throw_If_Log_Is_Null()
            {
                // Given
                var fixture =
                    new CreatePullRequestFixture(
                        BasePullRequestFixture.ValidAzureDevOpsServerUrl,
                        "testBranch",
                        "NotExistingBranch",
                        "test",
                        "test");
                ICakeLog log = null;

                // When
                var result =
                    Record.Exception(() => AzureDevOpsPullRequest.Create(log, fixture.GitClientFactory, fixture.Settings));

                // Then
                result.IsArgumentNullException("log");
            }
Example #4
0
            public void Should_Return_A_PullRequest_With_Fallback_To_Default_Target_Branch()
            {
                // Given
                var    sourceRefName = "testBranch";
                string targetRefName = null;
                var    title         = "foo";
                var    description   = "bar";
                var    fixture       =
                    new CreatePullRequestFixture(
                        BasePullRequestFixture.ValidAzureDevOpsServerUrl,
                        sourceRefName,
                        targetRefName,
                        title,
                        description);

                // When
                AzureDevOpsPullRequest.Create(fixture.Log, fixture.GitClientFactory, fixture.Settings);

                // Then
                // Return is a mocked pull request unrelated to the input values
            }