Tests/Update-TFSConfigFile.Tests.ps1

Describe "Update-TFSConfigFile" {
    if (Test-Path (Get-TFSConfigPath)) {
        $ConfigContent = Get-Content (Get-TFSConfigPath)
        Remove-Item (Get-TFSConfigPath)
    }

    Update-TFSConfigFile

    It "should create config file when it doesn't exist" {
        (Test-Path (Get-TFSConfigPath)) | should be $true
    }

    It "should include collection url" {
        Get-TFSConfigKeyValue 'collectionUrl' | should not be $null
    }

    It "should include user" {
        Get-TFSConfigKeyValue 'user' | should not be $null
    }

    It "should include password" {
        Get-TFSConfigKeyValue 'password' | should not be $null
    }

    It "should include translationKey" {
        Get-TFSConfigKeyValue 'translationKey' | should not be $null
    }

    It "should include codeSigningCertThumbprint" {
        Get-TFSConfigKeyValue 'codeSigningCertThumbprint' | should not be $null
    }

    It "should include businessCentralLicenceFile" {
        Get-TFSConfigKeyValue 'businessCentralLicenceFile' | should not be $null
    }

    It "should include navLicenceFile" {
        Get-TFSConfigKeyValue 'navLicenceFile' | should not be $null
    }

    if ($null -ne $ConfigContent) {
        Set-Content -Value $ConfigContent -Path (Get-TFSConfigPath)
    }
}