public void Should_Return_Empty_Comment_Thread() { // Given, When var thread = new TfsPullRequestCommentThread(); 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(TfsCommentThreadStatus)); thread.Properties.ShouldBeNull(); getCommentsResult.IsInvalidOperationException(); }
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 tfsCommentThread = new TfsPullRequestCommentThread(gitCommentThread); // Then tfsCommentThread.ShouldNotBeNull(); tfsCommentThread.Id.ShouldBe(42); tfsCommentThread.Status.ShouldBe(TfsCommentThreadStatus.Pending); tfsCommentThread.FilePath.ShouldNotBeNull(); tfsCommentThread.FilePath.FullPath.ShouldBe("src/myclass.cs"); tfsCommentThread.Comments.ShouldNotBeNull(); tfsCommentThread.Comments.ShouldNotBeEmpty(); tfsCommentThread.Comments.ShouldHaveSingleItem(); tfsCommentThread.Comments.First().ShouldNotBeNull(); tfsCommentThread.Comments.First().Content.ShouldBe("Hello"); tfsCommentThread.Comments.First().CommentType.ShouldBe(TfsCommentType.Text); tfsCommentThread.Comments.First().IsDeleted.ShouldBeFalse(); tfsCommentThread.Properties.ShouldNotBeNull(); tfsCommentThread.Properties.ShouldBeEmpty(); }