public void Should_Return_Valid_Comment_With_Default_Comment_Type()
            {
                // Given, When
                var comment = new AzureDevOpsComment("Hello", false);

                // Then
                comment.ShouldNotBeNull();
                comment.Content.ShouldBe("Hello");
                comment.IsDeleted.ShouldBeFalse();
                comment.CommentType.ShouldBe(default(AzureDevOpsCommentType));
            }
            public void Should_Return_Empty_Comment()
            {
                // Given, When
                var comment = new AzureDevOpsComment();

                // Then
                comment.ShouldNotBeNull();
                comment.Content.ShouldBe(default(string));
                comment.IsDeleted.ShouldBe(default(bool));
                comment.CommentType.ShouldBe(default(AzureDevOpsCommentType));
            }
            public void Should_Return_Valid_Comment_Via_Initializers()
            {
                // Given, When
                var comment = new AzureDevOpsComment {
                    Content = "All good", IsDeleted = false, CommentType = AzureDevOpsCommentType.CodeChange
                };

                // Then
                comment.ShouldNotBeNull();
                comment.Content.ShouldBe("All good");
                comment.IsDeleted.ShouldBeFalse();
                comment.CommentType.ShouldBe(AzureDevOpsCommentType.CodeChange);
            }
Example #4
0
            public void Should_Return_Valid_Comment_Threads()
            {
                // Given
                var fixture     = new PullRequestFixture(BasePullRequestFixture.ValidAzureDevOpsUrl, 44);
                var pullRequest = new AzureDevOpsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory);

                // When
                var threads = pullRequest.GetCommentThreads();

                // Then
                threads.ShouldNotBeNull();
                threads.ShouldNotBeEmpty();
                threads.Count().ShouldBe(2);

                AzureDevOpsPullRequestCommentThread thread1 = threads.First();

                thread1.Id.ShouldBe(11);
                thread1.Status.ShouldBe(AzureDevOpsCommentThreadStatus.Active);
                thread1.FilePath.ShouldNotBeNull();
                thread1.FilePath.FullPath.ShouldBe("some/path/to/file.cs");

                thread1.Comments.ShouldNotBeNull();
                thread1.Comments.ShouldNotBeEmpty();
                thread1.Comments.Count().ShouldBe(2);

                AzureDevOpsComment comment11 = thread1.Comments.First();

                comment11.ShouldNotBeNull();
                comment11.Content.ShouldBe("Hello");
                comment11.IsDeleted.ShouldBe(false);
                comment11.CommentType.ShouldBe(AzureDevOpsCommentType.CodeChange);

                AzureDevOpsComment comment12 = thread1.Comments.Last();

                comment12.ShouldNotBeNull();
                comment12.Content.ShouldBe("Goodbye");
                comment12.IsDeleted.ShouldBe(true);
                comment12.CommentType.ShouldBe(AzureDevOpsCommentType.Text);

                AzureDevOpsPullRequestCommentThread thread2 = threads.Last();

                thread2.Id.ShouldBe(22);
                thread2.Status.ShouldBe(AzureDevOpsCommentThreadStatus.Fixed);
                thread2.FilePath.ShouldBeNull();
                thread2.Comments.ShouldNotBeNull();
                thread2.Comments.ShouldBeEmpty();
            }