"@
$returnString | Should Be $expectedValue
}
It "Test ConvertTo-Html Fragment parameter" {
$returnString = ($customObject | ConvertTo-Html -Fragment) -join $newLine
$expectedValue = normalizeLineEnds @"
Name
Age
Friends
John Doe
42
System.Object[]
"@
$returnString | Should Be $expectedValue
}
It "Test ConvertTo-Html as List" {
$returnString = ($customObject | ConvertTo-Html -As List) -join $newLine
$expectedValue = normalizeLineEnds @"
HTML TABLE
Name:
John Doe
Age:
42
Friends:
System.Object[]
"@
$returnString | Should Be $expectedValue
}
It "Test ConvertTo-Html specified properties" {
$returnString = ($customObject | ConvertTo-Html -Property Name, Friends -As List) -join $newLine
$expectedValue = normalizeLineEnds @"
HTML TABLE
Name:
John Doe
Friends:
System.Object[]
"@
$returnString | Should Be $expectedValue
}
It "Test ConvertTo-Html using page parameters" {
$returnString = ($customObject | ConvertTo-Html -Title "Custom Object" -Body "Body Text" -CssUri "page.css" -As List) -join $newLine
$expectedValue = normalizeLineEnds @"
Custom Object
Body Text
Name:
John Doe
Age:
42
Friends:
System.Object[]
"@
$returnString | Should Be $expectedValue
}
It "Test ConvertTo-Html pre and post" {
$returnString = ($customObject | ConvertTo-Html -PreContent "Before the object" -PostContent "After the object") -join $newLine
$expectedValue = normalizeLineEnds @"
HTML TABLE
Before the object
Name
Age
Friends
John Doe
42
System.Object[]
After the object
"@
$returnString | Should Be $expectedValue
}
}