@@ -26,9 +26,8 @@ public class TheBodyProperty
26
26
public async Task ShouldUsePlaceholderBodyIfNoneExists ( )
27
27
{
28
28
var target = CreateTarget ( ) ;
29
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
30
29
31
- await target . Load ( repo , CreatePullRequest ( body : string . Empty ) ) ;
30
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( body : string . Empty ) ) ;
32
31
33
32
Assert . Equal ( "*No description provided.*" , target . Body ) ;
34
33
}
@@ -41,12 +40,11 @@ public async Task ShouldAcceptNullHead()
41
40
{
42
41
var target = CreateTarget ( ) ;
43
42
var model = CreatePullRequest ( ) ;
44
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
45
43
46
44
// PullRequest.Head can be null for example if a user deletes the repository after creating the PR.
47
45
model . Head = null ;
48
46
49
- await target . Load ( repo , model ) ;
47
+ await target . Load ( "remoteRepositoryOwner" , model ) ;
50
48
51
49
Assert . Equal ( "[invalid]" , target . SourceBranchDisplayName ) ;
52
50
}
@@ -59,7 +57,6 @@ public async Task ShouldCreateChangesTree()
59
57
{
60
58
var target = CreateTarget ( ) ;
61
59
var pr = CreatePullRequest ( ) ;
62
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
63
60
64
61
pr . ChangedFiles = new [ ]
65
62
{
@@ -70,7 +67,7 @@ public async Task ShouldCreateChangesTree()
70
67
new PullRequestFileModel ( "dir2/f4.cs" , "abc" , PullRequestFileStatus . Modified ) ,
71
68
} ;
72
69
73
- await target . Load ( repo , pr ) ;
70
+ await target . Load ( "remoteRepositoryOwner" , pr ) ;
74
71
75
72
Assert . Equal ( 3 , target . ChangedFilesTree . Count ) ;
76
73
@@ -107,7 +104,6 @@ public async Task FileCommentCountShouldTrackSessionInlineComments()
107
104
var outdatedThread = CreateThread ( - 1 ) ;
108
105
var session = Substitute . For < IPullRequestSession > ( ) ;
109
106
var sessionManager = Substitute . For < IPullRequestSessionManager > ( ) ;
110
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
111
107
112
108
file . InlineCommentThreads . Returns ( new [ ] { thread1 } ) ;
113
109
session . GetFile ( "readme.md" ) . Returns ( Task . FromResult ( file ) ) ;
@@ -120,7 +116,7 @@ public async Task FileCommentCountShouldTrackSessionInlineComments()
120
116
new PullRequestFileModel ( "readme.md" , "abc" , PullRequestFileStatus . Modified ) ,
121
117
} ;
122
118
123
- await target . Load ( repo , pr ) ;
119
+ await target . Load ( "remoteRepositoryOwner" , pr ) ;
124
120
Assert . Equal ( 1 , ( ( IPullRequestFileNode ) target . ChangedFilesTree [ 0 ] ) . CommentCount ) ;
125
121
126
122
file . InlineCommentThreads . Returns ( new [ ] { thread1 , thread2 } ) ;
@@ -158,9 +154,8 @@ public async Task CheckedOutAndUpToDate()
158
154
var target = CreateTarget (
159
155
currentBranch : "pr/123" ,
160
156
existingPrBranch : "pr/123" ) ;
161
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
162
157
163
- await target . Load ( repo , CreatePullRequest ( ) ) ;
158
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
164
159
165
160
Assert . False ( target . Checkout . CanExecute ( null ) ) ;
166
161
Assert . Null ( target . CheckoutState ) ;
@@ -172,9 +167,8 @@ public async Task NotCheckedOut()
172
167
var target = CreateTarget (
173
168
currentBranch : "master" ,
174
169
existingPrBranch : "pr/123" ) ;
175
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
176
170
177
- await target . Load ( repo , CreatePullRequest ( ) ) ;
171
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
178
172
179
173
Assert . True ( target . Checkout . CanExecute ( null ) ) ;
180
174
Assert . True ( target . CheckoutState . IsEnabled ) ;
@@ -188,9 +182,8 @@ public async Task NotCheckedOutWithWorkingDirectoryDirty()
188
182
currentBranch : "master" ,
189
183
existingPrBranch : "pr/123" ,
190
184
dirty : true ) ;
191
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
192
185
193
- await target . Load ( repo , CreatePullRequest ( ) ) ;
186
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
194
187
195
188
Assert . False ( target . Checkout . CanExecute ( null ) ) ;
196
189
Assert . Equal ( "Cannot checkout as your working directory has uncommitted changes." , target . CheckoutState . ToolTip ) ;
@@ -202,9 +195,8 @@ public async Task CheckoutExistingLocalBranch()
202
195
var target = CreateTarget (
203
196
currentBranch : "master" ,
204
197
existingPrBranch : "pr/123" ) ;
205
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
206
198
207
- await target . Load ( repo , CreatePullRequest ( number : 123 ) ) ;
199
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( number : 123 ) ) ;
208
200
209
201
Assert . True ( target . Checkout . CanExecute ( null ) ) ;
210
202
Assert . Equal ( "Checkout pr/123" , target . CheckoutState . Caption ) ;
@@ -215,9 +207,8 @@ public async Task CheckoutNonExistingLocalBranch()
215
207
{
216
208
var target = CreateTarget (
217
209
currentBranch : "master" ) ;
218
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
219
210
220
- await target . Load ( repo , CreatePullRequest ( number : 123 ) ) ;
211
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( number : 123 ) ) ;
221
212
222
213
Assert . True ( target . Checkout . CanExecute ( null ) ) ;
223
214
Assert . Equal ( "Checkout to pr/123" , target . CheckoutState . Caption ) ;
@@ -230,11 +221,10 @@ public async Task UpdatesOperationErrorWithExceptionMessage()
230
221
currentBranch : "master" ,
231
222
existingPrBranch : "pr/123" ) ;
232
223
var pr = CreatePullRequest ( ) ;
233
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
234
224
235
225
pr . Head = new GitReferenceModel ( "source" , null , "sha" , ( string ) null ) ;
236
226
237
- await target . Load ( repo , pr ) ;
227
+ await target . Load ( "remoteRepositoryOwner" , pr ) ;
238
228
239
229
Assert . False ( target . Checkout . CanExecute ( null ) ) ;
240
230
Assert . Equal ( "The source repository is no longer available." , target . CheckoutState . ToolTip ) ;
@@ -246,9 +236,8 @@ public async Task SetsOperationErrorOnCheckoutFailure()
246
236
var target = CreateTarget (
247
237
currentBranch : "master" ,
248
238
existingPrBranch : "pr/123" ) ;
249
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
250
239
251
- await target . Load ( repo , CreatePullRequest ( ) ) ;
240
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
252
241
253
242
Assert . True ( target . Checkout . CanExecute ( null ) ) ;
254
243
@@ -263,9 +252,8 @@ public async Task ClearsOperationErrorOnCheckoutSuccess()
263
252
var target = CreateTarget (
264
253
currentBranch : "master" ,
265
254
existingPrBranch : "pr/123" ) ;
266
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
267
255
268
- await target . Load ( repo , CreatePullRequest ( ) ) ;
256
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
269
257
270
258
Assert . True ( target . Checkout . CanExecute ( null ) ) ;
271
259
await Assert . ThrowsAsync < FileNotFoundException > ( async ( ) => await target . Checkout . ExecuteAsyncTask ( ) ) ;
@@ -281,9 +269,8 @@ public async Task ClearsOperationErrorOnCheckoutRefresh()
281
269
var target = CreateTarget (
282
270
currentBranch : "master" ,
283
271
existingPrBranch : "pr/123" ) ;
284
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
285
272
286
- await target . Load ( repo , CreatePullRequest ( ) ) ;
273
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
287
274
288
275
Assert . True ( target . Checkout . CanExecute ( null ) ) ;
289
276
await Assert . ThrowsAsync < FileNotFoundException > ( async ( ) => await target . Checkout . ExecuteAsyncTask ( ) ) ;
@@ -302,9 +289,8 @@ public async Task NotCheckedOut()
302
289
var target = CreateTarget (
303
290
currentBranch : "master" ,
304
291
existingPrBranch : "pr/123" ) ;
305
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
306
292
307
- await target . Load ( repo , CreatePullRequest ( ) ) ;
293
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
308
294
309
295
Assert . False ( target . Pull . CanExecute ( null ) ) ;
310
296
Assert . Null ( target . UpdateState ) ;
@@ -316,9 +302,8 @@ public async Task CheckedOutAndUpToDate()
316
302
var target = CreateTarget (
317
303
currentBranch : "pr/123" ,
318
304
existingPrBranch : "pr/123" ) ;
319
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
320
305
321
- await target . Load ( repo , CreatePullRequest ( ) ) ;
306
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
322
307
323
308
Assert . False ( target . Pull . CanExecute ( null ) ) ;
324
309
Assert . Equal ( 0 , target . UpdateState . CommitsAhead ) ;
@@ -333,9 +318,8 @@ public async Task CheckedOutAndBehind()
333
318
currentBranch : "pr/123" ,
334
319
existingPrBranch : "pr/123" ,
335
320
behindBy : 2 ) ;
336
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
337
321
338
- await target . Load ( repo , CreatePullRequest ( ) ) ;
322
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
339
323
340
324
Assert . True ( target . Pull . CanExecute ( null ) ) ;
341
325
Assert . Equal ( 0 , target . UpdateState . CommitsAhead ) ;
@@ -351,9 +335,8 @@ public async Task CheckedOutAndAheadAndBehind()
351
335
existingPrBranch : "pr/123" ,
352
336
aheadBy : 3 ,
353
337
behindBy : 2 ) ;
354
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
355
338
356
- await target . Load ( repo , CreatePullRequest ( ) ) ;
339
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
357
340
358
341
Assert . True ( target . Pull . CanExecute ( null ) ) ;
359
342
Assert . Equal ( 3 , target . UpdateState . CommitsAhead ) ;
@@ -369,9 +352,8 @@ public async Task CheckedOutAndBehindFork()
369
352
existingPrBranch : "pr/123" ,
370
353
prFromFork : true ,
371
354
behindBy : 2 ) ;
372
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
373
355
374
- await target . Load ( repo , CreatePullRequest ( ) ) ;
356
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
375
357
376
358
Assert . True ( target . Pull . CanExecute ( null ) ) ;
377
359
Assert . Equal ( 0 , target . UpdateState . CommitsAhead ) ;
@@ -385,9 +367,8 @@ public async Task UpdatesOperationErrorWithExceptionMessage()
385
367
var target = CreateTarget (
386
368
currentBranch : "master" ,
387
369
existingPrBranch : "pr/123" ) ;
388
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
389
370
390
- await target . Load ( repo , CreatePullRequest ( ) ) ;
371
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
391
372
392
373
await Assert . ThrowsAsync < FileNotFoundException > ( ( ) => target . Pull . ExecuteAsyncTask ( null ) ) ;
393
374
Assert . Equal ( "Pull threw" , target . OperationError ) ;
@@ -402,9 +383,8 @@ public async Task NotCheckedOut()
402
383
var target = CreateTarget (
403
384
currentBranch : "master" ,
404
385
existingPrBranch : "pr/123" ) ;
405
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
406
386
407
- await target . Load ( repo , CreatePullRequest ( ) ) ;
387
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
408
388
409
389
Assert . False ( target . Push . CanExecute ( null ) ) ;
410
390
Assert . Null ( target . UpdateState ) ;
@@ -416,9 +396,8 @@ public async Task CheckedOutAndUpToDate()
416
396
var target = CreateTarget (
417
397
currentBranch : "pr/123" ,
418
398
existingPrBranch : "pr/123" ) ;
419
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
420
399
421
- await target . Load ( repo , CreatePullRequest ( ) ) ;
400
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
422
401
423
402
Assert . False ( target . Push . CanExecute ( null ) ) ;
424
403
Assert . Equal ( 0 , target . UpdateState . CommitsAhead ) ;
@@ -433,9 +412,8 @@ public async Task CheckedOutAndAhead()
433
412
currentBranch : "pr/123" ,
434
413
existingPrBranch : "pr/123" ,
435
414
aheadBy : 2 ) ;
436
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
437
415
438
- await target . Load ( repo , CreatePullRequest ( ) ) ;
416
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
439
417
440
418
Assert . True ( target . Push . CanExecute ( null ) ) ;
441
419
Assert . Equal ( 2 , target . UpdateState . CommitsAhead ) ;
@@ -450,9 +428,8 @@ public async Task CheckedOutAndBehind()
450
428
currentBranch : "pr/123" ,
451
429
existingPrBranch : "pr/123" ,
452
430
behindBy : 2 ) ;
453
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
454
431
455
- await target . Load ( repo , CreatePullRequest ( ) ) ;
432
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
456
433
457
434
Assert . False ( target . Push . CanExecute ( null ) ) ;
458
435
Assert . Equal ( 0 , target . UpdateState . CommitsAhead ) ;
@@ -468,9 +445,8 @@ public async Task CheckedOutAndAheadAndBehind()
468
445
existingPrBranch : "pr/123" ,
469
446
aheadBy : 3 ,
470
447
behindBy : 2 ) ;
471
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
472
448
473
- await target . Load ( repo , CreatePullRequest ( ) ) ;
449
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
474
450
475
451
Assert . False ( target . Push . CanExecute ( null ) ) ;
476
452
Assert . Equal ( 3 , target . UpdateState . CommitsAhead ) ;
@@ -486,9 +462,8 @@ public async Task CheckedOutAndAheadOfFork()
486
462
existingPrBranch : "pr/123" ,
487
463
prFromFork : true ,
488
464
aheadBy : 2 ) ;
489
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
490
465
491
- await target . Load ( repo , CreatePullRequest ( ) ) ;
466
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
492
467
493
468
Assert . True ( target . Push . CanExecute ( null ) ) ;
494
469
Assert . Equal ( 2 , target . UpdateState . CommitsAhead ) ;
@@ -502,9 +477,8 @@ public async Task UpdatesOperationErrorWithExceptionMessage()
502
477
var target = CreateTarget (
503
478
currentBranch : "master" ,
504
479
existingPrBranch : "pr/123" ) ;
505
- var repo = Substitute . For < IRemoteRepositoryModel > ( ) ;
506
480
507
- await target . Load ( repo , CreatePullRequest ( ) ) ;
481
+ await target . Load ( "remoteRepositoryOwner" , CreatePullRequest ( ) ) ;
508
482
509
483
await Assert . ThrowsAsync < FileNotFoundException > ( ( ) => target . Push . ExecuteAsyncTask ( null ) ) ;
510
484
Assert . Equal ( "Push threw" , target . OperationError ) ;
0 commit comments