Exemplo n.º 1
0
            public void Should_Return_Empty_Comment_Thread()
            {
                // Given, When
                var thread            = new AzureDevOpsPullRequestCommentThread();
                var getCommentsResult = Record.Exception(() => thread.Comments);

                // Then
                thread.ShouldNotBeNull();
                thread.InnerThread.ShouldBeOfType(typeof(GitPullRequestCommentThread));
                thread.Id.ShouldBe(default(int));
                thread.FilePath.ShouldBeNull();
                thread.Status.ShouldBe(default(AzureDevOpsCommentThreadStatus));
                thread.Properties.ShouldBeNull();

                getCommentsResult.IsInvalidOperationException();
            }
Exemplo n.º 2
0
            public void Should_Return_Valid_Comment_Thread()
            {
                // Given
                var gitCommentThread = new GitPullRequestCommentThread
                {
                    Id            = 42,
                    Status        = CommentThreadStatus.Pending,
                    ThreadContext = new CommentThreadContext {
                        FilePath = "/src/myclass.cs"
                    },
                    Comments = new List <Comment> {
                        new Comment {
                            Content = "Hello", CommentType = CommentType.Text, IsDeleted = false
                        }
                    },
                    Properties = new PropertiesCollection(),
                };

                // When
                var azureDevOpsCommentThread = new AzureDevOpsPullRequestCommentThread(gitCommentThread);

                // Then
                azureDevOpsCommentThread.ShouldNotBeNull();
                azureDevOpsCommentThread.Id.ShouldBe(42);
                azureDevOpsCommentThread.Status.ShouldBe(AzureDevOpsCommentThreadStatus.Pending);
                azureDevOpsCommentThread.FilePath.ShouldNotBeNull();
                azureDevOpsCommentThread.FilePath.FullPath.ShouldBe("src/myclass.cs");

                azureDevOpsCommentThread.Comments.ShouldNotBeNull();
                azureDevOpsCommentThread.Comments.ShouldNotBeEmpty();
                azureDevOpsCommentThread.Comments.ShouldHaveSingleItem();
                azureDevOpsCommentThread.Comments.First().ShouldNotBeNull();
                azureDevOpsCommentThread.Comments.First().Content.ShouldBe("Hello");
                azureDevOpsCommentThread.Comments.First().CommentType.ShouldBe(AzureDevOpsCommentType.Text);
                azureDevOpsCommentThread.Comments.First().IsDeleted.ShouldBeFalse();

                azureDevOpsCommentThread.Properties.ShouldNotBeNull();
                azureDevOpsCommentThread.Properties.ShouldBeEmpty();
            }