From 35e013fe1dde3e048a6e1ec50184d86ae4f140ee Mon Sep 17 00:00:00 2001 From: ili101 Date: Sun, 18 Aug 2019 22:37:24 +0300 Subject: [PATCH] Reverted to Pester Old syntax --- __tests__/Export-Excel.Tests.ps1 | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/__tests__/Export-Excel.Tests.ps1 b/__tests__/Export-Excel.Tests.ps1 index d5f2a0c..d259369 100644 --- a/__tests__/Export-Excel.Tests.ps1 +++ b/__tests__/Export-Excel.Tests.ps1 @@ -984,15 +984,15 @@ Describe ExportExcel { $ExcelPackage = $Processes | Export-Excel -Path $Path -PassThru $Worksheet = $ExcelPackage.Workbook.Worksheets[1] - $ExcelPackage.File | Should -Be $Path - $Worksheet.Cells['A1'].Value | Should -Be 'Name' - $Worksheet.Tables | Should -BeNullOrEmpty - $Worksheet.AutoFilterAddress | Should -BeNullOrEmpty + $ExcelPackage.File | Should Be $Path + $Worksheet.Cells['A1'].Value | Should Be 'Name' + $Worksheet.Tables | Should BeNullOrEmpty + $Worksheet.AutoFilterAddress | Should BeNullOrEmpty } it "ExcelPackage Set. Path and (ExcelPackage or Now) should throw".PadRight(87) { $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 -Now} | 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 'Parameter set cannot be resolved using the specified named parameters' $Processes | Export-Excel -ExcelPackage $ExcelPackage Remove-Item -Path $Path @@ -1001,33 +1001,33 @@ Describe ExportExcel { $ExcelPackage = Export-Excel -Path $Path -PassThru -TableName 'Data' -AutoFilter $Worksheet = $ExcelPackage.Workbook.Worksheets[1] - $Worksheet.Tables[0].Name | Should -Be 'Data' - $Worksheet.AutoFilterAddress | Should -BeNullOrEmpty + $Worksheet.Tables[0].Name | Should Be 'Data' + $Worksheet.AutoFilterAddress | Should BeNullOrEmpty } it "Default Set with Path and TableName with generated name".PadRight(87) { $ExcelPackage = $Processes | Export-Excel -Path $Path -PassThru -TableName '' $Worksheet = $ExcelPackage.Workbook.Worksheets[1] - $ExcelPackage.File | Should -Be $Path - $Worksheet.Tables[0].Name | Should -Be 'Table1' + $ExcelPackage.File | Should Be $Path + $Worksheet.Tables[0].Name | Should Be 'Table1' } it "Now will use temp Path, set TableName with generated name and AutoSize".PadRight(87) { $ExcelPackage = $Processes | Export-Excel -Now -PassThru $Worksheet = $ExcelPackage.Workbook.Worksheets[1] - $ExcelPackage.File | Should -BeLike ([IO.Path]::GetTempPath() + '*') - $Worksheet.Tables[0].Name | Should -Be 'Table1' - $Worksheet.AutoFilterAddress | Should -BeNullOrEmpty - $Worksheet.Column(5).Width | Should -BeGreaterThan 9.5 + $ExcelPackage.File | Should BeLike ([IO.Path]::GetTempPath() + '*') + $Worksheet.Tables[0].Name | Should Be 'Table1' + $Worksheet.AutoFilterAddress | Should BeNullOrEmpty + $Worksheet.Column(5).Width | Should BeGreaterThan 9.5 } it "Now allows override of Path and TableName".PadRight(87) { $ExcelPackage = $Processes | Export-Excel -Now -PassThru -Path $Path -TableName:$false $Worksheet = $ExcelPackage.Workbook.Worksheets[1] - $ExcelPackage.File | Should -Be $Path - $Worksheet.Tables | Should -BeNullOrEmpty - $Worksheet.AutoFilterAddress | Should -BeNullOrEmpty - $Worksheet.Column(5).Width | Should -BeGreaterThan 9.5 + $ExcelPackage.File | Should Be $Path + $Worksheet.Tables | Should BeNullOrEmpty + $Worksheet.AutoFilterAddress | Should BeNullOrEmpty + $Worksheet.Column(5).Width | Should BeGreaterThan 9.5 } <# Mock looks unreliable need to check Mock -CommandName 'Invoke-Item' @@ -1044,17 +1044,17 @@ Describe ExportExcel { $ExcelPackage = $Processes | Export-Excel -Now -PassThru -AutoSize:$false -AutoFilter $Worksheet = $ExcelPackage.Workbook.Worksheets[1] - $Worksheet.Tables | Should -BeNullOrEmpty - $Worksheet.AutoFilterAddress | Should -Not -BeNullOrEmpty - [math]::Round($Worksheet.Column(5).Width, 2) | Should -Be 9.14 + $Worksheet.Tables | Should BeNullOrEmpty + $Worksheet.AutoFilterAddress | Should Not BeNullOrEmpty + [math]::Round($Worksheet.Column(5).Width, 2) | Should Be 9.14 } it "Now allows to set TableName".PadRight(87) { $ExcelPackage = $Processes | Export-Excel -Now -PassThru -TableName 'Data' $Worksheet = $ExcelPackage.Workbook.Worksheets[1] - $Worksheet.Tables[0].Name | Should -Be 'Data' - $Worksheet.AutoFilterAddress | Should -BeNullOrEmpty - $Worksheet.Column(5).Width | Should -BeGreaterThan 9.5 + $Worksheet.Tables[0].Name | Should Be 'Data' + $Worksheet.AutoFilterAddress | Should BeNullOrEmpty + $Worksheet.Column(5).Width | Should BeGreaterThan 9.5 } } }