From f0de4321c84ca8935cdcf68708a56c9857655936 Mon Sep 17 00:00:00 2001 From: TingLiu6 Date: Wed, 11 May 2016 23:29:15 -0700 Subject: [PATCH 1/2] Add Unit Test for Export-FormatData --- test/powershell/Export-FormatData.Tests.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/powershell/Export-FormatData.Tests.ps1 b/test/powershell/Export-FormatData.Tests.ps1 index d34da78cc..1900538aa 100644 --- a/test/powershell/Export-FormatData.Tests.ps1 +++ b/test/powershell/Export-FormatData.Tests.ps1 @@ -1,3 +1,19 @@ +Describe "Export-FormatData DRT Unit Tests" -Tags DRT{ + It "Test basic functionality" { + $fd = Get-FormatData + $tempFile = [io.path]::GetTempFileName() + $results = Export-FormatData -InputObject $fd[0] -Path $tempFile + $content = Get-Content $tempFile + $formatViewDefinition = $fd[0].FormatViewDefinition + $typeName = $fd[0].TypeName + $content.Contains($typeName) | Should Be $true + for ($i = 0; $i -lt $formatViewDefinition.Count;$i++) + { + $content.Contains($formatViewDefinition[$i].Name) | Should Be $true + } + } +} + Describe "Export-FormatData" { Context "Check Export-FormatData can be called validly." { From c4beeb9f62d506d123263fedbb458c42c5617802 Mon Sep 17 00:00:00 2001 From: TingLiu6 Date: Thu, 12 May 2016 21:51:55 -0700 Subject: [PATCH 2/2] Fixed CR issues --- test/powershell/Export-FormatData.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/powershell/Export-FormatData.Tests.ps1 b/test/powershell/Export-FormatData.Tests.ps1 index 1900538aa..9a8c0c1d3 100644 --- a/test/powershell/Export-FormatData.Tests.ps1 +++ b/test/powershell/Export-FormatData.Tests.ps1 @@ -1,7 +1,7 @@ Describe "Export-FormatData DRT Unit Tests" -Tags DRT{ It "Test basic functionality" { $fd = Get-FormatData - $tempFile = [io.path]::GetTempFileName() + $tempFile = Join-Path $TestDrive -ChildPath "exportFormatTest.txt" $results = Export-FormatData -InputObject $fd[0] -Path $tempFile $content = Get-Content $tempFile $formatViewDefinition = $fd[0].FormatViewDefinition