GenSql.Tests.ps1
cd $PSScriptRoot Upd-PsmFil GenSql Describe Gen-SqlFil { Context '$pth is given' { It "Convert 2 OK sql3 files" { Mock Vdt-Sql3 { $false,"From Mock: sql3 is OK" } Mock Get-Sql { "Sql statements" } Gen-Sql3.ps1 ".\sql" # It "Should not call [Get-Sql]" { # Assert-MockCalled Get-Sql -Times 0 # -ParameterFilter {$} # } throw "sdf" } It "Convert 2 Err sql3 files" { Mock Vdt-Sql3 { $true,"sql3 is err" } & .\Gen-Sql3.ps1 -pth .\sql # <--- 1 | Should be 1 } } Context '$pth is not given; using $pwd' { } } return Describe Is-L? { function fun($lvl) {Get-Script("Is-L"+$lvl)} function run ($lvl,$lin,$rmk,$rslt) { $it = "[$rslt]: Is-L$lvl [$lin] $rmk" $fun = fun $lvl $act = &$fun $lin it $it { $act| should be $rslt } } function T($lvl,$lin,$rmk) { run $lvl $lin $rmk $true } function F($lvl,$lin,$rmk) { run $lvl $lin $rmk $false } T 1 'kfsdlff ' 'if non-rmk and fstChr is blank' T 2 ' sldkfsdlfdf ' 'if non-rmk and fst4Chr is blank and 5th-Chr is non-blank' T 3 ' sldkfsdlfd' 'if non-rmk and fst8Chr is blank and 9th-Chr is non-blank' F 1 '--dkfsdlfdf ' 'if rmk' F 2 '--dkfsdlfdf ' 'if rmk' F 3 '--dkfsdlfdf ' 'if rmk' T 3 ' kfsdlff ' 'if non-rmk and some-of-fst8Chr is non-blank' T 3 ' kfsdlff ' 'if non-rmk and some-of-fst8Chr is non-blank' F 1 '--dkfsdlfdf ' 'if rmk' F 2 ' sldkfsdlfdf' 'if non-rmk and fst8Chr is blank and 9th-Chr is non-blank' } Describe *-Indt* { function run($lin,$rslt) {it "Is-IndtEr: [$lin] -> $rslt"; Is-IndtEr $lin | should be $rslt } function runPos($lin) {run $lin $true } function runNeg($lin) {run $lin $false} runPos "sldkfsdlfdf " runPos " sldkfsdlfdf " runPos " sldkfsdlfdf" runPos "sldkf sdf " runPos " ssdf df " runNeg "" } |