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

Commit f26890e

Browse files
committed
Use Array.Empty in tests.
1 parent d5f71a0 commit f26890e

File tree

18 files changed

+24
-24
lines changed

18 files changed

+24
-24
lines changed

src/GitHub.App/SampleData/PullRequestDetailViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public PullRequestDetailViewModelDesigner()
9696

9797
Files = new PullRequestFilesViewModelDesigner();
9898

99-
Checks = new PullRequestCheckViewModelDesigner[0];
99+
Checks = Array.Empty<PullRequestCheckViewModelDesigner>();
100100
}
101101

102102
public PullRequestDetailModel Model { get; }

src/GitHub.App/SampleData/PullRequestUserReviewsViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public PullRequestUserReviewsViewModelDesigner()
2727
{
2828
IsExpanded = true,
2929
HasDetails = true,
30-
FileComments = new IPullRequestReviewFileCommentViewModel[0],
30+
FileComments = Array.Empty<IPullRequestReviewFileCommentViewModel>(),
3131
StateDisplay = "approved",
3232
Model = new PullRequestReviewModel
3333
{

src/GitHub.App/Services/ModelService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ IObservable<IReadOnlyList<IRemoteRepositoryModel>> GetUserRepositories(Repositor
320320
log.Error(e,
321321
"Retrieving {RepositoryType} user repositories failed because user is not stored in the cache",
322322
repositoryType);
323-
return Observable.Return(new IRemoteRepositoryModel[] {});
323+
return Observable.Return(Array.Empty<IRemoteRepositoryModel>());
324324
});
325325
}
326326

@@ -355,7 +355,7 @@ IObservable<IReadOnlyList<IRemoteRepositoryModel>> GetOrganizationRepositories(s
355355
{
356356
log.Error(e, "Retrieveing {Organization} org repositories failed because user is not stored in the cache",
357357
organization);
358-
return Observable.Return(new IRemoteRepositoryModel[] {});
358+
return Observable.Return(Array.Empty<IRemoteRepositoryModel>());
359359
});
360360
}
361361

src/GitHub.App/Services/StandardUserErrors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static IObservable<RecoveryOptionResult> ShowUserErrorThatRequiresNavigat
189189

190190
return exception.DisplayErrorMessage(
191191
errorType,
192-
new object[] { },
192+
Array.Empty<object>(),
193193
new[] { OpenBrowser("View Plans", account.Billing()), Cancel });
194194
}
195195

src/GitHub.App/ViewModels/Dialog/RepositoryCreationViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public async Task InitializeAsync(IConnection connection)
182182

183183
accounts = modelService.GetAccounts()
184184
.ObserveOn(RxApp.MainThreadScheduler)
185-
.ToProperty(this, vm => vm.Accounts, initialValue: new ReadOnlyCollection<IAccount>(new IAccount[] { }));
185+
.ToProperty(this, vm => vm.Accounts, initialValue: new ReadOnlyCollection<IAccount>(Array.Empty<IAccount>()));
186186

187187
this.WhenAny(x => x.Accounts, x => x.Value)
188188
.Select(accts => accts?.FirstOrDefault())

src/GitHub.App/ViewModels/GitHubPane/PullRequestCheckViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static IEnumerable<IPullRequestCheckViewModel> Build(IViewViewModelFactor
5151
pullRequestCheckViewModel.DetailsUrl = !string.IsNullOrEmpty(model.TargetUrl) ? new Uri(model.TargetUrl) : null;
5252

5353
return pullRequestCheckViewModel;
54-
}) ?? new PullRequestCheckViewModel[0];
54+
}) ?? Array.Empty<PullRequestCheckViewModel>();
5555

5656
var checks = pullRequest.CheckSuites?.SelectMany(model => model.CheckRuns)
5757
.Select(model =>
@@ -97,7 +97,7 @@ public static IEnumerable<IPullRequestCheckViewModel> Build(IViewViewModelFactor
9797
pullRequestCheckViewModel.DetailsUrl = new Uri(model.DetailsUrl);
9898

9999
return pullRequestCheckViewModel;
100-
}) ?? new PullRequestCheckViewModel[0];
100+
}) ?? Array.Empty<PullRequestCheckViewModel>();
101101

102102
return statuses.Concat(checks).OrderBy(model => model.Title);
103103
}

src/GitHub.App/ViewModels/TeamExplorer/RepositoryPublishViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public RepositoryPublishViewModel(
7272
.SelectMany(async c => (await modelServiceFactory.CreateAsync(c)).GetAccounts())
7373
.Switch()
7474
.ObserveOn(RxApp.MainThreadScheduler)
75-
.ToProperty(this, x => x.Accounts, initialValue: new ReadOnlyCollection<IAccount>(new IAccount[] {}));
75+
.ToProperty(this, x => x.Accounts, initialValue: new ReadOnlyCollection<IAccount>(Array.Empty<IAccount>()));
7676

7777
this.WhenAny(x => x.Accounts, x => x.Value)
7878
.WhereNotNull()

src/GitHub.Exports.Reactive/Collections/TrackingCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static ObservableCollection<T> CreateListenerCollection<T>(this ITracking
5252
{
5353
if (stickieItemsOnTop == null)
5454
{
55-
stickieItemsOnTop = new T[0];
55+
stickieItemsOnTop = Array.Empty<T>();
5656
}
5757

5858
var col = new ObservableCollection<T>(stickieItemsOnTop.Concat(tcol));

test/GitHub.App.UnitTests/Models/AccountModelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static bool BitmapSourcesAreEqual(BitmapSource image1, BitmapSource image
120120

121121
public static byte[] BitmapSourceToBytes(BitmapSource image)
122122
{
123-
byte[] data = new byte[] { };
123+
byte[] data = Array.Empty<byte>();
124124
if (image != null)
125125
{
126126
try

test/GitHub.App.UnitTests/Services/TeamExplorerContextTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static IVSGitExt CreateGitExt()
245245

246246
static void SetActiveRepository(IVSGitExt gitExt, ILocalRepositoryModel repo)
247247
{
248-
var repos = repo != null ? new[] { repo } : new ILocalRepositoryModel[0];
248+
var repos = repo != null ? new[] { repo } : Array.Empty<ILocalRepositoryModel>();
249249
gitExt.ActiveRepositories.Returns(repos);
250250
gitExt.ActiveRepositoriesChanged += Raise.Event<Action>();
251251
}

0 commit comments

Comments
 (0)