2016-07-25 14:01:41 -07:00
|
|
|
Describe "XmlCommand DRT basic functionality Tests" -Tags "CI" {
|
2016-06-01 00:48:22 -07:00
|
|
|
|
|
|
|
|
BeforeAll {
|
2016-06-16 19:44:57 -07:00
|
|
|
if(-not ('IsHiddenTestType' -as "type"))
|
2016-06-01 00:48:22 -07:00
|
|
|
{
|
|
|
|
|
Add-Type -TypeDefinition @"
|
|
|
|
|
public class IsHiddenTestType
|
|
|
|
|
{
|
|
|
|
|
public IsHiddenTestType()
|
|
|
|
|
{
|
|
|
|
|
Property1 = 1;
|
|
|
|
|
Property2 = "some string";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IsHiddenTestType(int val, string data)
|
|
|
|
|
{
|
|
|
|
|
Property1 = val;
|
|
|
|
|
Property2 = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Property1;
|
|
|
|
|
public string Property2;
|
|
|
|
|
}
|
|
|
|
|
"@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BeforeEach {
|
|
|
|
|
$testfile = Join-Path -Path $TestDrive -ChildPath "clixml-directive.xml"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AfterEach {
|
2016-06-16 19:44:57 -07:00
|
|
|
remove-item $testfile
|
2016-06-01 00:48:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Import with CliXml directive should work" -Skip:$IsOSX{
|
|
|
|
|
Get-Process | Export-Clixml $testfile
|
2016-06-16 19:44:57 -07:00
|
|
|
$results = Import-Clixml $testfile
|
2016-06-01 00:48:22 -07:00
|
|
|
$results.Count | Should BeGreaterThan 0
|
2016-06-16 19:44:57 -07:00
|
|
|
$results[0].ToString() | Should Match "System.Diagnostics.Process"
|
2016-06-01 00:48:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Import with Rehydration should work" -Skip:$IsOSX{
|
|
|
|
|
$property1 = 256
|
|
|
|
|
$property2 = "abcdef"
|
|
|
|
|
$isHiddenTestType = [IsHiddenTestType]::New($property1,$property2)
|
|
|
|
|
$isHiddenTestType | Export-Clixml $testfile
|
2016-06-16 19:44:57 -07:00
|
|
|
$results = Import-Clixml $testfile
|
2016-06-01 00:48:22 -07:00
|
|
|
$results.Property1 | Should Be $property1
|
|
|
|
|
$results.Property2 | Should Be $property2
|
|
|
|
|
}
|
|
|
|
|
}
|