From 3d6dae89a113bb9b462d99c13d76f7b7f0c1db8b Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Mon, 16 May 2016 19:50:41 -0700 Subject: [PATCH] Update fixes based on lzybkr comments for Update-TypeData Pester Test --- test/powershell/Update-TypeData.Tests.ps1 | 30 ++--------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/test/powershell/Update-TypeData.Tests.ps1 b/test/powershell/Update-TypeData.Tests.ps1 index 5375ce087..eb30c0e29 100644 --- a/test/powershell/Update-TypeData.Tests.ps1 +++ b/test/powershell/Update-TypeData.Tests.ps1 @@ -11,8 +11,7 @@ Describe "Update-TypeData" { Describe "Update-TypeData basic functionality" -Tags DRT{ $testfilename = "testfile.ps1xml" $testfile = Join-Path -Path $TestDrive -ChildPath $testfilename - $invalidFileExtensionFile = Join-Path -Path $TestDrive -ChildPath "notmshxml" - $filelist = Join-Path -Path $TestDrive -ChildPath "fileList.ps1xml" + $invalidFileExtensionFile = Join-Path -Path $TestDrive -ChildPath "notmshxml" #Pester bug:https://github.com/PowerShell/psl-pester/issues/6 It "Update-TypeData with Invalid TypesXml should throw Exception" -Pending{ @@ -56,7 +55,7 @@ Describe "Update-TypeData basic functionality" -Tags DRT{ finally { Remove-TypeData -Path $testfile - Remove-Item $testfile -ErrorAction SilentlyContinue + Remove-Item $testfile -Force } } @@ -80,31 +79,6 @@ Describe "Update-TypeData basic functionality" -Tags DRT{ } } - It "Update-TypeData with Invalid File List Extension should throw Exception"{ - $xmlContent="not really an xml file, but we will not use it" - $xmlContent>$invalidFileExtensionFile - $filelistContent = "" + $invalidFileExtensionFile + "" - $filelistContent>$filelist - try - { - Update-TypeData -AppendPath $filelist -EA Stop - Throw "We expect TypesXmlUpdateException, but it didn't throw." - } - catch - { - $error[0] | Should Match "ps1xml" - $_.CategoryInfo | Should Match "RuntimeException" - $_.FullyQualifiedErrorId | Should be "TypesXmlUpdateException,Microsoft.PowerShell.Commands.UpdateTypeDataCommand" - } - finally - { - Remove-TypeData -Path $filelist - Remove-Item $invalidFileExtensionFile -ErrorAction SilentlyContinue - Remove-Item $filelist -ErrorAction SilentlyContinue - } - } - - It "Update-TypeData with Valid Dynamic Type NoteProperty with Force should work"{ try {