-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOpenXML.tests.ps1
More file actions
43 lines (36 loc) · 1.34 KB
/
OpenXML.tests.ps1
File metadata and controls
43 lines (36 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Push-Location $PSScriptRoot
describe OpenXML {
it 'Is a zip in a trenchcoat' {
$blankDocument = Get-OpenXML -FilePath ./Examples/Blank.docx
$blankDocument.Parts.Count | Should -BeGreaterThan 1
}
it 'Can access metadata' {
$blankDocument = Get-OpenXML -FilePath ./Examples/Blank.docx
$blankDocument.Created | Should -BeLessThan ([DateTime]::Now)
$blankDocument.Modified | Should -BeLessThan ([DateTime]::Now)
}
context Excel {
it 'Can Get Cells' {
$helloExcel = OpenXML ./Examples/HelloWorld.xlsx
$helloExcel.Worksheets.Cell.Values | Should -Be 'Hello World'
}
}
context PowerPoint {
it 'Can Get Text' {
$helloPowerPoint = OpenXML ./Examples/HelloWorld.pptx
$helloPowerPoint.Text -replace '^[\n\r]' | Should -Be 'Hello World'
}
it 'Can Get Slides' {
$aSlideDeck = OpenXML ./Examples/ASlideDeck.pptx
$aSlideDeck.Slides.Count | Should -BeGreaterThan 1
$aSlideDeck.Slides.SlideNumber | Should -BeGreaterOrEqual 1
}
}
context Word {
it 'Can Get Text' {
$helloWorld = Get-OpenXML -FilePath ./Examples/HelloWorld.docx
$helloWorld.Text -replace '^[\n\r]+' | Should -Be 'Hello World'
}
}
}
Pop-Location