Tests/Update-TFSConfigFile.Tests.ps1

Describe "Update-TFSConfigFile" {
    Mock Get-TFSConfigPath {Join-Path $TestDrive 'TFS Tools Config.json'}

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

    It "should include collection url" {
        {Update-TFSConfigFile;(Get-TFSConfigKeyValue 'collectionUrl')} | should not be $null
    }

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

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

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

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

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

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

    It "should include a translation dictionary" {
        Update-TFSConfigFile;
        Get-TFSConfigPath 'translationDictionaryPath' | should not be $null
    }

    It "should include ftpServer" {
        Update-TFSConfigFile;
        Get-TFSConfigPath 'ftpServer' | should not be $null
    }

    It "should include ftpUser" {
        Update-TFSConfigFile;
        Get-TFSConfigPath 'ftpUser' | should not be $null
    }

    It "should include ftpPassword" {
        Update-TFSConfigFile;
        Get-TFSConfigPath 'ftpPassword' | should not be $null
    }
}