Testing/Get-ContainerCompanyToTest.ps1

function Get-ContainerCompanyToTest {
    param(
        # Container to use
        [Parameter(Mandatory=$false)]
        [string]
        $ContainerName = (Get-ContainerFromLaunchJson)
    )

    $Companies = (New-WebServiceProxy ('http://{0}:7047/{1}/WS/SystemService?tenant=default' -f (Get-NavContainerIpAddress $ContainerName), (Get-ContainerWebServerInstance $ContainerName)) -Credential (New-CredentialFromEnvironmentJson)).Companies()
    
    # there is a blank company in the Danish database - don't ask, I don't know
    if ((Get-NavContainerCountry $ContainerName) -eq 'dk') { 
        $CompanyName = $Companies.Item(1)
    }
    else {
        if ($null -eq $Companies.Count) {
            $CompanyName = $Companies
        }
        else {
            $CompanyName = $Companies.Item(0)
        }
    }

    $CompanyName
}

Export-ModuleMember -Function Get-ContainerCompanyToTest