Chapters/unit-testing-your-code/step2/Get-FileContents.ps1
function Get-FileContents { [CmdletBinding()] Param( [Parameter(Mandatory=$True, ValueFromPipeline=$True)] [string[]]$Path ) PROCESS { foreach ($folder in $path) { Write-Verbose "Path is $folder" $segments = $folder -split "\\" $last = $segments[-1] Write-Verbose "Last path is $last" $filename = Join-Path $folder $last $filename += ".txt" Get-Content $filename } #foreach folder } #process } |