@@ -18,7 +18,7 @@ public async Task DeployCommandWithHelpArgumentReturnsZero()
18
18
{
19
19
using var tempRepo = TemporaryWorkspace . Create ( outputHelper ) ;
20
20
21
- var services = CliTestHelper . CreateServiceCollection ( tempRepo , outputHelper ) ;
21
+ var services = CliTestHelper . CreateServiceCollection ( tempRepo , outputHelper , options => options . EnabledFeatures = [ KnownFeatures . DeployCommandEnabled ] ) ;
22
22
var provider = services . BuildServiceProvider ( ) ;
23
23
24
24
var command = provider . GetRequiredService < RootCommand > ( ) ;
@@ -36,6 +36,7 @@ public async Task DeployCommandFailsWithInvalidProjectFile()
36
36
// Arrange
37
37
var services = CliTestHelper . CreateServiceCollection ( tempRepo , outputHelper , options =>
38
38
{
39
+ options . EnabledFeatures = [ KnownFeatures . DeployCommandEnabled ] ;
39
40
options . DotNetCliRunnerFactory = ( sp ) =>
40
41
{
41
42
var runner = new TestDotNetCliRunner
@@ -69,7 +70,7 @@ public async Task DeployCommandFailsWhenAppHostIsNotCompatible()
69
70
var services = CliTestHelper . CreateServiceCollection ( tempRepo , outputHelper , options =>
70
71
{
71
72
options . ProjectLocatorFactory = ( sp ) => new TestProjectLocator ( ) ;
72
-
73
+ options . EnabledFeatures = [ KnownFeatures . DeployCommandEnabled ] ;
73
74
options . DotNetCliRunnerFactory = ( sp ) =>
74
75
{
75
76
var runner = new TestDotNetCliRunner
@@ -103,7 +104,7 @@ public async Task DeployCommandFailsWhenAppHostBuildFails()
103
104
var services = CliTestHelper . CreateServiceCollection ( tempRepo , outputHelper , options =>
104
105
{
105
106
options . ProjectLocatorFactory = ( sp ) => new TestProjectLocator ( ) ;
106
-
107
+ options . EnabledFeatures = [ KnownFeatures . DeployCommandEnabled ] ;
107
108
options . DotNetCliRunnerFactory = ( sp ) =>
108
109
{
109
110
var runner = new TestDotNetCliRunner
@@ -137,7 +138,7 @@ public async Task DeployCommandSucceedsEndToEnd()
137
138
var services = CliTestHelper . CreateServiceCollection ( tempRepo , outputHelper , options =>
138
139
{
139
140
options . ProjectLocatorFactory = ( sp ) => new TestProjectLocator ( ) ;
140
-
141
+ options . EnabledFeatures = [ KnownFeatures . DeployCommandEnabled ] ;
141
142
options . DotNetCliRunnerFactory = ( sp ) =>
142
143
{
143
144
var runner = new TestDotNetCliRunner
@@ -201,7 +202,7 @@ public async Task DeployCommandIncludesDeployFlagInArguments()
201
202
var services = CliTestHelper . CreateServiceCollection ( tempRepo , outputHelper , options =>
202
203
{
203
204
options . ProjectLocatorFactory = ( sp ) => new TestProjectLocator ( ) ;
204
-
205
+ options . EnabledFeatures = [ KnownFeatures . DeployCommandEnabled ] ;
205
206
options . DotNetCliRunnerFactory = ( sp ) =>
206
207
{
207
208
var runner = new TestDotNetCliRunner
@@ -257,6 +258,38 @@ public async Task DeployCommandIncludesDeployFlagInArguments()
257
258
// Assert
258
259
Assert . Equal ( 0 , exitCode ) ;
259
260
}
261
+
262
+ [ Fact ]
263
+ public void DeployCommand_WhenFeatureFlagDisabled_IsNotAvailable ( )
264
+ {
265
+ using var workspace = TemporaryWorkspace . Create ( outputHelper ) ;
266
+ var services = CliTestHelper . CreateServiceCollection ( workspace , outputHelper ) ;
267
+ var provider = services . BuildServiceProvider ( ) ;
268
+
269
+ var command = provider . GetRequiredService < RootCommand > ( ) ;
270
+
271
+ // Check that the deploy command is not available in the subcommands
272
+ var deployCommand = command . Subcommands . FirstOrDefault ( c => c . Name == "deploy" ) ;
273
+ Assert . Null ( deployCommand ) ;
274
+ }
275
+
276
+ [ Fact ]
277
+ public void DeployCommand_WhenFeatureFlagEnabled_IsAvailable ( )
278
+ {
279
+ using var workspace = TemporaryWorkspace . Create ( outputHelper ) ;
280
+ var services = CliTestHelper . CreateServiceCollection (
281
+ workspace ,
282
+ outputHelper ,
283
+ options => options . EnabledFeatures = [ KnownFeatures . DeployCommandEnabled ]
284
+ ) ;
285
+ var provider = services . BuildServiceProvider ( ) ;
286
+
287
+ var command = provider . GetRequiredService < RootCommand > ( ) ;
288
+
289
+ // Check that the deploy command is available in the subcommands
290
+ var deployCommand = command . Subcommands . FirstOrDefault ( c => c . Name == "deploy" ) ;
291
+ Assert . NotNull ( deployCommand ) ;
292
+ }
260
293
}
261
294
262
295
internal sealed class TestDeployCommandPrompter ( IInteractionService interactionService ) : PublishCommandPrompter ( interactionService )
0 commit comments