File tree 1 file changed +8
-0
lines changed
tests/Aspire.Cli.Tests/Utils
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
+ using Aspire . Cli . Builds ;
4
5
using Aspire . Cli . Certificates ;
5
6
using Aspire . Cli . Commands ;
6
7
using Aspire . Cli . Interaction ;
@@ -20,6 +21,7 @@ public static IServiceCollection CreateServiceCollection(Action<CliServiceCollec
20
21
var services = new ServiceCollection ( ) ;
21
22
services . AddLogging ( ) ;
22
23
24
+ services . AddSingleton ( options . AppHostBuilderFactory ) ;
23
25
services . AddSingleton ( options . ProjectLocatorFactory ) ;
24
26
services . AddSingleton ( options . InteractiveServiceFactory ) ;
25
27
services . AddSingleton ( options . CertificateServiceFactory ) ;
@@ -38,6 +40,12 @@ public static IServiceCollection CreateServiceCollection(Action<CliServiceCollec
38
40
39
41
internal sealed class CliServiceCollectionTestOptions
40
42
{
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
+
41
49
public Func < IServiceProvider , INewCommandPrompter > NewCommandPrompterFactory { get ; set ; } = ( IServiceProvider serviceProvider ) =>
42
50
{
43
51
var interactionService = serviceProvider . GetRequiredService < IInteractionService > ( ) ;
You can’t perform that action at this time.
0 commit comments