. $PSScriptRoot\..\..\Load-PesterModules.ps1 $here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.' $functionPath = Join-Path -Path $here -ChildPath $sut Write-Host "Overriding SUT: $functionPath" Import-Module $functionPath -Force $moduleForMock = "" Describe "Get-PackageManifest" { Context "Assembly and Package is provided in Manifest" { Mock -CommandName Write-Warning -MockWith {} Mock -CommandName Test-AlkamiManifest -MockWith { $false } $sampleManifest = @" 1.0 Alkami Alkami.MicroServices.FluxManagement.Service.Host Service framework Alkami.MicroServices.FluxManagement.Service.Host Alkami.MicroServices.FluxManagement.Migrations.dll FluxManagement_Service "@ $FeedSource = "FakeFeed" $Name = "FakeApp" $Version = "1.23" It "Should Throw" { { Get-PackageManifest -RawContent $sampleManifest -PackageName $Name -ManifestSource "$FeedSource $Name $Version" } | Should Throw } It "Manifest warning equals fake values" { { Get-PackageManifest -RawContent $sampleManifest -PackageName $Name -ManifestSource "$FeedSource $Name $Version" } | Should Throw Assert-MockCalled -CommandName Write-Warning -Times 1 -Exactly -Scope It -ModuleName $moduleForMock -ParameterFilter { $Message -eq "[Get-PackageManifest] : Manifest at [FakeFeed FakeApp 1.23] failed processing. Please resolve errors and reprocess." } } } }