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