@@ -42,6 +42,7 @@ public async Task ExecCommand_WhenNoProjectFileFound_ReturnsFailedToFindProject(
42
42
using var workspace = TemporaryWorkspace . Create ( _outputHelper ) ;
43
43
var services = CliTestHelper . CreateServiceCollection ( workspace , _outputHelper , options =>
44
44
{
45
+ options . EnabledFeatures = [ KnownFeatures . ExecCommandEnabled ] ;
45
46
options . ProjectLocatorFactory = _ => new NoProjectFileProjectLocator ( ) ;
46
47
} ) ;
47
48
var provider = services . BuildServiceProvider ( ) ;
@@ -59,6 +60,7 @@ public async Task ExecCommand_WhenMultipleProjectFilesFound_ReturnsFailedToFindP
59
60
using var workspace = TemporaryWorkspace . Create ( _outputHelper ) ;
60
61
var services = CliTestHelper . CreateServiceCollection ( workspace , _outputHelper , options =>
61
62
{
63
+ options . EnabledFeatures = [ KnownFeatures . ExecCommandEnabled ] ;
62
64
options . ProjectLocatorFactory = _ => new MultipleProjectFilesProjectLocator ( ) ;
63
65
} ) ;
64
66
var provider = services . BuildServiceProvider ( ) ;
@@ -76,6 +78,7 @@ public async Task ExecCommand_WhenProjectFileDoesNotExist_ReturnsFailedToFindPro
76
78
using var workspace = TemporaryWorkspace . Create ( _outputHelper ) ;
77
79
var services = CliTestHelper . CreateServiceCollection ( workspace , _outputHelper , options =>
78
80
{
81
+ options . EnabledFeatures = [ KnownFeatures . ExecCommandEnabled ] ;
79
82
options . ProjectLocatorFactory = _ => new ProjectFileDoesNotExistLocator ( ) ;
80
83
} ) ;
81
84
var provider = services . BuildServiceProvider ( ) ;
@@ -87,6 +90,29 @@ public async Task ExecCommand_WhenProjectFileDoesNotExist_ReturnsFailedToFindPro
87
90
Assert . Equal ( ExitCodeConstants . FailedToFindProject , exitCode ) ;
88
91
}
89
92
93
+ [ Fact ]
94
+ public async Task ExecCommand_WhenFeatureFlagEnabled_CommandAvailable ( )
95
+ {
96
+ using var workspace = TemporaryWorkspace . Create ( _outputHelper ) ;
97
+ var services = CliTestHelper . CreateServiceCollection ( workspace , _outputHelper , options =>
98
+ {
99
+ options . EnabledFeatures = [ KnownFeatures . ExecCommandEnabled ] ;
100
+ } ) ;
101
+ var provider = services . BuildServiceProvider ( ) ;
102
+
103
+ var command = provider . GetRequiredService < RootCommand > ( ) ;
104
+ var commandLineConfiguration = new CommandLineConfiguration ( command ) ;
105
+ var testOutputWriter = new TestOutputTextWriter ( _outputHelper ) ;
106
+ commandLineConfiguration . Output = testOutputWriter ;
107
+
108
+ var result = command . Parse ( "exec --help" , commandLineConfiguration ) ;
109
+
110
+ var exitCode = await result . InvokeAsync ( ) . WaitAsync ( CliTestConstants . DefaultTimeout ) ;
111
+
112
+ // Should succeed because exec command is registered when feature flag is enabled
113
+ Assert . Equal ( ExitCodeConstants . Success , exitCode ) ;
114
+ }
115
+
90
116
[ Fact ]
91
117
public async Task ExecCommand_WhenTargetResourceNotSpecified_ReturnsInvalidCommand ( )
92
118
{
@@ -117,6 +143,7 @@ public async Task ExecCommand_ExecutesSuccessfully()
117
143
using var workspace = TemporaryWorkspace . Create ( _outputHelper ) ;
118
144
var services = CliTestHelper . CreateServiceCollection ( workspace , _outputHelper , options =>
119
145
{
146
+ options . EnabledFeatures = [ KnownFeatures . ExecCommandEnabled ] ;
120
147
options . ProjectLocatorFactory = _ => new TestProjectLocator ( ) ;
121
148
122
149
options . DotNetCliRunnerFactory = _ => new TestDotNetCliRunner
0 commit comments