diff --git a/PSWriteWord.Tests.ps1 b/PSWriteWord.Tests.ps1 index ba87688..69d2de2 100644 --- a/PSWriteWord.Tests.ps1 +++ b/PSWriteWord.Tests.ps1 @@ -13,10 +13,6 @@ if ($null -eq (Get-Module -ListAvailable PSSharedGoods)) { Import-Module PSSharedGoods -Force Import-Module $PSScriptRoot\PSWriteWord.psd1 -Force -Import-Module Pester - -Get-Module Pester -Get-Module -ListAvailable Pester $result = Invoke-Pester -Script $PSScriptRoot\Tests -Verbose -EnableExit diff --git a/Tests/Add-WordList.Tests.ps1 b/Tests/Add-WordList.Tests.ps1 index 00ed0dc..5b86bf9 100644 --- a/Tests/Add-WordList.Tests.ps1 +++ b/Tests/Add-WordList.Tests.ps1 @@ -1,12 +1,22 @@ -$ListOfItems1 = @('Test1') -$ListOfItems2 = @('Test1', 'Test2') -$ListOfItems5 = @('Test1', 'Test2', 'Test3', 'Test4', 'Test5') +Describe 'Add-WordList' { + $ListOfItems1 = @('Test1') + $ListOfItems2 = @('Test1', 'Test2') + $ListOfItems5 = @('Test1', 'Test2', 'Test3', 'Test4', 'Test5') -$ListOfItemsNotArray1 = 'Test1' -$ListOfItemsNotArray2 = $false -$ListOfItemsNotArray3 = $false, $true + $ListOfItemsNotArray1 = 'Test1' + $ListOfItemsNotArray2 = $false + $ListOfItemsNotArray3 = $false, $true -Describe 'Add-WordList' { + $PSDefaultParameterValues = @{ + "It:TestCases" = @{ + ListOfItems1 = $ListOfItems1 + ListOfItems2 = $ListOfItems2 + ListOfItems5 = $ListOfItems5 + ListOfItemsNotArray1 = $ListOfItemsNotArray1 + ListOfItemsNotArray2 = $ListOfItemsNotArray2 + ListOfItemsNotArray3 = $ListOfItemsNotArray3 + } + } It 'Given single string to Add-WordList should properly create a list' { $WordDocument = New-WordDocument Add-WordList -WordDocument $WordDocument -ListType Bulleted -ListData $ListOfItemsNotArray1 -Supress $True #-Verbose diff --git a/Tests/Add-WordPicture.Tests.ps1 b/Tests/Add-WordPicture.Tests.ps1 index ac3f33c..aae8f2a 100644 --- a/Tests/Add-WordPicture.Tests.ps1 +++ b/Tests/Add-WordPicture.Tests.ps1 @@ -1,10 +1,18 @@ -$FilePath = "$Env:USERPROFILE\Desktop\PSWriteWord-Example-AddPicture2.docx" -$FilePathImage1 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.png" -$FilePathImage2 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.jpg" - -$TemporaryFolder = [IO.Path]::GetTempPath() - Describe 'Add-WordPicture' { + $FilePath = "$Env:USERPROFILE\Desktop\PSWriteWord-Example-AddPicture2.docx" + $FilePathImage1 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.png" + $FilePathImage2 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.jpg" + + $TemporaryFolder = [IO.Path]::GetTempPath() + + $PSDefaultParameterValues = @{ + "It:TestCases" = @{ + FilePath = $FilePath + FilePathImage1 = $FilePathImage1 + FilePathImage2 = $FilePathImage2 + TemporaryFolder = $TemporaryFolder + } + } It 'Given 2 pictures, one with rotation - Adding them in memory should work properly' { $FilePath = [IO.Path]::Combine($TemporaryFolder, "1.docx") diff --git a/Tests/Add-WordTable.Tests.ps1 b/Tests/Add-WordTable.Tests.ps1 index 552669f..5063557 100644 --- a/Tests/Add-WordTable.Tests.ps1 +++ b/Tests/Add-WordTable.Tests.ps1 @@ -114,6 +114,37 @@ $Array += Get-ObjectType -Object $InvoiceDataOrdered2 -ObjectName '$InvoiceDataO $Array | Format-Table -AutoSize #> + +$PSDefaultParameterValues = @{ + "It:TestCases" = @{ + InvoiceDataOrdered2 = $InvoiceDataOrdered2 + InvoiceDataOrdered1 = $InvoiceDataOrdered1 + InvoiceEntry8 = $InvoiceEntry8 + InvoiceEntry7 = $InvoiceEntry7 + myArray1 = $myArray1 + myArray2 = $myArray2 + myObject3 = $myObject3 + myObject2 = $myObject2 + Object1 = $Object1 + Object2 = $Object2 + Object3 = $Object3 + Object4 = $Object4 + InvoiceData4 = $InvoiceData4 + InvoiceData3 = $InvoiceData3 + InvoiceData2 = $InvoiceData2 + InvoiceData1 = $InvoiceData1 + InvoiceEntry1 = $InvoiceEntry1 + InvoiceEntry2 = $InvoiceEntry2 + InvoiceEntry3 = $InvoiceEntry3 + InvoiceEntry4 = $InvoiceEntry4 + InvoiceEntry5 = $InvoiceEntry5 + myitems0 = $myitems0 + myitems1 = $myitems1 + myitems2 = $myitems2 + obj = $obj + } +} + Describe 'Add-WordTable - Should deliver same results as Format-Table -Autosize' { It 'Given (MyItems0) should have 3 columns, 4 rows, 3rd row 3rd column should be Food lover' {