@@ -13,6 +13,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.AddVerbWithoutSupportsShouldP
13
13
/// Check if a cmdlet that has Verbs that require ShouldProcess has ShouldProcess parameter
14
14
/// </summary>
15
15
[ Cmdlet ( VerbsCommon . Add , "AddVerbWithoutSupportsShouldProcessParameter" ) ]
16
+ [ OutputType ( typeof ( bool ) ) ]
16
17
public class AddVerbWithoutSupportsShouldProcessParameter : Cmdlet
17
18
{
18
19
/// <summary>
@@ -42,6 +43,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.AddVerbWithSupportsShouldProc
42
43
/// Check if a cmdlet that has Verbs that require ShouldProcess has ShouldProcess parameter
43
44
/// </summary>
44
45
[ Cmdlet ( VerbsCommon . Add , "AddVerbWithSupportsShouldProcessParameter" , SupportsShouldProcess = true ) ]
46
+ [ OutputType ( typeof ( bool ) ) ]
45
47
public class AddVerbWithSupportsShouldProcessParameter : Cmdlet
46
48
{
47
49
/// <summary>
@@ -73,6 +75,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.ForceParameterWithoutSupports
73
75
/// Verify if cmdlet that has Force parameter should also define SupportsShouldProcess parameter
74
76
/// </summary>
75
77
[ Cmdlet ( VerbsDiagnostic . Test , "ForceParameterWithoutSupportsShouldProcess" ) ]
78
+ [ OutputType ( typeof ( bool ) ) ]
76
79
public class ForceParameterWithoutSupportsShouldProcess : Cmdlet
77
80
{
78
81
/// <summary>
@@ -108,6 +111,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.ForceParameterWithSupportsSho
108
111
/// Verify if cmdlet that has Force parameter should also define SupportsShouldProcess parameter
109
112
/// </summary>
110
113
[ Cmdlet ( VerbsDiagnostic . Test , "ForceParameterWithSupportsShouldProcess" , SupportsShouldProcess = true ) ]
114
+ [ OutputType ( typeof ( bool ) ) ]
111
115
public class ForceParameterWithSupportsShouldProcess : Cmdlet
112
116
{
113
117
/// <summary>
@@ -137,6 +141,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.ConfirmImpactWithoutSupportsS
137
141
/// Verify if cmdlet that has Force parameter should also define SupportsShouldProcess parameter
138
142
/// </summary>
139
143
[ Cmdlet ( VerbsDiagnostic . Test , "ConfirmImpactWithoutSupportsShouldProcess" , ConfirmImpact = ConfirmImpact . High ) ]
144
+ [ OutputType ( typeof ( bool ) ) ]
140
145
public class ConfirmImpactWithoutSupportsShouldProcess : Cmdlet
141
146
{
142
147
/// <summary>
@@ -158,6 +163,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.ConfirmImpactWithSupportsShou
158
163
/// Verify if cmdlet that has Force parameter should also define SupportsShouldProcess parameter
159
164
/// </summary>
160
165
[ Cmdlet ( VerbsDiagnostic . Test , "ConfirmImpactWithSupportsShouldProcess" , ConfirmImpact = ConfirmImpact . Medium , SupportsShouldProcess = true ) ]
166
+ [ OutputType ( typeof ( bool ) ) ]
161
167
public class ConfirmImpactWithSupportsShouldProcess : Cmdlet
162
168
{
163
169
/// <summary>
@@ -187,6 +193,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.ShouldContinueVerbWithForceSw
187
193
/// Verify if cmdlet that has Force parameter should also define SupportsShouldProcess parameter
188
194
/// </summary>
189
195
[ Cmdlet ( VerbsCommon . Copy , "ShouldContinueVerbWithForceSwitch" , SupportsShouldProcess = true ) ]
196
+ [ OutputType ( typeof ( bool ) ) ]
190
197
public class ShouldContinueVerbWithForceSwitch : Cmdlet
191
198
{
192
199
/// <summary>
@@ -216,6 +223,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.CmdletWithApprovedVerb
216
223
/// Verify if a cmdlet has an approved verb in its name.
217
224
/// </summary>
218
225
[ Cmdlet ( VerbsCommon . Get , "SampleCmdlet" ) ]
226
+ [ OutputType ( typeof ( bool ) ) ]
219
227
public class CmdletWithApprovedVerb : Cmdlet
220
228
{
221
229
/// <summary>
@@ -237,6 +245,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.CmdletWithUnapprovedVerb
237
245
/// Verify if a cmdlet has an approved verb in its name.
238
246
/// </summary>
239
247
[ Cmdlet ( "Prepare" , "SampleCmdlet" ) ]
248
+ [ OutputType ( typeof ( bool ) ) ]
240
249
public class CmdletWithUnapprovedVerb : Cmdlet
241
250
{
242
251
/// <summary>
@@ -260,6 +269,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.CmdletWithSingularNoun
260
269
/// Verify if a cmdlet has a singular noun in its name.
261
270
/// </summary>
262
271
[ Cmdlet ( VerbsCommon . Get , "SampleKey" ) ]
272
+ [ OutputType ( typeof ( bool ) ) ]
263
273
public class CmdletGetSampleKey : Cmdlet
264
274
{
265
275
/// <summary>
@@ -281,6 +291,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.CmdletWithPluralNoun
281
291
/// Verify if a cmdlet has a plural noun in its name.
282
292
/// </summary>
283
293
[ Cmdlet ( "Get" , "SampleKeys" ) ]
294
+ [ OutputType ( typeof ( bool ) ) ]
284
295
public class CmdletGetSampleKeys : Cmdlet
285
296
{
286
297
/// <summary>
@@ -295,7 +306,72 @@ protected override void BeginProcessing()
295
306
}
296
307
#endregion
297
308
298
- #region ParameterWithPluralNoun
309
+ #region OutputChecks
310
+ namespace StaticAnalysis . Test . CmdletTest . Signature . CmdletWithNoOutput
311
+ {
312
+ using System . Management . Automation ;
313
+
314
+ [ Cmdlet ( VerbsCommon . Get , "CmdletWithNoOutput" ) ]
315
+ public class CmdletGetCmdletWithNoOutput : Cmdlet
316
+ {
317
+ protected override void BeginProcessing ( )
318
+ {
319
+ WriteObject ( "Get-CmdletWithNoOutput BeginProcessing()" ) ;
320
+ WriteInformation ( "Info" , null ) ;
321
+ }
322
+ }
323
+ }
324
+
325
+ #endregion
326
+
327
+ #region ParameterSetChecks
328
+ namespace StaticAnalysis . Test . CmdletTest . Signature . ParameterSetNameWithSpace
329
+ {
330
+ using System . Management . Automation ;
331
+
332
+ [ Cmdlet ( VerbsCommon . Get , "ParameterSetNameWithSpace" , DefaultParameterSetName = "GetFoo" ) ]
333
+ [ OutputType ( typeof ( bool ) ) ]
334
+ public class CmdletGetParameterSetNameWithSpace : Cmdlet
335
+ {
336
+ [ Parameter ( ParameterSetName = "GetFoo" ) ]
337
+ public string Foo { get ; set ; }
338
+
339
+ [ Parameter ( ParameterSetName = "Get Bar" ) ]
340
+ public string Bar { get ; set ; }
341
+
342
+ protected override void BeginProcessing ( )
343
+ {
344
+ WriteObject ( "Get-ParameterSetNameWithSpace BeginProcessing()" ) ;
345
+ WriteInformation ( "Info" , null ) ;
346
+ }
347
+ }
348
+ }
349
+
350
+ namespace StaticAnalysis . Test . CmdletTest . Signature . MultipleParameterSetsWithNoDefault
351
+ {
352
+ using System . Management . Automation ;
353
+
354
+ [ Cmdlet ( VerbsCommon . Get , "MultipleParameterSetsWithNoDefault" ) ]
355
+ [ OutputType ( typeof ( bool ) ) ]
356
+ public class CmdletGetMultipleParameterSetsWithNoDefault : Cmdlet
357
+ {
358
+ [ Parameter ( ParameterSetName = "GetFoo" ) ]
359
+ public string Foo { get ; set ; }
360
+
361
+ [ Parameter ( ParameterSetName = "GetBar" ) ]
362
+ public string Bar { get ; set ; }
363
+
364
+ protected override void BeginProcessing ( )
365
+ {
366
+ WriteObject ( "Get-MultipleParameterSetsWithNoDefault BeginProcessing()" ) ;
367
+ WriteInformation ( "Info" , null ) ;
368
+ }
369
+ }
370
+ }
371
+
372
+ #endregion
373
+
374
+ #region ParameterChecks
299
375
namespace StaticAnalysis . Test . CmdletTest . Signature . ParameterWithSingularNoun
300
376
{
301
377
using System . Management . Automation ;
@@ -304,6 +380,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.ParameterWithSingularNoun
304
380
/// Verify if a parameter has a singular noun in its name.
305
381
/// </summary>
306
382
[ Cmdlet ( VerbsCommon . Get , "SampleFoo" ) ]
383
+ [ OutputType ( typeof ( bool ) ) ]
307
384
public class CmdletGetSampleFoo : Cmdlet
308
385
{
309
386
[ Parameter ( Mandatory = false ) ]
@@ -328,6 +405,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.ParameterWithPluralNoun
328
405
/// Verify if a parameter has a plural noun in its name.
329
406
/// </summary>
330
407
[ Cmdlet ( "Get" , "SampleBar" ) ]
408
+ [ OutputType ( typeof ( bool ) ) ]
331
409
public class CmdletGetSampleBar : Cmdlet
332
410
{
333
411
[ Parameter ( Mandatory = false ) ]
@@ -353,6 +431,7 @@ namespace StaticAnalysis.Test.CmdletTest.Signature.CmdletAndParameterWithSingula
353
431
/// accepted nouns ending with "s".
354
432
/// </summary>
355
433
[ Cmdlet ( "Get" , "SampleAddress" ) ]
434
+ [ OutputType ( typeof ( bool ) ) ]
356
435
public class CmdletGetSampleAddress : Cmdlet
357
436
{
358
437
[ Parameter ( Mandatory = false ) ]
@@ -368,4 +447,36 @@ protected override void BeginProcessing()
368
447
}
369
448
}
370
449
}
450
+
451
+ namespace StaticAnalysis . Test . CmdletTest . Signature . ParameterWithOutOfRangePosition
452
+ {
453
+ using System . Management . Automation ;
454
+
455
+ [ Cmdlet ( VerbsCommon . Get , "ParameterWithOutOfRangePosition" ) ]
456
+ [ OutputType ( typeof ( bool ) ) ]
457
+ public class CmdletGetParameterWithOutOfRangePosition : Cmdlet
458
+ {
459
+ [ Parameter ( Position = 0 ) ]
460
+ public string FirstParameter { get ; set ; }
461
+
462
+ [ Parameter ( Position = 1 ) ]
463
+ public string SecondParameter { get ; set ; }
464
+
465
+ [ Parameter ( Position = 2 ) ]
466
+ public string ThirdParameter { get ; set ; }
467
+
468
+ [ Parameter ( Position = 3 ) ]
469
+ public string FourthParameter { get ; set ; }
470
+
471
+ [ Parameter ( Position = 4 ) ]
472
+ public string FifthParameter { get ; set ; }
473
+
474
+ protected override void BeginProcessing ( )
475
+ {
476
+ WriteObject ( "Get-ParameterWithOutOfRangePosition BeginProcessing()" ) ;
477
+ WriteInformation ( "Info" , null ) ;
478
+ }
479
+ }
480
+ }
481
+
371
482
#endregion
0 commit comments