From bef1688f87b5fb5bb63ee72eee699876bba2fcd3 Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Mon, 30 May 2016 01:33:31 -0700 Subject: [PATCH] Add Select-XML Pester Unit Test --- test/powershell/Select-XML.Tests.ps1 | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/powershell/Select-XML.Tests.ps1 diff --git a/test/powershell/Select-XML.Tests.ps1 b/test/powershell/Select-XML.Tests.ps1 new file mode 100644 index 000000000..4b52c584d --- /dev/null +++ b/test/powershell/Select-XML.Tests.ps1 @@ -0,0 +1,34 @@ + +Describe "Select-XML DRT Unit Tests" -Tags DRT{ + $tmpDirectory = $TestDrive + $testfilename = "testfile.xml" + $testfile = Join-Path -Path $tmpDirectory -ChildPath $testfilename + + It "Select-XML should work"{ + $xmlContent = @" + + + + Harry Potter + 30.00 + + + Learning XML + 25.00 + + +"@ + $xmlContent >$testfile + try + { + $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" + } + finally + { + rm $testfile + } + } +}