mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Reverted to Pester Old syntax
This commit is contained in:
@@ -984,15 +984,15 @@ Describe ExportExcel {
|
|||||||
$ExcelPackage = $Processes | Export-Excel -Path $Path -PassThru
|
$ExcelPackage = $Processes | Export-Excel -Path $Path -PassThru
|
||||||
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
||||||
|
|
||||||
$ExcelPackage.File | Should -Be $Path
|
$ExcelPackage.File | Should Be $Path
|
||||||
$Worksheet.Cells['A1'].Value | Should -Be 'Name'
|
$Worksheet.Cells['A1'].Value | Should Be 'Name'
|
||||||
$Worksheet.Tables | Should -BeNullOrEmpty
|
$Worksheet.Tables | Should BeNullOrEmpty
|
||||||
$Worksheet.AutoFilterAddress | Should -BeNullOrEmpty
|
$Worksheet.AutoFilterAddress | Should BeNullOrEmpty
|
||||||
}
|
}
|
||||||
it "ExcelPackage Set. Path and (ExcelPackage or Now) should throw".PadRight(87) {
|
it "ExcelPackage Set. Path and (ExcelPackage or Now) should throw".PadRight(87) {
|
||||||
$ExcelPackage = Export-Excel -Path $Path -PassThru
|
$ExcelPackage = Export-Excel -Path $Path -PassThru
|
||||||
{Export-Excel -ExcelPackage $ExcelPackage -Path $Path} | Should -Throw -ExpectedMessage 'Parameter set cannot be resolved using the specified named parameters'
|
{Export-Excel -ExcelPackage $ExcelPackage -Path $Path} | Should Throw 'Parameter set cannot be resolved using the specified named parameters'
|
||||||
{Export-Excel -ExcelPackage $ExcelPackage -Now} | Should -Throw -ExpectedMessage 'Parameter set cannot be resolved using the specified named parameters'
|
{Export-Excel -ExcelPackage $ExcelPackage -Now} | Should Throw 'Parameter set cannot be resolved using the specified named parameters'
|
||||||
|
|
||||||
$Processes | Export-Excel -ExcelPackage $ExcelPackage
|
$Processes | Export-Excel -ExcelPackage $ExcelPackage
|
||||||
Remove-Item -Path $Path
|
Remove-Item -Path $Path
|
||||||
@@ -1001,33 +1001,33 @@ Describe ExportExcel {
|
|||||||
$ExcelPackage = Export-Excel -Path $Path -PassThru -TableName 'Data' -AutoFilter
|
$ExcelPackage = Export-Excel -Path $Path -PassThru -TableName 'Data' -AutoFilter
|
||||||
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
||||||
|
|
||||||
$Worksheet.Tables[0].Name | Should -Be 'Data'
|
$Worksheet.Tables[0].Name | Should Be 'Data'
|
||||||
$Worksheet.AutoFilterAddress | Should -BeNullOrEmpty
|
$Worksheet.AutoFilterAddress | Should BeNullOrEmpty
|
||||||
}
|
}
|
||||||
it "Default Set with Path and TableName with generated name".PadRight(87) {
|
it "Default Set with Path and TableName with generated name".PadRight(87) {
|
||||||
$ExcelPackage = $Processes | Export-Excel -Path $Path -PassThru -TableName ''
|
$ExcelPackage = $Processes | Export-Excel -Path $Path -PassThru -TableName ''
|
||||||
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
||||||
|
|
||||||
$ExcelPackage.File | Should -Be $Path
|
$ExcelPackage.File | Should Be $Path
|
||||||
$Worksheet.Tables[0].Name | Should -Be 'Table1'
|
$Worksheet.Tables[0].Name | Should Be 'Table1'
|
||||||
}
|
}
|
||||||
it "Now will use temp Path, set TableName with generated name and AutoSize".PadRight(87) {
|
it "Now will use temp Path, set TableName with generated name and AutoSize".PadRight(87) {
|
||||||
$ExcelPackage = $Processes | Export-Excel -Now -PassThru
|
$ExcelPackage = $Processes | Export-Excel -Now -PassThru
|
||||||
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
||||||
|
|
||||||
$ExcelPackage.File | Should -BeLike ([IO.Path]::GetTempPath() + '*')
|
$ExcelPackage.File | Should BeLike ([IO.Path]::GetTempPath() + '*')
|
||||||
$Worksheet.Tables[0].Name | Should -Be 'Table1'
|
$Worksheet.Tables[0].Name | Should Be 'Table1'
|
||||||
$Worksheet.AutoFilterAddress | Should -BeNullOrEmpty
|
$Worksheet.AutoFilterAddress | Should BeNullOrEmpty
|
||||||
$Worksheet.Column(5).Width | Should -BeGreaterThan 9.5
|
$Worksheet.Column(5).Width | Should BeGreaterThan 9.5
|
||||||
}
|
}
|
||||||
it "Now allows override of Path and TableName".PadRight(87) {
|
it "Now allows override of Path and TableName".PadRight(87) {
|
||||||
$ExcelPackage = $Processes | Export-Excel -Now -PassThru -Path $Path -TableName:$false
|
$ExcelPackage = $Processes | Export-Excel -Now -PassThru -Path $Path -TableName:$false
|
||||||
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
||||||
|
|
||||||
$ExcelPackage.File | Should -Be $Path
|
$ExcelPackage.File | Should Be $Path
|
||||||
$Worksheet.Tables | Should -BeNullOrEmpty
|
$Worksheet.Tables | Should BeNullOrEmpty
|
||||||
$Worksheet.AutoFilterAddress | Should -BeNullOrEmpty
|
$Worksheet.AutoFilterAddress | Should BeNullOrEmpty
|
||||||
$Worksheet.Column(5).Width | Should -BeGreaterThan 9.5
|
$Worksheet.Column(5).Width | Should BeGreaterThan 9.5
|
||||||
}
|
}
|
||||||
<# Mock looks unreliable need to check
|
<# Mock looks unreliable need to check
|
||||||
Mock -CommandName 'Invoke-Item'
|
Mock -CommandName 'Invoke-Item'
|
||||||
@@ -1044,17 +1044,17 @@ Describe ExportExcel {
|
|||||||
$ExcelPackage = $Processes | Export-Excel -Now -PassThru -AutoSize:$false -AutoFilter
|
$ExcelPackage = $Processes | Export-Excel -Now -PassThru -AutoSize:$false -AutoFilter
|
||||||
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
||||||
|
|
||||||
$Worksheet.Tables | Should -BeNullOrEmpty
|
$Worksheet.Tables | Should BeNullOrEmpty
|
||||||
$Worksheet.AutoFilterAddress | Should -Not -BeNullOrEmpty
|
$Worksheet.AutoFilterAddress | Should Not BeNullOrEmpty
|
||||||
[math]::Round($Worksheet.Column(5).Width, 2) | Should -Be 9.14
|
[math]::Round($Worksheet.Column(5).Width, 2) | Should Be 9.14
|
||||||
}
|
}
|
||||||
it "Now allows to set TableName".PadRight(87) {
|
it "Now allows to set TableName".PadRight(87) {
|
||||||
$ExcelPackage = $Processes | Export-Excel -Now -PassThru -TableName 'Data'
|
$ExcelPackage = $Processes | Export-Excel -Now -PassThru -TableName 'Data'
|
||||||
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
$Worksheet = $ExcelPackage.Workbook.Worksheets[1]
|
||||||
|
|
||||||
$Worksheet.Tables[0].Name | Should -Be 'Data'
|
$Worksheet.Tables[0].Name | Should Be 'Data'
|
||||||
$Worksheet.AutoFilterAddress | Should -BeNullOrEmpty
|
$Worksheet.AutoFilterAddress | Should BeNullOrEmpty
|
||||||
$Worksheet.Column(5).Width | Should -BeGreaterThan 9.5
|
$Worksheet.Column(5).Width | Should BeGreaterThan 9.5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user