示例#1
0
            public void Should_Return_Valid_Comment_Via_With_Specific_Comment_Type()
            {
                // Given, When
                var comment = new TfsComment("What's up?", true, CommentType.Text);

                // Then
                comment.ShouldNotBeNull();
                comment.Content.ShouldBe("What's up?");
                comment.IsDeleted.ShouldBeTrue();
                comment.CommentType.ShouldBe(TfsCommentType.Text);
            }
示例#2
0
            public void Should_Return_Empty_Comment()
            {
                // Given, When
                var comment = new TfsComment();

                // Then
                comment.ShouldNotBeNull();
                comment.Content.ShouldBe(default(string));
                comment.IsDeleted.ShouldBe(default(bool));
                comment.CommentType.ShouldBe(default(TfsCommentType));
            }
示例#3
0
            public void Should_Return_Valid_Comment_With_Default_Comment_Type()
            {
                // Given, When
                var comment = new TfsComment("Hello", false);

                // Then
                comment.ShouldNotBeNull();
                comment.Content.ShouldBe("Hello");
                comment.IsDeleted.ShouldBeFalse();
                comment.CommentType.ShouldBe(default(TfsCommentType));
            }
示例#4
0
            public void Should_Return_Valid_Comment_Via_Initializers()
            {
                // Given, When
                var comment = new TfsComment {
                    Content = "All good", IsDeleted = false, CommentType = TfsCommentType.CodeChange
                };

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

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

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

                TfsPullRequestCommentThread thread1 = threads.First();

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

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

                TfsComment comment11 = thread1.Comments.First();

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

                TfsComment comment12 = thread1.Comments.Last();

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

                TfsPullRequestCommentThread thread2 = threads.Last();

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