Exemplo n.º 1
0
            public void Should_Throw_If_Target_Branch_Not_Found()
            {
                // Given
                var fixture =
                    new CreatePullRequestFixture(
                        BasePullRequestFixture.ValidTfsUrl,
                        "testBranch",
                        "NotExistingBranch",
                        "test",
                        "test");

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

                // Then
                result.IsTfsBranchNotFoundException($"Branch not found \"NotExistingBranch\"");
            }
Exemplo n.º 2
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture =
                    new CreatePullRequestFixture(
                        BasePullRequestFixture.ValidTfsUrl,
                        "testBranch",
                        "NotExistingBranch",
                        "test",
                        "test");
                TfsCreatePullRequestSettings settings = null;

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

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

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

                // Then
                result.IsArgumentNullException("log");
            }
Exemplo n.º 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.ValidTfsUrl,
                        sourceRefName,
                        targetRefName,
                        title,
                        description);

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

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