From e3603e3bf3dcc7313c990529c9279cbb5b3a4014 Mon Sep 17 00:00:00 2001 From: TingLiu6 Date: Fri, 6 May 2016 04:09:57 -0700 Subject: [PATCH] Add Unit Test for ConvertFrom-StringData --- .../ConvertFrom-StringData.Tests.ps1 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/powershell/ConvertFrom-StringData.Tests.ps1 b/test/powershell/ConvertFrom-StringData.Tests.ps1 index f1ec128e66..fe1f6232a7 100644 --- a/test/powershell/ConvertFrom-StringData.Tests.ps1 +++ b/test/powershell/ConvertFrom-StringData.Tests.ps1 @@ -1,3 +1,23 @@ +Describe "ConvertFrom-StringData DRT Unit Tests" -Tags DRT { + It "Should able to throw error when convert invalid line" { + $str =@" +#comments here +abc +#comments here +def=content of def +"@ + try + { + ConvertFrom-StringData $str + Throw "we expect 'InvalidOperation' exception" + } + catch + { + $_.FullyQualifiedErrorId | Should be "InvalidOperation,Microsoft.PowerShell.Commands.ConvertFromStringDataCommand" + } + } +} + Describe "ConvertFrom-StringData" { $sampleData = @' foo = 0