Skip to content

Commit 9fe83d1

Browse files
committed
Fix broken tests.
1 parent caaa534 commit 9fe83d1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using Aspire.Cli.Builds;
45
using Aspire.Cli.Certificates;
56
using Aspire.Cli.Commands;
67
using Aspire.Cli.Interaction;
@@ -20,6 +21,7 @@ public static IServiceCollection CreateServiceCollection(Action<CliServiceCollec
2021
var services = new ServiceCollection();
2122
services.AddLogging();
2223

24+
services.AddSingleton(options.AppHostBuilderFactory);
2325
services.AddSingleton(options.ProjectLocatorFactory);
2426
services.AddSingleton(options.InteractiveServiceFactory);
2527
services.AddSingleton(options.CertificateServiceFactory);
@@ -38,6 +40,12 @@ public static IServiceCollection CreateServiceCollection(Action<CliServiceCollec
3840

3941
internal sealed class CliServiceCollectionTestOptions
4042
{
43+
public Func<IServiceProvider, IAppHostBuilder> AppHostBuilderFactory { get; set; } = (IServiceProvider serviceProvider) => {
44+
var logger = serviceProvider.GetRequiredService<ILogger<AppHostBuilder>>();
45+
var runner = serviceProvider.GetRequiredService<IDotNetCliRunner>();
46+
return new AppHostBuilder(logger, runner);
47+
};
48+
4149
public Func<IServiceProvider, INewCommandPrompter> NewCommandPrompterFactory { get; set; } = (IServiceProvider serviceProvider) =>
4250
{
4351
var interactionService = serviceProvider.GetRequiredService<IInteractionService>();

0 commit comments

Comments
 (0)