Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit d19f82b

Browse files
grokysjcansdale
authored andcommitted
Merge branch 'master' into feature/open-current-pr-command
2 parents 623ed46 + 2ab326d commit d19f82b

File tree

2 files changed

+29
-52
lines changed

2 files changed

+29
-52
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Most of the extension UI lives in the Team Explorer pane, which is available fro
2121

2222
Official builds of this extension are available at [the official website](https://visualstudio.github.com).
2323

24+
25+
[![Build status](https://ci.appveyor.com/api/projects/status/dl8is5iqwt9qf3t7/branch/master?svg=true)](https://ci.appveyor.com/project/github-windows/visualstudio/branch/master)
26+
2427
[![Join the chat at freenode:github-vs](https://img.shields.io/badge/irc-freenode:%20%23github--vs-blue.svg)](http://webchat.freenode.net/?channels=%23github-vs) [![Join the chat at https://gitter.im/github/VisualStudio](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/github/VisualStudio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2528

2629
## Documentation

test/UnitTests/GitHub.App/ViewModels/PullRequestDetailViewModelTests.cs

Lines changed: 26 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ public class TheBodyProperty
2626
public async Task ShouldUsePlaceholderBodyIfNoneExists()
2727
{
2828
var target = CreateTarget();
29-
var repo = Substitute.For<IRemoteRepositoryModel>();
3029

31-
await target.Load(repo, CreatePullRequest(body: string.Empty));
30+
await target.Load("remoteRepositoryOwner", CreatePullRequest(body: string.Empty));
3231

3332
Assert.Equal("*No description provided.*", target.Body);
3433
}
@@ -41,12 +40,11 @@ public async Task ShouldAcceptNullHead()
4140
{
4241
var target = CreateTarget();
4342
var model = CreatePullRequest();
44-
var repo = Substitute.For<IRemoteRepositoryModel>();
4543

4644
// PullRequest.Head can be null for example if a user deletes the repository after creating the PR.
4745
model.Head = null;
4846

49-
await target.Load(repo, model);
47+
await target.Load("remoteRepositoryOwner", model);
5048

5149
Assert.Equal("[invalid]", target.SourceBranchDisplayName);
5250
}
@@ -59,7 +57,6 @@ public async Task ShouldCreateChangesTree()
5957
{
6058
var target = CreateTarget();
6159
var pr = CreatePullRequest();
62-
var repo = Substitute.For<IRemoteRepositoryModel>();
6360

6461
pr.ChangedFiles = new[]
6562
{
@@ -70,7 +67,7 @@ public async Task ShouldCreateChangesTree()
7067
new PullRequestFileModel("dir2/f4.cs", "abc", PullRequestFileStatus.Modified),
7168
};
7269

73-
await target.Load(repo, pr);
70+
await target.Load("remoteRepositoryOwner", pr);
7471

7572
Assert.Equal(3, target.ChangedFilesTree.Count);
7673

@@ -107,7 +104,6 @@ public async Task FileCommentCountShouldTrackSessionInlineComments()
107104
var outdatedThread = CreateThread(-1);
108105
var session = Substitute.For<IPullRequestSession>();
109106
var sessionManager = Substitute.For<IPullRequestSessionManager>();
110-
var repo = Substitute.For<IRemoteRepositoryModel>();
111107

112108
file.InlineCommentThreads.Returns(new[] { thread1 });
113109
session.GetFile("readme.md").Returns(Task.FromResult(file));
@@ -120,7 +116,7 @@ public async Task FileCommentCountShouldTrackSessionInlineComments()
120116
new PullRequestFileModel("readme.md", "abc", PullRequestFileStatus.Modified),
121117
};
122118

123-
await target.Load(repo, pr);
119+
await target.Load("remoteRepositoryOwner", pr);
124120
Assert.Equal(1, ((IPullRequestFileNode)target.ChangedFilesTree[0]).CommentCount);
125121

126122
file.InlineCommentThreads.Returns(new[] { thread1, thread2 });
@@ -158,9 +154,8 @@ public async Task CheckedOutAndUpToDate()
158154
var target = CreateTarget(
159155
currentBranch: "pr/123",
160156
existingPrBranch: "pr/123");
161-
var repo = Substitute.For<IRemoteRepositoryModel>();
162157

163-
await target.Load(repo, CreatePullRequest());
158+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
164159

165160
Assert.False(target.Checkout.CanExecute(null));
166161
Assert.Null(target.CheckoutState);
@@ -172,9 +167,8 @@ public async Task NotCheckedOut()
172167
var target = CreateTarget(
173168
currentBranch: "master",
174169
existingPrBranch: "pr/123");
175-
var repo = Substitute.For<IRemoteRepositoryModel>();
176170

177-
await target.Load(repo, CreatePullRequest());
171+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
178172

179173
Assert.True(target.Checkout.CanExecute(null));
180174
Assert.True(target.CheckoutState.IsEnabled);
@@ -188,9 +182,8 @@ public async Task NotCheckedOutWithWorkingDirectoryDirty()
188182
currentBranch: "master",
189183
existingPrBranch: "pr/123",
190184
dirty: true);
191-
var repo = Substitute.For<IRemoteRepositoryModel>();
192185

193-
await target.Load(repo, CreatePullRequest());
186+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
194187

195188
Assert.False(target.Checkout.CanExecute(null));
196189
Assert.Equal("Cannot checkout as your working directory has uncommitted changes.", target.CheckoutState.ToolTip);
@@ -202,9 +195,8 @@ public async Task CheckoutExistingLocalBranch()
202195
var target = CreateTarget(
203196
currentBranch: "master",
204197
existingPrBranch: "pr/123");
205-
var repo = Substitute.For<IRemoteRepositoryModel>();
206198

207-
await target.Load(repo, CreatePullRequest(number: 123));
199+
await target.Load("remoteRepositoryOwner", CreatePullRequest(number: 123));
208200

209201
Assert.True(target.Checkout.CanExecute(null));
210202
Assert.Equal("Checkout pr/123", target.CheckoutState.Caption);
@@ -215,9 +207,8 @@ public async Task CheckoutNonExistingLocalBranch()
215207
{
216208
var target = CreateTarget(
217209
currentBranch: "master");
218-
var repo = Substitute.For<IRemoteRepositoryModel>();
219210

220-
await target.Load(repo, CreatePullRequest(number: 123));
211+
await target.Load("remoteRepositoryOwner", CreatePullRequest(number: 123));
221212

222213
Assert.True(target.Checkout.CanExecute(null));
223214
Assert.Equal("Checkout to pr/123", target.CheckoutState.Caption);
@@ -230,11 +221,10 @@ public async Task UpdatesOperationErrorWithExceptionMessage()
230221
currentBranch: "master",
231222
existingPrBranch: "pr/123");
232223
var pr = CreatePullRequest();
233-
var repo = Substitute.For<IRemoteRepositoryModel>();
234224

235225
pr.Head = new GitReferenceModel("source", null, "sha", (string)null);
236226

237-
await target.Load(repo, pr);
227+
await target.Load("remoteRepositoryOwner", pr);
238228

239229
Assert.False(target.Checkout.CanExecute(null));
240230
Assert.Equal("The source repository is no longer available.", target.CheckoutState.ToolTip);
@@ -246,9 +236,8 @@ public async Task SetsOperationErrorOnCheckoutFailure()
246236
var target = CreateTarget(
247237
currentBranch: "master",
248238
existingPrBranch: "pr/123");
249-
var repo = Substitute.For<IRemoteRepositoryModel>();
250239

251-
await target.Load(repo, CreatePullRequest());
240+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
252241

253242
Assert.True(target.Checkout.CanExecute(null));
254243

@@ -263,9 +252,8 @@ public async Task ClearsOperationErrorOnCheckoutSuccess()
263252
var target = CreateTarget(
264253
currentBranch: "master",
265254
existingPrBranch: "pr/123");
266-
var repo = Substitute.For<IRemoteRepositoryModel>();
267255

268-
await target.Load(repo, CreatePullRequest());
256+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
269257

270258
Assert.True(target.Checkout.CanExecute(null));
271259
await Assert.ThrowsAsync<FileNotFoundException>(async () => await target.Checkout.ExecuteAsyncTask());
@@ -281,9 +269,8 @@ public async Task ClearsOperationErrorOnCheckoutRefresh()
281269
var target = CreateTarget(
282270
currentBranch: "master",
283271
existingPrBranch: "pr/123");
284-
var repo = Substitute.For<IRemoteRepositoryModel>();
285272

286-
await target.Load(repo, CreatePullRequest());
273+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
287274

288275
Assert.True(target.Checkout.CanExecute(null));
289276
await Assert.ThrowsAsync<FileNotFoundException>(async () => await target.Checkout.ExecuteAsyncTask());
@@ -302,9 +289,8 @@ public async Task NotCheckedOut()
302289
var target = CreateTarget(
303290
currentBranch: "master",
304291
existingPrBranch: "pr/123");
305-
var repo = Substitute.For<IRemoteRepositoryModel>();
306292

307-
await target.Load(repo, CreatePullRequest());
293+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
308294

309295
Assert.False(target.Pull.CanExecute(null));
310296
Assert.Null(target.UpdateState);
@@ -316,9 +302,8 @@ public async Task CheckedOutAndUpToDate()
316302
var target = CreateTarget(
317303
currentBranch: "pr/123",
318304
existingPrBranch: "pr/123");
319-
var repo = Substitute.For<IRemoteRepositoryModel>();
320305

321-
await target.Load(repo, CreatePullRequest());
306+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
322307

323308
Assert.False(target.Pull.CanExecute(null));
324309
Assert.Equal(0, target.UpdateState.CommitsAhead);
@@ -333,9 +318,8 @@ public async Task CheckedOutAndBehind()
333318
currentBranch: "pr/123",
334319
existingPrBranch: "pr/123",
335320
behindBy: 2);
336-
var repo = Substitute.For<IRemoteRepositoryModel>();
337321

338-
await target.Load(repo, CreatePullRequest());
322+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
339323

340324
Assert.True(target.Pull.CanExecute(null));
341325
Assert.Equal(0, target.UpdateState.CommitsAhead);
@@ -351,9 +335,8 @@ public async Task CheckedOutAndAheadAndBehind()
351335
existingPrBranch: "pr/123",
352336
aheadBy: 3,
353337
behindBy: 2);
354-
var repo = Substitute.For<IRemoteRepositoryModel>();
355338

356-
await target.Load(repo, CreatePullRequest());
339+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
357340

358341
Assert.True(target.Pull.CanExecute(null));
359342
Assert.Equal(3, target.UpdateState.CommitsAhead);
@@ -369,9 +352,8 @@ public async Task CheckedOutAndBehindFork()
369352
existingPrBranch: "pr/123",
370353
prFromFork: true,
371354
behindBy: 2);
372-
var repo = Substitute.For<IRemoteRepositoryModel>();
373355

374-
await target.Load(repo, CreatePullRequest());
356+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
375357

376358
Assert.True(target.Pull.CanExecute(null));
377359
Assert.Equal(0, target.UpdateState.CommitsAhead);
@@ -385,9 +367,8 @@ public async Task UpdatesOperationErrorWithExceptionMessage()
385367
var target = CreateTarget(
386368
currentBranch: "master",
387369
existingPrBranch: "pr/123");
388-
var repo = Substitute.For<IRemoteRepositoryModel>();
389370

390-
await target.Load(repo, CreatePullRequest());
371+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
391372

392373
await Assert.ThrowsAsync<FileNotFoundException>(() => target.Pull.ExecuteAsyncTask(null));
393374
Assert.Equal("Pull threw", target.OperationError);
@@ -402,9 +383,8 @@ public async Task NotCheckedOut()
402383
var target = CreateTarget(
403384
currentBranch: "master",
404385
existingPrBranch: "pr/123");
405-
var repo = Substitute.For<IRemoteRepositoryModel>();
406386

407-
await target.Load(repo, CreatePullRequest());
387+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
408388

409389
Assert.False(target.Push.CanExecute(null));
410390
Assert.Null(target.UpdateState);
@@ -416,9 +396,8 @@ public async Task CheckedOutAndUpToDate()
416396
var target = CreateTarget(
417397
currentBranch: "pr/123",
418398
existingPrBranch: "pr/123");
419-
var repo = Substitute.For<IRemoteRepositoryModel>();
420399

421-
await target.Load(repo, CreatePullRequest());
400+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
422401

423402
Assert.False(target.Push.CanExecute(null));
424403
Assert.Equal(0, target.UpdateState.CommitsAhead);
@@ -433,9 +412,8 @@ public async Task CheckedOutAndAhead()
433412
currentBranch: "pr/123",
434413
existingPrBranch: "pr/123",
435414
aheadBy: 2);
436-
var repo = Substitute.For<IRemoteRepositoryModel>();
437415

