2018-02-13 18:23:53 +01:00
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
# Licensed under the MIT License.
|
2016-11-17 20:46:07 +01:00
|
|
|
try {
|
|
|
|
if ( ! $IsWindows ) {
|
|
|
|
$PSDefaultParameterValues['it:skip'] = $true
|
|
|
|
}
|
|
|
|
Describe " WSMan SessionOption object" -Tag @("CI") {
|
|
|
|
It "The SessionOption type exists" {
|
2018-03-14 20:13:32 +01:00
|
|
|
"Microsoft.WSMan.Management.SessionOption" -as "Type" | Should -Not -BeNullOrEmpty
|
2016-11-17 20:46:07 +01:00
|
|
|
}
|
|
|
|
It "The SessionOption type can be created" {
|
|
|
|
$result = [Microsoft.WSMan.Management.SessionOption]::new()
|
Update pester syntax to v4 (#11544)
* Capitalize 'Should' command and fix whitespace
```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```
* Capitalise and apply hyphen to 'Not' parameter
```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```
* Capitalise and apply hyphen to 'Be' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```
* Capitalise and apply hyphen to 'BeExactly' parameter
$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'
* Capitalise and apply hyphen to 'BeGreaterThan' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```
* Use 'BeTrue' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```
* Use 'BeFalse' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```
* Capitalise and apply hyphen to 'Match' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```
* Capitalise and apply hyphen to 'Throw' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```
* Capitalise and apply hyphen to 'BeNullOrEmpty' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```
* Capitalise 'Because' parameter
```powershell
$_ -ireplace '\s-because\b',' -Because'
```
* Fix 'BeNullOrEmpty'
2020-01-11 16:41:59 +01:00
|
|
|
$result | Should -BeOfType "Microsoft.WSMan.Management.SessionOption"
|
2016-11-17 20:46:07 +01:00
|
|
|
}
|
|
|
|
It "The SessionOption type has the proper properties when created with the default constructor" {
|
|
|
|
$result = [Microsoft.WSMan.Management.SessionOption]::new()
|
Update pester syntax to v4 (#11544)
* Capitalize 'Should' command and fix whitespace
```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```
* Capitalise and apply hyphen to 'Not' parameter
```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```
* Capitalise and apply hyphen to 'Be' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```
* Capitalise and apply hyphen to 'BeExactly' parameter
$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'
* Capitalise and apply hyphen to 'BeGreaterThan' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```
* Use 'BeTrue' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```
* Use 'BeFalse' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```
* Capitalise and apply hyphen to 'Match' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```
* Capitalise and apply hyphen to 'Throw' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```
* Capitalise and apply hyphen to 'BeNullOrEmpty' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```
* Capitalise 'Because' parameter
```powershell
$_ -ireplace '\s-because\b',' -Because'
```
* Fix 'BeNullOrEmpty'
2020-01-11 16:41:59 +01:00
|
|
|
$result.SkipCACheck | Should -BeFalse
|
|
|
|
$result.SkipCNCheck | Should -BeFalse
|
|
|
|
$result.SkipRevocationCheck | Should -BeFalse
|
|
|
|
$result.UseEncryption | Should -BeTrue
|
|
|
|
$result.UseUtf16 | Should -BeFalse
|
|
|
|
$result.ProxyAuthentication | Should -Be 0
|
|
|
|
$result.SPNPort | Should -Be 0
|
|
|
|
$result.OperationTimeout | Should -Be 0
|
|
|
|
$result.ProxyCredential | Should -BeNullOrEmpty
|
|
|
|
$result.ProxyAccessType | Should -Be ProxyIEConfig
|
2016-11-17 20:46:07 +01:00
|
|
|
}
|
|
|
|
It "The values of SessionOption may be set" {
|
|
|
|
$result = [Microsoft.WSMan.Management.SessionOption]::new()
|
|
|
|
$result.SkipCACheck = $true
|
|
|
|
$result.SkipCNCheck = $true
|
|
|
|
$result.SkipRevocationCheck = $true
|
2020-01-13 20:25:09 +01:00
|
|
|
$result.UseUtf16 = $true
|
2016-11-17 20:46:07 +01:00
|
|
|
$result.UseEncryption = $false
|
|
|
|
$result.ProxyAuthentication = "Negotiate"
|
|
|
|
$result.SPNPort = 10
|
|
|
|
$result.OperationTimeout = 10
|
|
|
|
$result.ProxyAccessType = "ProxyAutoDetect"
|
|
|
|
$result.ProxyCredential = [System.Net.NetworkCredential]::new("user","pass")
|
|
|
|
|
Update pester syntax to v4 (#11544)
* Capitalize 'Should' command and fix whitespace
```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```
* Capitalise and apply hyphen to 'Not' parameter
```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```
* Capitalise and apply hyphen to 'Be' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```
* Capitalise and apply hyphen to 'BeExactly' parameter
$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'
* Capitalise and apply hyphen to 'BeGreaterThan' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```
* Use 'BeTrue' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```
* Use 'BeFalse' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```
* Capitalise and apply hyphen to 'Match' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```
* Capitalise and apply hyphen to 'Throw' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```
* Capitalise and apply hyphen to 'BeNullOrEmpty' parameter
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```
* Capitalise 'Because' parameter
```powershell
$_ -ireplace '\s-because\b',' -Because'
```
* Fix 'BeNullOrEmpty'
2020-01-11 16:41:59 +01:00
|
|
|
$result.SkipCACheck | Should -BeTrue
|
|
|
|
$result.SkipCNCheck | Should -BeTrue
|
|
|
|
$result.SkipRevocationCheck | Should -BeTrue
|
|
|
|
$result.UseEncryption | Should -BeFalse
|
|
|
|
$result.UseUtf16 | Should -BeTrue
|
|
|
|
$result.ProxyAuthentication | Should -Be "Negotiate"
|
|
|
|
$result.SPNPort | Should -Be 10
|
|
|
|
$result.OperationTimeout | Should -Be 10
|
|
|
|
$result.ProxyCredential | Should -Not -BeNullOrEmpty
|
|
|
|
$result.ProxyAccessType | Should -Be "ProxyAutoDetect"
|
2016-11-17 20:46:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
$PSDefaultParameterValues.remove("it:skip")
|
|
|
|
}
|