PowerShell/test/powershell/engine/Remoting/SessionOption.Tests.ps1
James Truher [MSFT] 3f99de5784 Added tests to close code coverage in CIM area (#2528)
* Added tests to close code coverage in CIM area

Added CimAdapter.Tests for adaptation layer (code cribbed from BVT tests)
Added SessionOption.Tests.ps1 (Code cribbed from BVT tests)
Modified CimClass tests by adding more tests
Added CimSession.Tests for basic tests of New-CimSession cmdlet
Added CimInstance.Tests for basic tests of Get-CimInstance

* Add CI tags to tests

* unify test execution to use try/catch for marking tests as skipped

moved test which retrieves cimclass via method to feature as it is not
a common operation, this test can take some time as well
2016-11-17 11:46:07 -08:00

55 lines
2.5 KiB
PowerShell

try {
if ( ! $IsWindows ) {
$PSDefaultParameterValues['it:skip'] = $true
}
Describe " WSMan SessionOption object" -Tag @("CI") {
It "The SessionOption type exists" {
"Microsoft.WSMan.Management.SessionOption" -as "Type" | Should Not BeNullOrEmpty
}
It "The SessionOption type can be created" {
$result = [Microsoft.WSMan.Management.SessionOption]::new()
$result | should BeOfType "Microsoft.WSMan.Management.SessionOption"
}
It "The SessionOption type has the proper properties when created with the default constructor" {
$result = [Microsoft.WSMan.Management.SessionOption]::new()
$result.SkipCACheck | should be $False
$result.SkipCNCheck | should be $False
$result.SkipRevocationCheck | should be $False
$result.UseEncryption | should be $True
$result.UseUtf16 | should be $False
$result.ProxyAuthentication | should be 0
$result.SPNPort | should be 0
$result.OperationTimeout | should be 0
$result.ProxyCredential | should BeNullOrEmpty
$result.ProxyAccessType | should be ProxyIEConfig
}
It "The values of SessionOption may be set" {
$result = [Microsoft.WSMan.Management.SessionOption]::new()
$result.SkipCACheck = $true
$result.SkipCNCheck = $true
$result.SkipRevocationCheck = $true
$result.UseUtf16 = $True
$result.UseEncryption = $false
$result.ProxyAuthentication = "Negotiate"
$result.SPNPort = 10
$result.OperationTimeout = 10
$result.ProxyAccessType = "ProxyAutoDetect"
$result.ProxyCredential = [System.Net.NetworkCredential]::new("user","pass")
$result.SkipCACheck | should be $true
$result.SkipCNCheck | should be $true
$result.SkipRevocationCheck | should be $true
$result.UseEncryption | should be $False
$result.UseUtf16 | should be $True
$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"
}
}
}
finally {
$PSDefaultParameterValues.remove("it:skip")
}