This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
src/GitHub.InlineReviews/ViewModels
test/GitHub.InlineReviews.UnitTests/ViewModels Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public PullRequestReviewCommentViewModel(
6161 . ToProperty ( this , x => x . CanStartReview ) ;
6262
6363 commitCaption = pendingReviewAndIdObservable
64- . Select ( list => ! list [ 1 ] ? Resources . EditComment : list [ 0 ] ? Resources . AddReviewComment : Resources . AddSingleComment )
64+ . Select ( list => ! list [ 1 ] ? Resources . EditComment : list [ 0 ] ? Resources . AddSingleComment : Resources . AddReviewComment )
6565 . ToProperty ( this , x => x . CommitCaption ) ;
6666
6767 StartReview = ReactiveCommand . CreateAsyncTask (
Original file line number Diff line number Diff line change @@ -30,6 +30,19 @@ public void IsTrueWhenSessionHasNoPendingReview()
3030
3131 Assert . That ( target . CanStartReview , Is . True ) ;
3232 }
33+
34+ [ Test ]
35+ public void IsFalseWhenEditingExistingComment ( )
36+ {
37+ var session = CreateSession ( false ) ;
38+
39+ var pullRequestReviewCommentModel = Substitute . For < IPullRequestReviewCommentModel > ( ) ;
40+ pullRequestReviewCommentModel . Id . Returns ( 1 ) ;
41+
42+ var target = CreateTarget ( session , pullRequestReviewCommentModel : pullRequestReviewCommentModel ) ;
43+
44+ Assert . That ( target . CanStartReview , Is . False ) ;
45+ }
3346 }
3447
3548 public class TheBeginEditProperty
@@ -147,6 +160,19 @@ public void IsAddSingleCommentWhenSessionHasNoPendingReview()
147160
148161 Assert . That ( target . CommitCaption , Is . EqualTo ( "Add a single comment" ) ) ;
149162 }
163+
164+ [ Test ]
165+ public void IsEditCommentWhenEditingExistingComment ( )
166+ {
167+ var session = CreateSession ( false ) ;
168+
169+ var pullRequestReviewCommentModel = Substitute . For < IPullRequestReviewCommentModel > ( ) ;
170+ pullRequestReviewCommentModel . Id . Returns ( 1 ) ;
171+
172+ var target = CreateTarget ( session , pullRequestReviewCommentModel : pullRequestReviewCommentModel ) ;
173+
174+ Assert . That ( target . CommitCaption , Is . EqualTo ( "Edit Comment" ) ) ;
175+ }
150176 }
151177
152178 public class TheStartReviewCommand
You can’t perform that action at this time.
0 commit comments