This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +15
-9
lines changed
src/GitHub.InlineReviews/ViewModels
test/GitHub.InlineReviews.UnitTests Expand file tree Collapse file tree 7 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ public PullRequestReviewCommentViewModel(
9696 new ActorViewModel ( model . Author ) ,
9797 model . CreatedAt ,
9898 review . State == PullRequestReviewState . Pending ,
99- new Uri ( model . Url ) )
99+ model . Url != null ? new Uri ( model . Url ) : null )
100100 {
101101 }
102102
Original file line number Diff line number Diff line change @@ -690,8 +690,7 @@ IPullRequestSessionService CreateRealSessionService(
690690 diff ,
691691 Substitute . For < IApiClientFactory > ( ) ,
692692 Substitute . For < IGraphQLClientFactory > ( ) ,
693- Substitute . For < IUsageTracker > ( ) ,
694- Substitute . For < IAvatarProvider > ( ) ) ;
693+ Substitute . For < IUsageTracker > ( ) ) ;
695694 result . CreateRebuildSignal ( ) . Returns ( new Subject < ITextSnapshot > ( ) ) ;
696695 result . GetPullRequestMergeBase (
697696 Arg . Any < ILocalRepositoryModel > ( ) ,
Original file line number Diff line number Diff line change @@ -763,8 +763,7 @@ static IPullRequestSessionService CreateRealSessionService(IDiffService diffServ
763763 diffService ?? Substitute . For < IDiffService > ( ) ,
764764 Substitute . For < IApiClientFactory > ( ) ,
765765 Substitute . For < IGraphQLClientFactory > ( ) ,
766- Substitute . For < IUsageTracker > ( ) ,
767- Substitute . For < IAvatarProvider > ( ) ) ;
766+ Substitute . For < IUsageTracker > ( ) ) ;
768767
769768 result . GetTipSha ( Arg . Any < ILocalRepositoryModel > ( ) ) . Returns ( "BRANCH_TIP" ) ;
770769 result . GetPullRequestMergeBase ( Arg . Any < ILocalRepositoryModel > ( ) , Arg . Any < PullRequestDetailModel > ( ) )
Original file line number Diff line number Diff line change @@ -302,7 +302,8 @@ InlineCommentModel CreateComment(string body)
302302 Comment = new PullRequestReviewCommentModel
303303 {
304304 Body = body ,
305- }
305+ } ,
306+ Review = new PullRequestReviewModel ( ) ,
306307 } ;
307308 }
308309
Original file line number Diff line number Diff line change @@ -72,9 +72,9 @@ InlineCommentModel CreateComment(string id, string body)
7272 Comment = new PullRequestReviewCommentModel
7373 {
7474 Id = id ,
75- //Author = new ActorModel { Login = "CurrentUser" },
7675 Body = body ,
7776 } ,
77+ Review = new PullRequestReviewModel ( ) ,
7878 } ;
7979 }
8080
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ public void CreatesReplyPlaceholder()
2020 false ) ;
2121
2222 Assert . That ( target . Comments , Has . One . Items ) ;
23- Assert . That ( string . Empty , Is . EqualTo ( target . Comments [ 0 ] . Body ) ) ;
24- Assert . That ( CommentEditState . Placeholder , Is . EqualTo ( target . Comments [ 0 ] . EditState ) ) ;
23+ Assert . That ( target . Comments [ 0 ] . Body , Is . EqualTo ( string . Empty ) ) ;
24+ Assert . That ( target . Comments [ 0 ] . EditState , Is . EqualTo ( CommentEditState . Placeholder ) ) ;
2525 }
2626
2727 [ Test ]
Original file line number Diff line number Diff line change 11using System ;
22using System . Reactive . Linq ;
3+ using System . Threading . Tasks ;
34using GitHub . InlineReviews . ViewModels ;
45using GitHub . Models ;
56using GitHub . Services ;
@@ -156,6 +157,11 @@ public void IsUpdateCommentWhenEditingExistingComment()
156157
157158 public class TheStartReviewCommand
158159 {
160+ public TheStartReviewCommand ( )
161+ {
162+ Splat . ModeDetector . Current . SetInUnitTestRunner ( true ) ;
163+ }
164+
159165 [ Test ]
160166 public void IsDisabledWhenSessionHasPendingReview ( )
161167 {
@@ -240,6 +246,7 @@ static ICommentThreadViewModel CreateThread(
240246 bool canPost = true )
241247 {
242248 var result = Substitute . For < ICommentThreadViewModel > ( ) ;
249+ result . PostComment . Returns ( ReactiveCommand . CreateAsyncTask ( _ => Task . CompletedTask ) ) ;
243250 return result ;
244251 }
245252 }
You can’t perform that action at this time.
0 commit comments