Fixed the CR issue

This commit is contained in:
TingLiu6 2016-05-10 02:07:29 -07:00 committed by JumpingYang001
parent dbd2a8f1b1
commit 10144d7c55
2 changed files with 22 additions and 28 deletions

View file

@ -2,22 +2,22 @@ Describe "Update-FormatData" {
Context "Validate Update-FormatData update correctly" {
It "Should not throw upon reloading previous formatting file" {
{ Update-FormatData } | Should Not throw
}
It "Should not throw upon reloading previous formatting file" {
{ Update-FormatData } | Should Not throw
}
It "Should validly load formatting data" {
{ Get-FormatData -typename System.Diagnostics.Process | Export-FormatData -Path "outputfile.ps1xml" }
{ Update-FormatData -prependPath "outputfile.ps1xml" | Should Not throw }
{ Remove-Item "outputfile.ps1xml" -ErrorAction SilentlyContinue }
}
It "Should validly load formatting data" {
$path = Join-Path -Path $TestDrive -ChildPath "outputfile.ps1xml"
Get-FormatData -typename System.Diagnostics.Process | Export-FormatData -Path $path
{ Update-FormatData -prependPath $path } | Should Not throw
Remove-Item $path -ErrorAction SilentlyContinue
}
}
}
Describe "Update-FormatData basic functionality" -Tags DRT{
$tmpDirectory = $TestDrive
$testfilename = "testfile.ps1xml"
$testfile = Join-Path -Path $tmpDirectory -ChildPath $testfilename
$testfile = Join-Path -Path $TestDrive -ChildPath $testfilename
It "Update-FormatData with WhatIf should work"{
$xmlContent=@"
@ -36,15 +36,15 @@ Describe "Update-FormatData basic functionality" -Tags DRT{
</Type>
</Types>
"@
$xmlContent>$testfile
$xmlContent > $testfile
try
{
{Update-FormatData -Append $testfile -WhatIf} | Should Not Throw
{Update-FormatData -Prepend $testfile -WhatIf} | Should Not Throw
{ Update-FormatData -Append $testfile -WhatIf } | Should Not Throw
{ Update-FormatData -Prepend $testfile -WhatIf } | Should Not Throw
}
finally
{
rm $testfile
Remove-Item $testfile -ErrorAction SilentlyContinue
}
}
}

View file

@ -2,15 +2,9 @@ Describe "Update-TypeData" {
Context "Validate Update-Type updates correctly" {
It "Should not throw upon reloading previous formatting file" {
{ Update-TypeData } | Should Not throw
}
It "Should validly load formatting data" {
{ Get-TypeData -typename System.Diagnostics.Process | Export-TypeData -Path "outputfile.ps1xml" }
{ Update-TypeData -prependPath "outputfile.ps1xml" | Should Not throw }
{ Remove-Item "outputfile.ps1xml" -ErrorAction SilentlyContinue }
}
It "Should not throw upon reloading previous formatting file" {
{ Update-TypeData } | Should Not throw
}
}
}
@ -62,7 +56,7 @@ Describe "Update-TypeData basic functionality" -Tags DRT{
finally
{
Remove-TypeData -Path $testfile
rm $testfile
Remove-Item $testfile -ErrorAction SilentlyContinue
}
}
@ -82,7 +76,7 @@ Describe "Update-TypeData basic functionality" -Tags DRT{
}
finally
{
rm $invalidFileExtensionFile
Remove-Item $invalidFileExtensionFile -ErrorAction SilentlyContinue
}
}
@ -105,8 +99,8 @@ Describe "Update-TypeData basic functionality" -Tags DRT{
finally
{
Remove-TypeData -Path $filelist
rm $invalidFileExtensionFile
rm $filelist
Remove-Item $invalidFileExtensionFile -ErrorAction SilentlyContinue
Remove-Item $filelist -ErrorAction SilentlyContinue
}
}
@ -359,7 +353,7 @@ Describe "Update-TypeData basic functionality" -Tags DRT{
finally
{
Remove-TypeData -Path $testfile
rm $testfile
Remove-Item $testfile -ErrorAction SilentlyContinue
}
}
}