You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$results.Name| Should Be "MyTest 'Spaced Value' Should Exist"
30
+
}
31
+
32
+
It "Should return the correct test Expression" {
33
+
$results.Expression| Should Be "Get-Item 'Spaced Value' | Should Exist"
34
+
}
35
+
}
36
+
25
37
Context 'Two Parameters' {
26
-
$results=Get-PoshspecParam-TestName MyTest -TestExpression {Get-Item$Target$Property} -Target Name -Property Something -Should { Should Exist }
38
+
$results=Get-PoshspecParam-TestName MyTest -TestExpression {Get-Item'$Target''$Property'} -Target Name -Property Something -Should { Should Exist }
27
39
28
40
It "Should return the correct test Name" {
29
41
$results.Name| Should Be "MyTest property 'Something' for 'Name' Should Exist"
@@ -35,7 +47,7 @@ Describe 'Get-PoshspecParam' {
35
47
}
36
48
37
49
Context 'Three Parameters' {
38
-
$results=Get-PoshspecParam-TestName MyTest -TestExpression {Get-Item$Target$Property$Qualifier} -Target Name -Property Something -Qualifier 1-Should { Should Exist }
50
+
$results=Get-PoshspecParam-TestName MyTest -TestExpression {Get-Item'$Target''$Property''$Qualifier'} -Target Name -Property Something -Qualifier 1-Should { Should Exist }
39
51
40
52
It "Should return the correct test Name" {
41
53
$results.Name| Should Be "MyTest property 'Something' for 'Name' at '1' Should Exist"
@@ -45,13 +57,6 @@ Describe 'Get-PoshspecParam' {
45
57
$results.Expression| Should Be "Get-Item 'name' 'Something' '1' | Select-Object -ExpandProperty 'Something' | Should Exist"
46
58
}
47
59
}
48
-
49
-
Context 'Expression handling' {
50
-
51
-
It "Should thow and error if missing a property" {
52
-
{ Get-PoshspecParam-TestName MyTest -TestExpression {Get-Item$Target$Property} -Target Name -Should { Should Exist } } | Should Throw
53
-
}
54
-
}
55
60
}
56
61
}
57
62
@@ -133,7 +138,7 @@ Describe 'Test Functions' {
133
138
}
134
139
135
140
It "Should return the correct test Expression" {
136
-
$results.Expression| Should Be "Test-NetConnection -ComputerName 'localhost' -Port '80' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty 'PingSucceeded' | Should Be `$true"
141
+
$results.Expression| Should Be "Test-NetConnection -ComputerName localhost -Port 80 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty 'PingSucceeded' | Should Be `$true"
137
142
}
138
143
}
139
144
@@ -146,7 +151,7 @@ Describe 'Test Functions' {
146
151
}
147
152
148
153
It "Should return the correct test Expression" {
149
-
$results.Expression| Should Be "Get-HotFix -Id 'KB1234567' -ErrorAction SilentlyContinue | Should Exist"
154
+
$results.Expression| Should Be "Get-HotFix -Id KB1234567 -ErrorAction SilentlyContinue | Should Exist"
150
155
}
151
156
}
152
157
@@ -159,7 +164,7 @@ Describe 'Test Functions' {
159
164
}
160
165
161
166
It "Should return the correct test Expression" {
162
-
$results.Expression| Should Be "Get-CimInstance -ClassName 'Win32_OperatingSystem' | Select-Object -ExpandProperty 'SystemDirectory' | Should Be C:\WINDOWS\system32"
167
+
$results.Expression| Should Be "Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty 'SystemDirectory' | Should Be C:\WINDOWS\system32"
163
168
}
164
169
}
165
170
Context 'CimObject with Namespace' {
@@ -171,7 +176,7 @@ Describe 'Test Functions' {
171
176
}
172
177
173
178
It "Should return the correct test Expression" {
174
-
$results.Expression| Should Be "Get-CimInstance -ClassName 'MSFT_DSCConfigurationStatus' -Namespace 'root/Microsoft/Windows/DesiredStateConfiguration' | Select-Object -ExpandProperty 'Error' | Should BeNullOrEmpty"
179
+
$results.Expression| Should Be "Get-CimInstance -ClassName MSFT_DSCConfigurationStatus -Namespace root/Microsoft/Windows/DesiredStateConfiguration | Select-Object -ExpandProperty 'Error' | Should BeNullOrEmpty"
175
180
}
176
181
}
177
182
@@ -210,7 +215,7 @@ Describe 'Test Functions' {
210
215
}
211
216
212
217
It 'Should return a correct text expression' {
213
-
$results.Expression| Should Be 'Get-CimInstance -ClassName Win32_Group -Filter "Name = ''$Target''" | Should Not BeNullOrEmpty'
218
+
$results.Expression| Should Be 'Get-CimInstance -ClassName Win32_Group -Filter "Name = ''Administrators''" | Should Not BeNullOrEmpty'
214
219
}
215
220
}
216
221
@@ -258,7 +263,7 @@ Describe 'Test Functions' {
258
263
}
259
264
260
265
It "Should return the correct test Expression" {
261
-
$results.Expression| Should Be "Resolve-DnsName -Name 'www.google.com' -DnsOnly -NoHostsFile -ErrorAction SilentlyContinue | Should Not BeNullOrEmpty"
266
+
$results.Expression| Should Be "Resolve-DnsName -Name www.google.com -DnsOnly -NoHostsFile -ErrorAction SilentlyContinue | Should Not BeNullOrEmpty"
0 commit comments