コード例 #1
0
            public void Should_Throw_If_BuildId_Is_Negative(int buildId)
            {
                // Given
                var collectionUrl = new Uri("http://example.com/collection");
                var projectGuid = Guid.NewGuid();
                var credentials = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new AzureDevOpsBuildSettings(collectionUrl, projectGuid, buildId, credentials));

                // Then
                result.IsArgumentOutOfRangeException("buildId");
            }
コード例 #2
0
            public void Should_Throw_If_RepositoryUrl_Is_Null()
            {
                // Given
                Uri repositoryUrl = null;
                var sourceBranch  = "foo";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new AzureDevOpsPullRequestSettings(repositoryUrl, sourceBranch, credentials));

                // Then
                result.IsArgumentNullException("repositoryUrl");
            }
                public void Should_Set_Credentials()
                {
                    // Given
                    var collectionUrl = new Uri("http://example.com/collection");
                    var projectGuid   = Guid.NewGuid();
                    var credentials   = AuthenticationProvider.AuthenticationNtlm();

                    // When
                    var result = new BaseAzureDevOpsProjectSettingsImpl(collectionUrl, projectGuid, credentials);

                    // Then
                    result.Credentials.ShouldBe(credentials);
                }
コード例 #4
0
            public void Should_Set_ProjectGuid()
            {
                // Given
                var collectionUrl = new Uri("http://example.com/collection");
                var projectGuid   = Guid.NewGuid();
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = new AzureDevOpsBuildsSettings(collectionUrl, projectGuid, credentials);

                // Then
                result.ProjectGuid.ShouldBe(projectGuid);
            }
                public void Should_Throw_If_CollectionUrl_Is_Null()
                {
                    // Given
                    Uri collectionUrl = null;
                    var projectGuid   = Guid.NewGuid();
                    var credentials   = AuthenticationProvider.AuthenticationNtlm();

                    // When
                    var result = Record.Exception(() => new BaseAzureDevOpsProjectSettingsImpl(collectionUrl, projectGuid, credentials));

                    // Then
                    result.IsArgumentNullException("collectionUrl");
                }
コード例 #6
0
            public void Should_Set_Credentials()
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var pullRequestId = 41;
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = new TfsPullRequestSettings(repositoryUrl, pullRequestId, credentials);

                // Then
                result.Credentials.ShouldBe(credentials);
            }
コード例 #7
0
            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_Collection_Url()
                {
                    // Given
                    var collectionUrl = new Uri("http://example.com/collection");
                    var projectName   = "MyProject";
                    var credentials   = AuthenticationProvider.AuthenticationNtlm();

                    // When
                    var result = new BaseAzureDevOpsProjectSettingsImpl(collectionUrl, projectName, credentials);

                    // Then
                    result.CollectionUrl.ShouldBe(collectionUrl);
                }
                public void Should_Throw_If_ProjectGuid_Is_Empty()
                {
                    // Given
                    var collectionUrl = new Uri("http://example.com/collection");
                    var projectGuid   = Guid.Empty;
                    var credentials   = AuthenticationProvider.AuthenticationNtlm();

                    // When
                    var result = Record.Exception(() => new BaseAzureDevOpsProjectSettingsImpl(collectionUrl, projectGuid, credentials));

                    // Then
                    result.IsArgumentOutOfRangeException("projectGuid");
                }
コード例 #10
0
            public void Should_Throw_If_SourceRefName_Is_WhiteSpace()
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var sourceRefName = " ";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new TfsPullRequestSettings(repositoryUrl, sourceRefName, credentials));

                // Then
                result.IsArgumentOutOfRangeException("sourceRefName");
            }
コード例 #11
0
            public void Should_Throw_If_RepositoryUrl_Is_Null()
            {
                // Given
                Uri repositoryUrl = null;
                var pullRequestId = 41;
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new TfsPullRequestSettings(repositoryUrl, pullRequestId, credentials));

                // Then
                result.IsArgumentNullException("repositoryUrl");
            }
コード例 #12
0
            public void Should_Set_PullRequestId(int pullRequestId)
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var credentials   = AuthenticationProvider.AuthenticationNtlm();
                var settings      = new TfsPullRequestSettings(repositoryUrl, pullRequestId, credentials);

                // When
                var result = new TfsPullRequestSettings(settings);

                // Then
                result.PullRequestId.ShouldBe(pullRequestId);
            }
コード例 #13
0
            public void Should_Throw_If_PullRequestId_Is_Zero()
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var pullRequestId = 0;
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new TfsPullRequestSettings(repositoryUrl, pullRequestId, credentials));

                // Then
                result.IsArgumentOutOfRangeException("pullRequestId");
            }
                public void Should_Throw_If_ProjectName_Is_Null()
                {
                    // Given
                    var    collectionUrl = new Uri("http://example.com/collection");
                    string projectName   = null;
                    var    credentials   = AuthenticationProvider.AuthenticationNtlm();

                    // When
                    var result = Record.Exception(() => new BaseAzureDevOpsProjectSettingsImpl(collectionUrl, projectName, credentials));

                    // Then
                    result.IsArgumentNullException("projectName");
                }
コード例 #15
0
            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);
            }
コード例 #16
0
            public void Should_Set_Credentials()
            {
                // Given
                var collectionUrl = new Uri("http://example.com/collection");
                var projectName   = "MyProject";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = new AzureDevOpsBuildsSettings(collectionUrl, projectName, credentials);

                // Then
                result.Credentials.ShouldBe(credentials);
            }
