This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
test/GitHub.InlineReviews.UnitTests/Services Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -644,6 +644,36 @@ public async Task CommitShaIsUpdatedOnTextChange()
644644 Assert . Null ( file . CommitSha ) ;
645645 }
646646
647+ [ Fact ]
648+ public async Task UpdatingCurrentSessionPullRequestTriggersLinesChanged ( )
649+ {
650+ var textView = CreateTextView ( ) ;
651+ var sessionService = CreateSessionService ( ) ;
652+ var expectedLineNumber = 2 ;
653+ var threads = new [ ]
654+ {
655+ CreateInlineCommentThreadModel ( expectedLineNumber ) ,
656+ } ;
657+
658+ sessionService . BuildCommentThreads ( null , null , null ) . ReturnsForAnyArgs ( threads ) ;
659+
660+ var target = new PullRequestSessionManager (
661+ CreatePullRequestService ( ) ,
662+ sessionService ,
663+ CreateRepositoryHosts ( ) ,
664+ new FakeTeamExplorerServiceHolder ( CreateRepositoryModel ( ) ) ) ;
665+ var file = await target . GetLiveFile ( FilePath , textView , textView . TextBuffer ) ;
666+ var raised = false ;
667+ var pullRequest = target . CurrentSession . PullRequest ;
668+
669+ file . LinesChanged . Subscribe ( x => raised = x . Count == 1 && x [ 0 ] == expectedLineNumber ) ;
670+
671+ // LinesChanged should be raised even if the IPullRequestModel is the same.
672+ await target . CurrentSession . Update ( target . CurrentSession . PullRequest ) ;
673+
674+ Assert . True ( raised ) ;
675+ }
676+
647677 static IPullRequestReviewCommentModel CreateComment (
648678 string diffHunk ,
649679 string body = "Comment" ,
You can’t perform that action at this time.
0 commit comments