Tests/Unit/Public/Support/CallQueue/New-TeamsCallQueueTrigger.Tests.ps1

# Module: Orbit.Teams
# Function: Test
# Author: David Eberhardt
# Updated: 03-JUN 2023

# Script Analyzer Exceptions
#[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUserDeclaredVarsMoreThanAssignments', '', Justification = 'Context Boundaries')]


# Unit Tests
Describe -Tags ('Unit', 'Acceptance') "Function '$(((Split-Path -Leaf $PsCommandPath) -replace '\.Tests\.', '.') -replace '\.ps1', '')'" {
  InModuleScope -ModuleName 'Orbit.Teams' {
    BeforeAll {
      # Mocking basic connection commands to avoid connectivity related errors
      Mock Assert-GraphConnection -MockWith { $true }
      Mock Test-GraphConnection -MockWith { $true }
      Mock Assert-MicrosoftTeamsConnection -MockWith { $true }
      Mock Test-MicrosoftTeamsConnection -MockWith { $true }

      Mock Get-CsAutoAttendantSupportedLanguage { return $LanguageObjectEN_AU } -ParameterFilter { $Id -and $Id -eq 'en-AU' }
      Mock Get-CsAutoAttendantSupportedLanguage { return $LanguageObjectEN_US } -ParameterFilter { $Id -and $Id -eq 'en-US' }
      Mock Get-CsAutoAttendantSupportedLanguage { return $LanguageObjectNL_NL } -ParameterFilter { $Id -and $Id -eq 'nl-nl' }

      #BODGE Required to popultate the Object AS WELL AS to run the MOCK. Mock does not work with -ParameterFilter in this case!
      $global:CsAutoAttendantSupportedLanguage = $AllLanguageObjects
      Mock Get-CsAutoAttendantSupportedLanguage { return $AllLanguageObjects } #-ParameterFilter { $ErrorAction -and $ErrorAction -eq 'SilentlyContinue' }
      Mock Get-OrbitAcSbCsAutoAttendantSupportedLanguage { return $AllLanguageObjects.Id }

      # Required to Mock as we only test New-TeamsCallQueueTrigger
      Mock Checkpoint-TeamsCallQueuePrompt { return $TeamsCallQueuePromptGreeting1 } -ParameterFilter { $Prompt -and $Prompt -eq 'Greeting' -and $String -and $String.StartsWith('Welcome') }
      Mock Checkpoint-TeamsCallQueuePrompt { return $TeamsCallQueuePromptGreeting2 } -ParameterFilter { $Prompt -and $Prompt -eq 'Greeting' -and $String -and $String.EndsWith('.mp3') }
      Mock Checkpoint-TeamsCallQueuePrompt { return $TeamsCallQueuePromptMusic1 } -ParameterFilter { $Prompt -and $Prompt -eq 'MusicOnHold' -and $String -and $String.EndsWith('.mp3') }
      Mock Checkpoint-TeamsCallQueuePrompt { throw } -ParameterFilter { $Prompt -and $Prompt -eq 'MusicOnHold' -and $String -and $String.StartsWith('Welcome') }

      Mock Checkpoint-TeamsCallQueuePrompt { return $TeamsCallQueuePromptText1 } -ParameterFilter { $Prompt -and $Prompt -eq 'OverflowPrompt' -and $String -and $String.StartsWith('There') }
      Mock Checkpoint-TeamsCallQueuePrompt { return $TeamsCallQueuePromptText2 } -ParameterFilter { $Prompt -and $Prompt -eq 'TimeoutPrompt' -and $String -and $String.StartsWith('Sorry') }
      Mock Checkpoint-TeamsCallQueuePrompt { return $TeamsCallQueuePromptFile1 } -ParameterFilter { $Prompt -and $Prompt -eq 'NoAgentPrompt' -and $String -and $String.EndsWith('.mp3') }

      # Mocking Output
      Mock Assert-TeamsCallableEntity -MockWith { $true } -ParameterFilter { $UserPrincipalName }
      Mock Get-TeamsCallableEntity { return $TCE_User } -ParameterFilter { $Identity -and $Identity -eq 'User@domain.com' }
      Mock Get-TeamsCallableEntity { return $TCE_User } -ParameterFilter { $Identity -and $Identity -eq 'User@domain.com' }
      Mock Get-TeamsCallableEntity { return $TCE_RA } -ParameterFilter { $Identity -and $Identity -eq 'ResourceAccount@domain.com' }
      Mock Get-TeamsCallableEntity { return $TCE_Group } -ParameterFilter { $Identity -and $Identity -eq 'GroupName' }
      Mock Get-TeamsCallableEntity { return $TCE_TelUri } -ParameterFilter { $Identity -and $Identity -eq '+15551234567' }
      Mock Import-TeamsAudioFile { return $AudioFile1 } -ParameterFilter { $File -and $File -eq 'C:\temp\file.mp3' }

      # Splatting Parameters
      $Params = @{
        WarningAction     = 'SilentlyContinue'
        InformationAction = 'SilentlyContinue'
      }

      # Dot Sourcing Mock Objects
      . "$(Split-Path -Parent ((Split-Path -Parent $PsScriptRoot) -split 'Tests')[0])\Orbit\Tests\Testing-MockedObjects.ps1"

    }


    Context 'Overflow' {
      BeforeAll {
        $NewTeamsCQTParams = @{
          Name    = 'Test'
          Trigger = 'Overflow'
        }
      }

      Context 'Text-to-Speech' {
        BeforeAll {
          $NewTeamsCQTParams.Prompt = 'hello, please redirect'
          $NewTeamsCQTParams.LanguageId = 'en-US'
        }

        It 'should return a OverflowDisconnectTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'DisconnectWithBusy'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowDisconnectTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a OverflowRedirectPersonTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectPersonTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a OverflowRedirectVoiceAppTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'ResourceAccount@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectVoiceAppTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a OverflowRedirectPhoneNumberTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = '+15551234567'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectPhoneNumberTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a OverflowRedirectVoicemailTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Voicemail'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectVoicemailTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a OverflowSharedVoicemailTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'SharedVoicemail'
          $NewTeamsCQTParams.Target = 'GroupName'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowSharedVoicemailTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }
      }

      Context 'AudioFile' {
        BeforeAll {
          $NewTeamsCQTParams.Prompt = 'C:\temp\file.mp3'
          $DesiredPromptOutput = 'c765ec9ec1d742bdbab836547af9eab8'
        }

        It 'should return a OverflowDisconnectAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'DisconnectWithBusy'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowDisconnectAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a OverflowRedirectPersonAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectPersonAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a OverflowRedirectVoiceAppAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'ResourceAccount@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectVoiceAppAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a OverflowRedirectPhoneNumberAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = '+15551234567'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectPhoneNumberAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a OverflowRedirectVoicemailAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Voicemail'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowRedirectVoicemailAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a OverflowSharedVoicemailAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'SharedVoicemail'
          $NewTeamsCQTParams.Target = 'GroupName'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.OverflowAction | Should -Be $NewTeamsCQTParams.Action
          $Output.OverflowSharedVoicemailAudioFilePrompt | Should -Be $DesiredPromptOutput
        }
      }
    }

    Context 'Timeout' {
      BeforeAll {
        $NewTeamsCQTParams = @{
          Name    = 'Test'
          Trigger = 'Timeout'
        }
      }

      Context 'Text-to-Speech' {
        BeforeAll {
          $NewTeamsCQTParams.Prompt = 'hello, please redirect'
          $NewTeamsCQTParams.LanguageId = 'en-US'
        }

        It 'should return a TimeoutDisconnectTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Disconnect'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutDisconnectTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a TimeoutRedirectPersonTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectPersonTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a TimeoutRedirectVoiceAppTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'ResourceAccount@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectVoiceAppTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a TimeoutRedirectPhoneNumberTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = '+15551234567'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectPhoneNumberTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a TimeoutRedirectVoicemailTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Voicemail'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectVoicemailTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a TimeoutSharedVoicemailTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'SharedVoicemail'
          $NewTeamsCQTParams.Target = 'GroupName'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutSharedVoicemailTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }
      }

      Context 'AudioFile' {
        BeforeAll {
          $NewTeamsCQTParams.Prompt = 'C:\temp\file.mp3'
          $DesiredPromptOutput = 'c765ec9ec1d742bdbab836547af9eab8'
        }

        It 'should return a TimeoutDisconnectAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Disconnect'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutDisconnectAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a TimeoutRedirectPersonAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectPersonAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a TimeoutRedirectVoiceAppAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'ResourceAccount@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectVoiceAppAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a TimeoutRedirectPhoneNumberAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = '+15551234567'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectPhoneNumberAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a TimeoutRedirectVoicemailAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Voicemail'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutRedirectVoicemailAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a TimeoutSharedVoicemailAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'SharedVoicemail'
          $NewTeamsCQTParams.Target = 'GroupName'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.TimeoutAction | Should -Be $NewTeamsCQTParams.Action
          $Output.TimeoutSharedVoicemailAudioFilePrompt | Should -Be $DesiredPromptOutput
        }
      }
    }

    Context 'NoAgent' {
      BeforeAll {
        $NewTeamsCQTParams = @{
          Name    = 'Test'
          Trigger = 'NoAgent'
        }
      }

      Context 'Text-to-Speech' {
        BeforeAll {
          $NewTeamsCQTParams.Prompt = 'hello, please redirect'
          $NewTeamsCQTParams.LanguageId = 'en-US'
        }

        It 'should return no prompt or Action for Queue' {
          $NewTeamsCQTParams.Action = 'Queue'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $null
          $Output.NoAgentDisconnectTextToSpeechPrompt | Should -Be $null
          $Output.NoAgentRedirectPersonTextToSpeechPrompt | Should -Be $null
          $Output.NoAgentRedirectVoiceAppTextToSpeechPrompt | Should -Be $null
          $Output.NoAgentRedirectVoiceMailTextToSpeechPrompt | Should -Be $null
          $Output.NoAgentSharedVoicemailTextToSpeechPrompt | Should -Be $null
        }

        It 'should return a NoAgentDisconnectTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Disconnect'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentDisconnectTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a NoAgentRedirectPersonTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectPersonTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a NoAgentRedirectVoiceAppTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'ResourceAccount@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectVoiceAppTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a NoAgentRedirectPhoneNumberTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = '+15551234567'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectPhoneNumberTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a NoAgentRedirectVoicemailTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'Voicemail'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectVoicemailTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }

        It 'should return a NoAgentSharedVoicemailTextToSpeechPrompt' {
          $NewTeamsCQTParams.Action = 'SharedVoicemail'
          $NewTeamsCQTParams.Target = 'GroupName'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.LanguageId | Should -Be $NewTeamsCQTParams.LanguageId
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentSharedVoicemailTextToSpeechPrompt | Should -Be $NewTeamsCQTParams.Prompt
        }
      }

      Context 'AudioFile' {
        BeforeAll {
          $NewTeamsCQTParams.Prompt = 'C:\temp\file.mp3'
          $DesiredPromptOutput = '9efd8d3a5d7e4fde9e8a37c2bccad5f6'
        }

        It 'should return no prompt or Action for Queue' {
          $NewTeamsCQTParams.Action = 'Queue'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $null
          $Output.NoAgentDisconnectAudioFilePrompt | Should -Be $null
          $Output.NoAgentRedirectPersonAudioFilePrompt | Should -Be $null
          $Output.NoAgentRedirectVoiceAppAudioFilePrompt | Should -Be $null
          $Output.NoAgentRedirectVoiceMailAudioFilePrompt | Should -Be $null
          $Output.NoAgentSharedVoicemailAudioFilePrompt | Should -Be $null
        }

        It 'should return a NoAgentDisconnectAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Disconnect'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentDisconnectAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a NoAgentRedirectPersonAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectPersonAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a NoAgentRedirectVoiceAppAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = 'ResourceAccount@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectVoiceAppAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a NoAgentRedirectPhoneNumberAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Forward'
          $NewTeamsCQTParams.Target = '+15551234567'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectPhoneNumberAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a NoAgentRedirectVoicemailAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'Voicemail'
          $NewTeamsCQTParams.Target = 'User@domain.com'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentRedirectVoicemailAudioFilePrompt | Should -Be $DesiredPromptOutput
        }

        It 'should return a NoAgentSharedVoicemailAudioFilePrompt' {
          $NewTeamsCQTParams.Action = 'SharedVoicemail'
          $NewTeamsCQTParams.Target = 'GroupName'

          $Output = New-TeamsCallQueueTrigger @NewTeamsCQTParams @params
          $Output.NoAgentAction | Should -Be $NewTeamsCQTParams.Action
          $Output.NoAgentSharedVoicemailAudioFilePrompt | Should -Be $DesiredPromptOutput
        }
      }
    }
  }
}