@@ -18,13 +18,13 @@ public async Task RunUserSecretsTest(string language, string testName)
18
18
var port = ProcessHelper . GetAvailablePort ( ) ;
19
19
20
20
// Initialize dotnet function app using retry helper
21
- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , language } ) ;
21
+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , language ] ) ;
22
22
23
23
// Add HTTP trigger using retry helper
24
- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , "http1" } ) ;
24
+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , "http1" ] ) ;
25
25
26
26
// Add Queue trigger using retry helper
27
- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "QueueTrigger" , "--name" , "queue1" } ) ;
27
+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "QueueTrigger" , "--name" , "queue1" ] ) ;
28
28
29
29
// Modify queue code to use connection string
30
30
var queueCodePath = Path . Combine ( WorkingDirectory , "queue1.cs" ) ;
@@ -66,7 +66,7 @@ public async Task RunUserSecretsTest(string language, string testName)
66
66
67
67
var result = funcStartCommand
68
68
. WithWorkingDirectory ( WorkingDirectory )
69
- . Execute ( new [ ] { "start" , "--build" , "--port" , port . ToString ( ) } ) ;
69
+ . Execute ( [ "start" , "--build" , "--port" , port . ToString ( ) ] ) ;
70
70
71
71
// Validate user secrets are used
72
72
result . Should ( ) . HaveStdOutContaining ( "Using for user secrets file configuration." ) ;
@@ -84,13 +84,13 @@ public async Task RunMissingStorageConnString_FailsWithExpectedError(string lang
84
84
int port = ProcessHelper . GetAvailablePort ( ) ;
85
85
86
86
// Initialize dotnet function app using retry helper
87
- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , languageWorker } ) ;
87
+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , languageWorker ] ) ;
88
88
89
89
// Add HTTP trigger using retry helper
90
- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , "http1" } ) ;
90
+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , "http1" ] ) ;
91
91
92
92
// Add Queue trigger using retry helper
93
- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "QueueTrigger" , "--name" , "queue1" } ) ;
93
+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "QueueTrigger" , "--name" , "queue1" ] ) ;
94
94
95
95
// Modify queue code to use connection string
96
96
var queueCodePath = Path . Combine ( WorkingDirectory , "queue1.cs" ) ;
@@ -114,7 +114,7 @@ public async Task RunMissingStorageConnString_FailsWithExpectedError(string lang
114
114
// Call func start for HTTP function only
115
115
var result = new FuncStartCommand ( FuncPath , testName , Log ?? throw new ArgumentNullException ( nameof ( Log ) ) )
116
116
. WithWorkingDirectory ( WorkingDirectory )
117
- . Execute ( new [ ] { "start" , "--functions" , "http1" , "--port" , port . ToString ( ) } ) ;
117
+ . Execute ( [ "start" , "--functions" , "http1" , "--port" , port . ToString ( ) ] ) ;
118
118
119
119
// Validate error message
120
120
result . Should ( ) . HaveStdOutContaining ( "Missing value for AzureWebJobsStorage in local.settings.json" ) ;
@@ -133,13 +133,13 @@ public async Task RunWithUserSecrets_MissingBindingSetting_FailsWithExpectedErro
133
133
var port = ProcessHelper . GetAvailablePort ( ) ;
134
134
135
135
// Initialize dotnet function app using retry helper
136
- await FuncInitWithRetryAsync ( testName , new [ ] { "." , "--worker-runtime" , languageWorker } ) ;
136
+ await FuncInitWithRetryAsync ( testName , [ "." , "--worker-runtime" , languageWorker ] ) ;
137
137
138
138
// Add HTTP trigger using retry helper
139
- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "Httptrigger" , "--name" , "http1" } ) ;
139
+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "Httptrigger" , "--name" , "http1" ] ) ;
140
140
141
141
// Add Queue trigger using retry helper
142
- await FuncNewWithRetryAsync ( testName , new [ ] { "." , "--template" , "QueueTrigger" , "--name" , "queue1" } ) ;
142
+ await FuncNewWithRetryAsync ( testName , [ "." , "--template" , "QueueTrigger" , "--name" , "queue1" ] ) ;
143
143
144
144
// Modify queue code to use connection string
145
145
var queueCodePath = Path . Combine ( WorkingDirectory , "queue1.cs" ) ;
@@ -170,7 +170,7 @@ public async Task RunWithUserSecrets_MissingBindingSetting_FailsWithExpectedErro
170
170
171
171
var result = funcStartCommand
172
172
. WithWorkingDirectory ( WorkingDirectory )
173
- . Execute ( new [ ] { "--port" , port . ToString ( ) } ) ;
173
+ . Execute ( [ "--port" , port . ToString ( ) ] ) ;
174
174
175
175
// Validate warning message about missing connection string
176
176
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)
206
206
UseShellExecute = false
207
207
} ;
208
208
209
- using ( var process = Process . Start ( setProcess ) )
210
- {
211
- process ? . WaitForExit ( ) ;
212
- }
209
+ using var process = Process . Start ( setProcess ) ;
210
+ process ? . WaitForExit ( ) ;
213
211
}
214
212
}
215
213
@@ -231,10 +229,10 @@ public async Task Start_MissingLocalSettingsJson_BehavesAsExpected(string langua
231
229
var port = ProcessHelper . GetAvailablePort ( ) ;
232
230
233
231
// Initialize function app using retry helper
234
- await FuncInitWithRetryAsync ( logFileName , new [ ] { "." , "--worker-runtime" , language } ) ;
232
+ await FuncInitWithRetryAsync ( logFileName , [ "." , "--worker-runtime" , language ] ) ;
235
233
236
234
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 > ( ) )
238
236
. ToArray ( ) ;
239
237
240
238
// Add HTTP trigger using retry helper
@@ -260,7 +258,7 @@ public async Task Start_MissingLocalSettingsJson_BehavesAsExpected(string langua
260
258
261
259
var result = funcStartCommand
262
260
. WithWorkingDirectory ( WorkingDirectory )
263
- . Execute ( startCommand . ToArray ( ) ) ;
261
+ . Execute ( [ .. startCommand ] ) ;
264
262
265
263
// Validate output contains expected function URL
266
264
if ( invokeFunction )
@@ -288,10 +286,10 @@ public async Task Start_LanguageWorker_InvalidFunctionJson_FailsWithExpectedErro
288
286
var testName = nameof ( Start_LanguageWorker_InvalidFunctionJson_FailsWithExpectedError ) ;
289
287
290
288
// 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" ] ) ;
292
290
293
291
// 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" ) ;
295
293
296
294
// Modify function.json to include an invalid binding type
297
295
var filePath = Path . Combine ( WorkingDirectory , functionName , "function.json" ) ;
@@ -310,7 +308,7 @@ public async Task Start_LanguageWorker_InvalidFunctionJson_FailsWithExpectedErro
310
308
var result = funcStartCommand
311
309
. WithWorkingDirectory ( WorkingDirectory )
312
310
. WithEnvironmentVariable ( Common . Constants . FunctionsWorkerRuntime , "node" )
313
- . Execute ( new [ ] { "--port" , port . ToString ( ) , "--verbose" } ) ;
311
+ . Execute ( [ "--port" , port . ToString ( ) , "--verbose" ] ) ;
314
312
315
313
// Validate error message
316
314
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()
323
321
var testName = nameof ( Start_EmptyEnvVars_HandledAsExpected ) ;
324
322
325
323
// 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" ] ) ;
327
325
328
326
// 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" ) ;
330
328
331
329
// Add empty setting
332
330
var funcSettingsResult = new FuncSettingsCommand ( FuncPath , testName , Log ?? throw new ArgumentNullException ( nameof ( Log ) ) )
333
331
. WithWorkingDirectory ( WorkingDirectory )
334
- . Execute ( new [ ] { "add" , "emptySetting" , "EMPTY_VALUE" } ) ;
332
+ . Execute ( [ "add" , "emptySetting" , "EMPTY_VALUE" ] ) ;
335
333
funcSettingsResult . Should ( ) . ExitWith ( 0 ) ;
336
334
337
335
// Modify settings file to have empty value
@@ -351,7 +349,7 @@ public async Task Start_EmptyEnvVars_HandledAsExpected()
351
349
var result = funcStartCommand
352
350
. WithWorkingDirectory ( WorkingDirectory )
353
351
. WithEnvironmentVariable ( Common . Constants . FunctionsWorkerRuntime , "node" )
354
- . Execute ( new [ ] { "--port" , port . ToString ( ) , "--verbose" } ) ;
352
+ . Execute ( [ "--port" , port . ToString ( ) , "--verbose" ] ) ;
355
353
356
354
// Validate function works and doesn't show skipping message
357
355
result . Should ( ) . NotHaveStdOutContaining ( "Skipping 'emptySetting' from local settings as it's already defined in current environment variables." ) ;
0 commit comments