コード例 #17
0
            public void Should_Throw_If_ProjectName_Is_WhiteSpace()
            {
                // Given
                var collectionUrl = new Uri("http://example.com/collection");
                var projectName   = " ";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new AzureDevOpsBuildsSettings(collectionUrl, projectName, credentials));

                // Then
                result.IsArgumentOutOfRangeException("projectName");
            }
コード例 #18
0
            public void Should_Throw_If_CollectionUrl_Is_Null()
            {
                // Given
                Uri collectionUrl = null;
                var projectName   = "MyProject";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new AzureDevOpsBuildsSettings(collectionUrl, projectName, credentials));

                // Then
                result.IsArgumentNullException("collectionUrl");
            }
コード例 #19
0
            public void Should_Throw_If_SourceRefName_Is_Null()
            {
                // Given
                var    repositoryUrl = new Uri("http://example.com");
                string sourceRefName = null;
                var    credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result = Record.Exception(() => new AzureDevOpsPullRequestSettings(repositoryUrl, sourceRefName, credentials));

                // Then
                result.IsArgumentNullException("sourceRefName");
            }
コード例 #20
0
            public void Should_Set_Repository_Url()
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var pullRequestId = 41;
                var credentials   = AuthenticationProvider.AuthenticationNtlm();
                var settings      = new AzureDevOpsPullRequestSettings(repositoryUrl, pullRequestId, credentials);

                // When
                var result = new AzureDevOpsPullRequestSettings(settings);

                // Then
                result.RepositoryUrl.ShouldBe(repositoryUrl);
            }
コード例 #21
0
            public void Should_Set_ProjectName()
            {
                // Given
                var collectionUrl = new Uri("http://example.com/collection");
                var projectName = "MyProject";
                var buildId = 42;
                var credentials = AuthenticationProvider.AuthenticationNtlm();
                var settings = new AzureDevOpsBuildSettings(collectionUrl, projectName, buildId, credentials);

                // When
                var result = new AzureDevOpsBuildSettings(settings);

                // Then
                result.ProjectName.ShouldBe(projectName);
            }
コード例 #22
0
            public void Should_Set_Collection_Url()
            {
                // Given
                var collectionUrl = new Uri("http://example.com/collection");
                var projectGuid = Guid.NewGuid();
                var buildId = 42;
                var credentials = AuthenticationProvider.AuthenticationNtlm();
                var settings = new AzureDevOpsBuildSettings(collectionUrl, projectGuid, buildId, credentials);

                // When
                var result = new AzureDevOpsBuildSettings(settings);

                // Then
                result.CollectionUrl.ShouldBe(collectionUrl);
            }
            public void Should_Set_Description(string description)
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var sourceRefName = "foo";
                var targetRefName = "master";
                var title         = "foo";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result =
                    new AzureDevOpsCreatePullRequestSettings(repositoryUrl, sourceRefName, targetRefName, title, description, credentials);

                // Then
                result.Description.ShouldBe(description);
            }
コード例 #24
0
            public void Should_Set_TargetRefName(string targetRefName)
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var sourceRefName = "foo";
                var title         = "foo";
                var description   = "bar";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result =
                    new TfsCreatePullRequestSettings(repositoryUrl, sourceRefName, targetRefName, title, description, credentials);

                // Then
                result.TargetRefName.ShouldBe(targetRefName);
            }
コード例 #25
0
            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);
            }
            public void Should_Throw_If_Title_Is_Null()
            {
                // Given
                var    repositoryUrl = new Uri("http://example.com");
                var    sourceRefName = "foo";
                var    targetRefName = "master";
                string title         = null;
                var    description   = "bar";
                var    credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result =
                    Record.Exception(() =>
                                     new AzureDevOpsCreatePullRequestSettings(repositoryUrl, sourceRefName, targetRefName, title, description, credentials));

                // Then
                result.IsArgumentNullException("title");
            }
コード例 #27
0
            public void Should_Set_ThrowExceptionIfBuildCouldNotBeFound(bool value)
            {
                // Given
                var collectionUrl = new Uri("http://example.com/collection");
                var projectName = "MyProject";
                var buildId = 42;
                var credentials = AuthenticationProvider.AuthenticationNtlm();
                var settings = new AzureDevOpsBuildSettings(collectionUrl, projectName, buildId, credentials)
                {
                    ThrowExceptionIfBuildCouldNotBeFound = value,
                };

                // When
                var result = new AzureDevOpsBuildSettings(settings);

                // Then
                result.ThrowExceptionIfBuildCouldNotBeFound.ShouldBe(value);
            }
コード例 #28
0
            public void Should_Throw_If_RepositoryUrl_Is_Null()
            {
                // Given
                Uri repositoryUrl = null;
                var sourceRefName = "foo";
                var targetRefName = "master";
                var title         = "foo";
                var description   = "bar";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result =
                    Record.Exception(() =>
                                     new TfsCreatePullRequestSettings(repositoryUrl, sourceRefName, targetRefName, title, description, credentials));

                // Then
                result.IsArgumentNullException("repositoryUrl");
            }
コード例 #29
0
            public void Should_Throw_If_SourceRefName_Is_Empty()
            {
                // Given
                var repositoryUrl = new Uri("http://example.com");
                var sourceRefName = string.Empty;
                var targetRefName = "master";
                var title         = "foo";
                var description   = "bar";
                var credentials   = AuthenticationProvider.AuthenticationNtlm();

                // When
                var result =
                    Record.Exception(() =>
                                     new TfsCreatePullRequestSettings(repositoryUrl, sourceRefName, targetRefName, title, description, credentials));

                // Then
                result.IsArgumentOutOfRangeException("sourceRefName");
            }