@@ -9,6 +9,7 @@ namespace StaticAnalysis.Test
9
9
using Xunit ;
10
10
using System . Linq ;
11
11
using StaticAnalysis . ProblemIds ;
12
+ using System . Reflection ;
12
13
13
14
/// <summary>
14
15
/// Add a way to send filterDirectory, FiltercmdLets delegates to the analyze method.
@@ -20,30 +21,31 @@ namespace StaticAnalysis.Test
20
21
/// </summary>
21
22
public class SignatureVerifierTests
22
23
{
23
- string testCmdletDirPath , exceptionsDirPath ;
24
+ string _testCmdletDirPath , _exceptionsDirPath ;
24
25
SignatureVerifier . SignatureVerifier cmdletSignatureVerifier ;
25
26
AnalysisLogger analysisLogger ;
26
27
27
28
public SignatureVerifierTests ( )
28
29
{
29
- testCmdletDirPath = System . Environment . CurrentDirectory ;
30
- exceptionsDirPath = Path . Combine ( testCmdletDirPath , "Exceptions" ) ;
30
+ _testCmdletDirPath = Path . GetDirectoryName ( new Uri ( Assembly . GetExecutingAssembly ( ) . CodeBase ) . AbsolutePath ) ;
31
+ _exceptionsDirPath = Path . Combine ( _testCmdletDirPath , "Exceptions" ) ;
31
32
32
- analysisLogger = new AnalysisLogger ( testCmdletDirPath , exceptionsDirPath ) ;
33
+ analysisLogger = new AnalysisLogger ( _testCmdletDirPath , _exceptionsDirPath ) ;
33
34
cmdletSignatureVerifier = new StaticAnalysis . SignatureVerifier . SignatureVerifier ( ) ;
34
35
cmdletSignatureVerifier . Logger = analysisLogger ;
35
36
}
36
37
37
38
#region Verb Cmdlets and SupportsShouldProcess
38
39
/// <summary>
39
40
///
40
- /// </summary>
41
- [ Fact ( Skip = "See Azure PowerShell issue #2987 - https://github.com/Azure/azure-powershell/issues/2987" ) ]
41
+ /// </summary>
42
+ [ Fact ]
43
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
42
44
public void AddVerbWithoutSupportsShouldProcessParameter ( )
43
45
{
44
46
cmdletSignatureVerifier . Analyze (
45
- new List < string > { Environment . CurrentDirectory } ,
46
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
47
+ new List < string > { _testCmdletDirPath } ,
48
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
47
49
( cmdletName ) => cmdletName . Equals ( "Add-AddVerbWithoutSupportsShouldProcessParameter" , StringComparison . OrdinalIgnoreCase ) ) ;
48
50
49
51
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
@@ -53,11 +55,12 @@ public void AddVerbWithoutSupportsShouldProcessParameter()
53
55
}
54
56
55
57
[ Fact ]
58
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
56
59
public void AddVerbWithSupportsShouldProcessParameter ( )
57
60
{
58
61
cmdletSignatureVerifier . Analyze (
59
- new List < string > { Environment . CurrentDirectory } ,
60
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
62
+ new List < string > { _testCmdletDirPath } ,
63
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
61
64
( cmdletName ) => cmdletName . Equals ( "Add-AddVerbWithSupportsShouldProcessParameter" , StringComparison . OrdinalIgnoreCase ) ) ;
62
65
63
66
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
@@ -67,26 +70,31 @@ public void AddVerbWithSupportsShouldProcessParameter()
67
70
#endregion
68
71
69
72
#region ForceSwitch and SupportsShouldProcess
70
-
71
- [ Fact ( Skip = "See Azure PowerShell issue #2987 - https://github.com/Azure/azure-powershell/issues/2987" ) ]
73
+
74
+ [ Fact ]
75
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
72
76
public void ForceParameterWithoutSupportsShouldProcess ( )
73
77
{
74
78
cmdletSignatureVerifier . Analyze (
75
- new List < string > { Environment . CurrentDirectory } ,
76
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
79
+ new List < string > { _testCmdletDirPath } ,
80
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
77
81
( cmdletName ) => cmdletName . Equals ( "Test-ForceParameterWithoutSupportsShouldProcess" , StringComparison . OrdinalIgnoreCase ) ) ;
78
82
83
+ analysisLogger . Info ( "Foo" ) ;
84
+
85
+
79
86
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
80
87
Assert . True ( testReport . ProblemIdList . Count == 1 ) ;
81
88
Assert . True ( testReport . ProblemIdList . Where < int > ( ( problemId ) => problemId . Equals ( SignatureProblemId . ForceWithoutShouldProcessAttribute ) ) . SingleOrDefault < int > ( ) . Equals ( SignatureProblemId . ForceWithoutShouldProcessAttribute ) ) ;
82
89
}
83
90
84
91
[ Fact ]
92
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
85
93
public void ForceParameterWithSupportsShouldProcess ( )
86
94
{
87
95
cmdletSignatureVerifier . Analyze (
88
- new List < string > { Environment . CurrentDirectory } ,
89
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
96
+ new List < string > { _testCmdletDirPath } ,
97
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
90
98
( cmdletName ) => cmdletName . Equals ( "Test-ForceParameterWithSupportsShouldProcess" , StringComparison . OrdinalIgnoreCase ) ) ;
91
99
92
100
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
@@ -97,23 +105,25 @@ public void ForceParameterWithSupportsShouldProcess()
97
105
98
106
#region ConfirmImpact and SupportsShouldProcess
99
107
[ Fact ]
108
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
100
109
public void ConfirmImpactWithSupportsShouldProcess ( )
101
110
{
102
111
cmdletSignatureVerifier . Analyze (
103
- new List < string > { Environment . CurrentDirectory } ,
104
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
112
+ new List < string > { _testCmdletDirPath } ,
113
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
105
114
( cmdletName ) => cmdletName . Equals ( "Test-ConfirmImpactWithSupportsShouldProcess" , StringComparison . OrdinalIgnoreCase ) ) ;
106
115
107
116
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
108
117
Assert . True ( testReport . ProblemIdList . Count == 0 ) ;
109
118
}
110
-
111
- [ Fact ( Skip = "See Azure PowerShell issue #2987 - https://github.com/Azure/azure-powershell/issues/2987" ) ]
119
+
120
+ [ Fact ]
121
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
112
122
public void ConfirmImpactWithoutSupportsShouldProcess ( )
113
123
{
114
124
cmdletSignatureVerifier . Analyze (
115
- new List < string > { Environment . CurrentDirectory } ,
116
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
125
+ new List < string > { _testCmdletDirPath } ,
126
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
117
127
( cmdletName ) => cmdletName . Equals ( "Test-ConfirmImpactWithoutSupportsShouldProcess" , StringComparison . OrdinalIgnoreCase ) ) ;
118
128
119
129
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
@@ -125,23 +135,25 @@ public void ConfirmImpactWithoutSupportsShouldProcess()
125
135
126
136
#region IsShouldContinueVerb and ForceSwitch
127
137
[ Fact ]
138
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
128
139
public void ShouldContinueVerbWithForceSwitch ( )
129
140
{
130
141
cmdletSignatureVerifier . Analyze (
131
- new List < string > { Environment . CurrentDirectory } ,
132
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
142
+ new List < string > { _testCmdletDirPath } ,
143
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
133
144
( cmdletName ) => cmdletName . Equals ( "Copy-ShouldContinueVerbWithForceSwitch" , StringComparison . OrdinalIgnoreCase ) ) ;
134
145
135
146
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
136
147
Assert . True ( testReport . ProblemIdList . Count == 0 ) ;
137
148
}
138
-
139
- [ Fact ( Skip = "See Azure PowerShell issue #2987 - https://github.com/Azure/azure-powershell/issues/2987" ) ]
149
+
150
+ [ Fact ]
151
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
140
152
public void ShouldContinueVerbWithoutForceSwitch ( )
141
153
{
142
154
cmdletSignatureVerifier . Analyze (
143
- new List < string > { Environment . CurrentDirectory } ,
144
- ( ( dirList ) => { return new List < string > { Environment . CurrentDirectory } ; } ) ,
155
+ new List < string > { _testCmdletDirPath } ,
156
+ ( ( dirList ) => { return new List < string > { _testCmdletDirPath } ; } ) ,
145
157
( cmdletName ) => cmdletName . Equals ( "Export-ShouldContinueVerbWithoutForceSwitch" , StringComparison . OrdinalIgnoreCase ) ) ;
146
158
147
159
AnalysisReport testReport = cmdletSignatureVerifier . GetAnalysisReport ( ) ;
0 commit comments