Skip to content

Commit a635a42

Browse files
test: OpenXML Tests ( Fixes #27 )
1 parent 6150ef1 commit a635a42

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

OpenXML.tests.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Push-Location $PSScriptRoot
2+
describe OpenXML {
3+
it 'Is a zip in a trenchcoat' {
4+
$blankDocument = Get-OpenXML -FilePath ./Examples/Blank.docx
5+
$blankDocument.Parts.Count | Should -BeGreaterThan 1
6+
}
7+
8+
it 'Can access metadata' {
9+
$blankDocument = Get-OpenXML -FilePath ./Examples/Blank.docx
10+
$blankDocument.Created | Should -BeLessThan ([DateTime]::Now)
11+
$blankDocument.Modified | Should -BeLessThan ([DateTime]::Now)
12+
}
13+
14+
15+
context Excel {
16+
it 'Can Get Cells' {
17+
$helloExcel = OpenXML ./Examples/HelloWorld.xlsx
18+
$helloExcel.Text -replace '^[\n\r]' | Should -Be 'Hello World'
19+
}
20+
}
21+
context PowerPoint {
22+
it 'Can Get Text' {
23+
$helloPowerPoint = OpenXML ./Examples/HelloWorld.pptx
24+
$helloPowerPoint.Text -replace '^[\n\r]' | Should -Be 'Hello World'
25+
}
26+
it 'Can Get Slides' {
27+
$aSlideDeck = OpenXML ./Examples/ASlideDeck.pptx
28+
$aSlideDeck.Slides.Count | Should -BeGreaterThan 1
29+
$aSlideDeck.Slides.SlideNumber | Should -BeGreaterOrEqual 1
30+
}
31+
}
32+
33+
context Word {
34+
it 'Can Get Text' {
35+
$helloWorld = Get-OpenXML -FilePath ./Examples/HelloWorld.docx
36+
$helloWorld.Text -replace '^[\n\r]+' | Should -Be 'Hello World'
37+
}
38+
}
39+
40+
41+
}
42+
43+
Pop-Location

0 commit comments

Comments
 (0)