Public/InstallHelpers/Install.RunExecutable.Functions.Tests.ps1
#Requires -Version 5.0 #Requires -Modules @{ ModuleName="Pester"; ModuleVersion="3.4.0" } $ErrorActionPreference = "Stop"; Set-StrictMode -Version 'Latest' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.ps1', '.psm1' Import-Module "$PSScriptRoot\$sut" -Force # DANGER: This test will drop a specified database # NOTE: This test requires an unnamed SqlServer instance running locally # on the standard port(1433) and SSMS (for Invoke-Sqlcmd), # so we'll only run this manually. (Uncomment to run) # Describe 'RunSchemaBuilder' { # # Arrange # [string] $dbName = 'TrainingNotifier_Test' # [string] $exeArgs = "-v true -h localhost -d $dbName -i true" # [string] $dropDbCmd = "ALTER DATABASE [$dbName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE [$dbName]" # Invoke-Sqlcmd -Query $dropDbCmd -HostName 'Localhost' | Out-Null # [string] $pathToExe = "$PSScriptRoot\Fixtures\TN.SchemaBuilder\App.SchemaBuilder.exe" # # Act # RunSchemaBuilder -pathToExe $pathToExe -argsString $exeArgs # $actual = Invoke-Sqlcmd -Query "SELECT DB_ID('$dbName')" -HostName 'Localhost' # # Assert # It "returns expected" { # $actual.Column1 | Should Not Be $null # } # } |