예제 #1
0
            public void Should_Throw_If_Property_Collection_Is_Null()
            {
                // Given
                var azureDevOpsThread = new AzureDevOpsPullRequestCommentThread();

                // When
                var result = Record.Exception(() => azureDevOpsThread.SetValue("key", 1));

                // Then
                result.IsInvalidOperationException();
            }
예제 #2
0
            public void Should_Throw_If_Property_Name_Is_Empty()
            {
                // Given
                var azureDevOpsThread = new AzureDevOpsPullRequestCommentThread();

                // When
                var result = Record.Exception(() => azureDevOpsThread.SetValue(string.Empty, new object()));

                // Then
                result.IsArgumentOutOfRangeException("propertyName");
            }
예제 #3
0
            public void Should_Throw_If_Property_Name_Is_Null()
            {
                // Given
                var azureDevOpsThread = new AzureDevOpsPullRequestCommentThread();

                // When
                var result = Record.Exception(() => azureDevOpsThread.SetValue(null, string.Empty));

                // Then
                result.IsArgumentNullException("propertyName");
            }
예제 #4
0
            public void Should_Set_Valid_Properties()
            {
                // Given
                var azureDevOpsThread = new AzureDevOpsPullRequestCommentThread(
                    new GitPullRequestCommentThread
                {
                    Id         = 42,
                    Status     = CommentThreadStatus.Active,
                    Properties = new PropertiesCollection {
                        { "one", 1 }
                    },
                });

                // When
                azureDevOpsThread.SetValue("one", "string");
                azureDevOpsThread.SetValue("two", 2);

                // Then
                azureDevOpsThread.Properties.ShouldNotBeNull();
                azureDevOpsThread.Properties.ShouldNotBeEmpty();
                azureDevOpsThread.Properties.ShouldContainKeyAndValue("one", "string");
                azureDevOpsThread.Properties.ShouldContainKeyAndValue("two", 2);
            }
        /// <summary>
        /// Sets the comment identifier value used to identify the issue for which the comment was created.
        /// </summary>
        /// <param name="thread">Thread for which the value should be set.</param>
        /// <param name="value">Value to set as comment identifier.</param>
        public static void SetCommentIdentifier(this AzureDevOpsPullRequestCommentThread thread, string value)
        {
            thread.NotNull(nameof(thread));

            thread.SetValue(CommentIdentifierPropertyName, value);
        }
        /// <summary>
        /// Sets the provider type value used to identify specific provider origins later on when reading back existing issues.
        /// </summary>
        /// <param name="thread">Thread for which the value should be set.</param>
        /// <param name="value">Value to set as comment source.</param>
        public static void SetProviderType(this AzureDevOpsPullRequestCommentThread thread, string value)
        {
            thread.NotNull(nameof(thread));

            thread.SetValue(ProviderTypePropertyName, value);
        }
        /// <summary>
        /// Sets the original message of the issue as provided by Cake.Issues.PullRequests.
        /// </summary>
        /// <param name="thread">Thread for which the value should be set.</param>
        /// <param name="value">Value to set as the original message.</param>
        public static void SetIssueMessage(this AzureDevOpsPullRequestCommentThread thread, string value)
        {
            thread.NotNull(nameof(thread));

            thread.SetValue(IssueMessagePropertyName, value);
        }