@@ -18,13 +18,13 @@ public async Task RunUserSecretsTest(string language, string testName)
1818 var port = ProcessHelper . GetAvailablePort ( ) ;
1919
2020 // Initialize dotnet function app using retry helper
21- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , language } ) ;
21+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , language ] ) ;
2222
2323 // Add HTTP trigger using retry helper
24- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , "http1" } ) ;
24+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , "http1" ] ) ;
2525
2626 // Add Queue trigger using retry helper
27- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "QueueTrigger" , "--name" , "queue1" } ) ;
27+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "QueueTrigger" , "--name" , "queue1" ] ) ;
2828
2929 // Modify queue code to use connection string
3030 var queueCodePath = Path . Combine ( WorkingDirectory , "queue1.cs" ) ;
@@ -66,7 +66,7 @@ public async Task RunUserSecretsTest(string language, string testName)
6666
6767 var result = funcStartCommand
6868 . WithWorkingDirectory ( WorkingDirectory )
69- . Execute ( new [ ] { "start" , "--build" , "--port" , port . ToString ( ) } ) ;
69+ . Execute ( [ "start" , "--build" , "--port" , port . ToString ( ) ] ) ;
7070
7171 // Validate user secrets are used
7272 result . Should ( ) . HaveStdOutContaining ( "Using for user secrets file configuration." ) ;
@@ -84,13 +84,13 @@ public async Task RunMissingStorageConnString_FailsWithExpectedError(string lang
8484 int port = ProcessHelper . GetAvailablePort ( ) ;
8585
8686 // Initialize dotnet function app using retry helper
87- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , languageWorker } ) ;
87+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , languageWorker ] ) ;
8888
8989 // Add HTTP trigger using retry helper
90- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , "http1" } ) ;
90+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , "http1" ] ) ;
9191
9292 // Add Queue trigger using retry helper
93- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "QueueTrigger" , "--name" , "queue1" } ) ;
93+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "QueueTrigger" , "--name" , "queue1" ] ) ;
9494
9595 // Modify queue code to use connection string
9696 var queueCodePath = Path . Combine ( WorkingDirectory , "queue1.cs" ) ;
@@ -114,7 +114,7 @@ public async Task RunMissingStorageConnString_FailsWithExpectedError(string lang
114114 // Call func start for HTTP function only
115115 var result = new FuncStartCommand ( FuncPath , testName , Log ?? throw new ArgumentNullException ( nameof ( Log ) ) )
116116 . WithWorkingDirectory ( WorkingDirectory )
117- . Execute ( new [ ] { "start" , "--functions" , "http1" , "--port" , port . ToString ( ) } ) ;
117+ . Execute ( [ "start" , "--functions" , "http1" , "--port" , port . ToString ( ) ] ) ;
118118
119119 // Validate error message
120120 result . Should ( ) . HaveStdOutContaining ( "Missing value for AzureWebJobsStorage in local.settings.json" ) ;
@@ -133,13 +133,13 @@ public async Task RunWithUserSecrets_MissingBindingSetting_FailsWithExpectedErro
133133 var port = ProcessHelper . GetAvailablePort ( ) ;
134134
135135 // Initialize dotnet function app using retry helper
136- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , languageWorker } ) ;
136+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , languageWorker ] ) ;
137137
138138 // Add HTTP trigger using retry helper
139- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , "http1" } ) ;
139+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , "http1" ] ) ;
140140
141141 // Add Queue trigger using retry helper
142- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "QueueTrigger" , "--name" , "queue1" } ) ;
142+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "QueueTrigger" , "--name" , "queue1" ] ) ;
143143
144144 // Modify queue code to use connection string
145145 var queueCodePath = Path . Combine ( WorkingDirectory , "queue1.cs" ) ;
@@ -170,7 +170,7 @@ public async Task RunWithUserSecrets_MissingBindingSetting_FailsWithExpectedErro
170170
171171 var result = funcStartCommand
172172 . WithWorkingDirectory ( WorkingDirectory )
173- . Execute ( new [ ] { "--port" , port . ToString ( ) } ) ;
173+ . Execute ( [ "--port" , port . ToString ( ) ] ) ;
174174
175175 // Validate warning message about missing connection string
176176 result . Should ( ) . HaveStdOutContaining ( "Warning: Cannot find value named 'ConnectionStrings:MyQueueConn' in local.settings.json" ) ;
@@ -206,10 +206,8 @@ private void SetupUserSecrets(Dictionary<string, string> secrets)
206206 UseShellExecute = false
207207 } ;
208208
209- using ( var process = Process . Start ( setProcess ) )
210- {
211- process ? . WaitForExit ( ) ;
212- }
209+ using var process = Process . Start ( setProcess ) ;
210+ process ? . WaitForExit ( ) ;
213211 }
214212 }
215213
@@ -231,10 +229,10 @@ public async Task Start_MissingLocalSettingsJson_BehavesAsExpected(string langua
231229 var port = ProcessHelper . GetAvailablePort ( ) ;
232230
233231 // Initialize function app using retry helper
234- await FuncInitWithRetryAsync ( logFileName , new [ ] { "." , "--worker-runtime" , language } ) ;
232+ await FuncInitWithRetryAsync ( logFileName , [ "." , "--worker-runtime" , language ] ) ;
235233
236234 var funcNewArgs = new [ ] { "." , "--template" , "HttpTrigger" , "--name" , "HttpTriggerFunc" }
237- . Concat ( ! language . Contains ( "dotnet" ) ? new [ ] { "--language" , language } : Array . Empty < string > ( ) )
235+ . Concat ( ! language . Contains ( "dotnet" ) ? [ "--language" , language ] : Array . Empty < string > ( ) )
238236 . ToArray ( ) ;
239237
240238 // Add HTTP trigger using retry helper
@@ -260,7 +258,7 @@ public async Task Start_MissingLocalSettingsJson_BehavesAsExpected(string langua
260258
261259 var result = funcStartCommand
262260 . WithWorkingDirectory ( WorkingDirectory )
263- . Execute ( startCommand . ToArray ( ) ) ;
261+ . Execute ( [ .. startCommand ] ) ;
264262
265263 // Validate output contains expected function URL
266264 if ( invokeFunction )
@@ -288,10 +286,10 @@ public async Task Start_LanguageWorker_InvalidFunctionJson_FailsWithExpectedErro
288286 var testName = nameof ( Start_LanguageWorker_InvalidFunctionJson_FailsWithExpectedError ) ;
289287
290288 // Initialize Node.js function app using retry helper
291- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , "node" , "-m" , "v3" } ) ;
289+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , "node" , "-m" , "v3" ] ) ;
292290
293291 // Add HTTP trigger using retry helper
294- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , functionName , "--language" , "node" } , workerRuntime : "node" ) ;
292+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , functionName , "--language" , "node" ] , workerRuntime : "node" ) ;
295293
296294 // Modify function.json to include an invalid binding type
297295 var filePath = Path . Combine ( WorkingDirectory , functionName , "function.json" ) ;
@@ -310,7 +308,7 @@ public async Task Start_LanguageWorker_InvalidFunctionJson_FailsWithExpectedErro
310308 var result = funcStartCommand
311309 . WithWorkingDirectory ( WorkingDirectory )
312310 . WithEnvironmentVariable ( Common . Constants . FunctionsWorkerRuntime , "node" )
313- . Execute ( new [ ] { "--port" , port . ToString ( ) , "--verbose" } ) ;
311+ . Execute ( [ "--port" , port . ToString ( ) , "--verbose" ] ) ;
314312
315313 // Validate error message
316314 result . Should ( ) . HaveStdOutContaining ( "The binding type(s) 'http2' were not found in the configured extension bundle. Please ensure the type is correct and the correct version of extension bundle is configured." ) ;
@@ -323,15 +321,15 @@ public async Task Start_EmptyEnvVars_HandledAsExpected()
323321 var testName = nameof ( Start_EmptyEnvVars_HandledAsExpected ) ;
324322
325323 // Initialize Node.js function app using retry helper
326- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , "node" , "-m" , "v4" } ) ;
324+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , "node" , "-m" , "v4" ] ) ;
327325
328326 // Add HTTP trigger using retry helper
329- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , "HttpTrigger" , "--language" , "node" } , workerRuntime : "node" ) ;
327+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , "HttpTrigger" , "--language" , "node" ] , workerRuntime : "node" ) ;
330328
331329 // Add empty setting
332330 var funcSettingsResult = new FuncSettingsCommand ( FuncPath , testName , Log ?? throw new ArgumentNullException ( nameof ( Log ) ) )
333331 . WithWorkingDirectory ( WorkingDirectory )
334- . Execute ( new [ ] { "add" , "emptySetting" , "EMPTY_VALUE" } ) ;
332+ . Execute ( [ "add" , "emptySetting" , "EMPTY_VALUE" ] ) ;
335333 funcSettingsResult . Should ( ) . ExitWith ( 0 ) ;
336334
337335 // Modify settings file to have empty value
@@ -351,7 +349,7 @@ public async Task Start_EmptyEnvVars_HandledAsExpected()
351349 var result = funcStartCommand
352350 . WithWorkingDirectory ( WorkingDirectory )
353351 . WithEnvironmentVariable ( Common . Constants . FunctionsWorkerRuntime , "node" )
354- . Execute ( new [ ] { "--port" , port . ToString ( ) , "--verbose" } ) ;
352+ . Execute ( [ "--port" , port . ToString ( ) , "--verbose" ] ) ;
355353
356354 // Validate function works and doesn't show skipping message
357355 result . Should ( ) . NotHaveStdOutContaining ( "Skipping 'emptySetting' from local settings as it's already defined in current environment variables." ) ;
0 commit comments