With MS ramming powershell into all new server products, I\'m starting to (reluctantly) think I need to take it seriously. Part of \"taking it seriously\" is TDD. Have you f
I am writing some basic PowerShell scripts with TDD like the following model:
First, the spec in SUT_spec.ps1:
Import-Module -Name .\my_SUT.ps1
$case1_input=@{}
$case1_output=@{}
f1 $case1_input $case1_output
$case1_result = $case1_output["Output"] -eq "expected"
"f1 case1: $case1_result"
# repeat for all test cases
Remove-Module -Name my_SUT
Second, my unit (SUT) as a function in my_SUT.ps1 file:
function f1($the_input, $the_output)
{
#take input from $the_input hashtable, process it and put output into $the_output hashtable.
$the_output["Output"]="results"
}
Third, the releasable main entry point as a separated file like SUT_spec.ps1 but with inputs from actual external sources.