CmdLets/Library/Test-LibraryPackage.ps1

Function Test-LibraryPackage 
 {

    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$True,ValueFromPipeline=$True)]
            [ValidateNotNullOrEmpty()]
                [System.IO.FileInfo[]]$PackageFile,
        [Parameter(Mandatory=$false)]
            [System.IO.FileInfo]$ScriptRoot = "C:\Temp\Scripts"
    )
    Begin {}
    Process{
        ForEach ($Item in $PackageFile){
            Write-Host "Package File: $($Item.FullName)"
            $Package = Get-Content $Item | ConvertFrom-Json

            Write-Host "Package Name: $($Package.Name)"
            Write-Verbose $Package

            Write-verbose "Initializing Variables" -ForegroundColor Cyan
            Initialize-Variables $Package.Variables

            $Libraries = Get-Childitem (Join-Path $LibraryPath "*.json")
            Write-Host "Libraries Found: $($Libraries.Count)"

            Write-Verbose "Analyzing Applications"
            $Applications = @()
            $Unfound = @()
            ForEach ($Name in $Package.Applications) {
                Write-Verbose "`tFinding: $Name"
                $Application = Find-LibraryApplication $Name
                if ($Application) {
                    $Applications += $Application
                } else {
                    $Unfound += $Name
                }
            }

            Write-Host "Found Applications: $($Applications.Count)" -ForegroundColor Cyan
            $Applications.Name
            Write-Host "Unfound Applications: $($Unfound.Count)" -ForegroundColor Magenta
            $Unfound

            Read-Host "Press Enter to start Application Source Testing"
            $Applications | Test-LibraryApplication -Path $SoftwarePath
        }
    }
    End{}

}