438-
await target.Load(repo, CreatePullRequest());
416+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
439417

440418
Assert.True(target.Push.CanExecute(null));
441419
Assert.Equal(2, target.UpdateState.CommitsAhead);
@@ -450,9 +428,8 @@ public async Task CheckedOutAndBehind()
450428
currentBranch: "pr/123",
451429
existingPrBranch: "pr/123",
452430
behindBy: 2);
453-
var repo = Substitute.For<IRemoteRepositoryModel>();
454431

455-
await target.Load(repo, CreatePullRequest());
432+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
456433

457434
Assert.False(target.Push.CanExecute(null));
458435
Assert.Equal(0, target.UpdateState.CommitsAhead);
@@ -468,9 +445,8 @@ public async Task CheckedOutAndAheadAndBehind()
468445
existingPrBranch: "pr/123",
469446
aheadBy: 3,
470447
behindBy: 2);
471-
var repo = Substitute.For<IRemoteRepositoryModel>();
472448

473-
await target.Load(repo, CreatePullRequest());
449+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
474450

475451
Assert.False(target.Push.CanExecute(null));
476452
Assert.Equal(3, target.UpdateState.CommitsAhead);
@@ -486,9 +462,8 @@ public async Task CheckedOutAndAheadOfFork()
486462
existingPrBranch: "pr/123",
487463
prFromFork: true,
488464
aheadBy: 2);
489-
var repo = Substitute.For<IRemoteRepositoryModel>();
490465

491-
await target.Load(repo, CreatePullRequest());
466+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
492467

493468
Assert.True(target.Push.CanExecute(null));
494469
Assert.Equal(2, target.UpdateState.CommitsAhead);
@@ -502,9 +477,8 @@ public async Task UpdatesOperationErrorWithExceptionMessage()
502477
var target = CreateTarget(
503478
currentBranch: "master",
504479
existingPrBranch: "pr/123");
505-
var repo = Substitute.For<IRemoteRepositoryModel>();
506480

507-
await target.Load(repo, CreatePullRequest());
481+
await target.Load("remoteRepositoryOwner", CreatePullRequest());
508482

509483
await Assert.ThrowsAsync<FileNotFoundException>(() => target.Push.ExecuteAsyncTask(null));
510484
Assert.Equal("Push threw", target.OperationError);

0 commit comments

Comments
 (0)