Misc/Get-UseStandardTest.ps1
<# .SYNOPSIS Determines whether the standard test implemenation should be used or not .DESCRIPTION Determines whether the app.json can be used with "test" or not. This depends whether or not you have customized standard objects .PARAMETER MajorVersion Version of the project's Dynamics NAV / Business Central version .PARAMETER SourcePath Optional path to the project .EXAMPLE $isStandard = Get-UseStandardTest -MajorVersion 14 #> function Get-UseStandardTest { Param( [Parameter(Mandatory = $true)] [int]$MajorVersion, [Parameter(Mandatory = $false)] [string]$SourcePath = (Get-Location) ) $return = $false if ($MajorVersion -gt 11) { $baseObjects = Get-ChildItem (Join-Path $SourcePath ".\BaseObjects\") -Filter "*.txt" -Recurse -ErrorAction SilentlyContinue if ($MajorVersion -ne 14 -or ($MajorVersion -eq 14 -and $null -eq $baseObjects)) { $return = $true } } $return } |