public void Should_Set_Correct_Id() { // Given var id = 123; var status = CommentThreadStatus.Active; var filePath = "/foo.cs"; var thread = new GitPullRequestCommentThread { Id = id, Status = status, ThreadContext = new CommentThreadContext() { FilePath = filePath }, Comments = new List <Comment>(), Properties = new PropertiesCollection() }; // When var result = thread.ToPullRequestDiscussionThread(); // Then result.Id.ShouldBe(id); }
public void Should_Throw_If_Thread_Is_Null() { // Given GitPullRequestCommentThread thread = null; // When var result = Record.Exception(() => thread.ToPullRequestDiscussionThread()); // Then result.IsArgumentNullException("thread"); }
public void Should_Set_Correct_FilePath_If_ThreadContext_Is_Null() { // Given var thread = new GitPullRequestCommentThread { Id = 123, Status = CommentThreadStatus.Active, ThreadContext = null, Comments = new List <Comment>(), Properties = new PropertiesCollection() }; // When var result = thread.ToPullRequestDiscussionThread(); // Then result.AffectedFileRelativePath.ShouldBeNull(); }
public void Should_Throw_If_Properties_Are_Null() { // Given var thread = new GitPullRequestCommentThread { Id = 123, Status = CommentThreadStatus.Active, ThreadContext = new CommentThreadContext { FilePath = "/foo.cs" }, Comments = new List <Comment>(), Properties = null }; // When var result = Record.Exception(() => thread.ToPullRequestDiscussionThread()); // Then result.IsInvalidOperationException("Properties collection is not created."); }
public void Should_Set_Correct_Comments() { // Given var id = 123; var status = CommentThreadStatus.Active; var filePath = "/foo.cs"; var commentContent = "foo"; var commentIsDeleted = false; var thread = new GitPullRequestCommentThread { Id = id, Status = status, ThreadContext = new CommentThreadContext() { FilePath = filePath }, Comments = new List <Comment> { new Comment() { Content = commentContent, IsDeleted = commentIsDeleted } }, Properties = new PropertiesCollection() }; // When var result = thread.ToPullRequestDiscussionThread(); // Then result.Comments.Count.ShouldBe(1); result.Comments.Single().Content.ShouldBe(commentContent); result.Comments.Single().IsDeleted.ShouldBe(commentIsDeleted); }
public void Should_Set_Correct_FilePath(string filePath, string expectedResult) { // Given var id = 123; var status = CommentThreadStatus.Active; var thread = new GitPullRequestCommentThread { Id = id, Status = status, ThreadContext = new CommentThreadContext() { FilePath = filePath }, Comments = new List <Comment>(), Properties = new PropertiesCollection() }; // When var result = thread.ToPullRequestDiscussionThread(); // Then result.AffectedFileRelativePath.ToString().ShouldBe(expectedResult); }