Private/Invoke-PoshspecExpression.ps1

<#
.SYNOPSIS
    Executes a Pester 'It' block using values generated by Get-PoshspecParam
.EXAMPLE
    Invoke-PoshspecExpression -InputObject ([pscustomobject]@{Name = "File 'C:\Temp' Should -Exist"; Expression = "'C:\Temp' | Should -Exist" })
#>

function Invoke-PoshspecExpression {
    [CmdletBinding()]
    param(
        # Poshspec Param Object
        [Parameter(Mandatory, Position=0)]
        [PSCustomObject]
        $InputObject
    )
    
    Write-Verbose -Message "Invoking 'it' block with expression: $($InputObject.Expression)"
    It $InputObject.Name {
        Invoke-Expression $InputObject.Expression
    }    
}