Files
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/Select-XML.Tests.ps1
T

28 lines
705 B
PowerShell
Raw Normal View History

2016-05-30 01:33:31 -07:00
2016-07-25 14:01:41 -07:00
Describe "Select-XML DRT Unit Tests" -Tags "CI" {
2016-05-30 01:33:31 -07:00
BeforeAll {
$testfile = Join-Path -Path $TestDrive -ChildPath "testfile.xml"
2016-05-30 01:33:31 -07:00
$xmlContent = @"
<?xml version ="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="CHILDREN">
<title lang="english">Harry Potter</title>
<price>30.00</price>
</book>
<book category="WEB">
<title lang="english">Learning XML</title>
<price>25.00</price>
</book>
</bookstore>
"@
$xmlContent >$testfile
}
It "Select-XML should work"{
$results = Select-XML -Path $testfile -XPath "/bookstore/book/title"
$results.Count | Should Be 2
$results[0].Node."#text" | Should Be "Harry Potter"
$results[1].Node."#text" | Should Be "Learning XML"
2016-05-30 01:33:31 -07:00
}
}