. $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-ChocolateyParameterString" { $testCases = @() foreach($testCase in @( @{Name = 'Alkami.Api.OrbFX'; Short = 'ORBFX';} @{Name = 'Alkami.Api.CUFX'; Short = 'CUFX';} @{Name = 'Alkami.Security.RPSTS'; Short = 'RP-STS';} @{Name = "Alkami.App.Providers.SymConnectMultiplexer"; Short = "SymConnect";} @{Name = 'unknown package name'; Short = 'unknown package name';} )) { $testCases += @{ caseDescription = 'Matches the expected response string when only package is specified' package = @{ Name = $testCase.Name } testName = $testCase.Name environment = '' runMigrations = $false startService = $false outputExpected = '"/MigrationsEnabled:false /Alkami.Installer.ServiceStartupMode:false "' } $testCases += @{ caseDescription = 'Matches the expected response string when environment is not empty' package = @{ Name = $testCase.Name } testName = $testCase.Name environment = 'Not A Real Environment' runMigrations = $false startService = $false outputExpected = ('"/MigrationsEnabled:false /Alkami.Installer.ServiceStartupMode:false /NewRelicAppName:''Not A Real Environment {0}''"' -f $testCase.Short) } $testCases += @{ caseDescription = 'Matches the expected response string when runMigrations is true' package = @{ Name = $testCase.Name } testName = $testCase.Name environment = '' runMigrations = $true startService = $false outputExpected = '"/MigrationsEnabled:true /Alkami.Installer.ServiceStartupMode:false "' } $testCases += @{ caseDescription = 'Matches the expected response string when startServices is true' package = @{ Name = $testCase.Name } testName = $testCase.Name environment = '' runMigrations = $false startService = $true outputExpected = '"/MigrationsEnabled:false /Alkami.Installer.ServiceStartupMode:true "' } $testCases += @{ caseDescription = 'Matches the expected response string when environment is not empty and runMigrations is true and startServices is true' package = @{ Name = $testCase.Name } testName = $testCase.Name environment = 'Not A Real Environment' runMigrations = $true startService = $true outputExpected = ('"/MigrationsEnabled:true /Alkami.Installer.ServiceStartupMode:true /NewRelicAppName:''Not A Real Environment {0}''"' -f $testCase.Short) } } Context "Test basic scenarios" { It " for " -TestCases $testCases { param( $package, $environment, $runMigrations, $startService, $outputExpected ) (Get-ChocolateyParameterString -package $package -environment $environment -runMigrations $runMigrations -startService $startService) | Should -Be $outputExpected } } }