Tests/Write-LogMessage.Tests.Ps1

describe Write-LogMessage {
    BeforeAll {
        Import-Module "$PSScriptRoot\..\CIE.PSTools.psm1" -force
        $ParameterInformation = (Get-Command Write-LogMessage).Parameters['Severity']
        $Script:validateSet = $ParameterInformation.Attributes.Where{ $_ -is [ValidateSet]}
    }
    it 'Writes output when passed input' {
        Write-LogMessage -LogMessage "Testing Message" | Should -belike "*Testing Message"
    }
 
    it 'Throws an error when not passed input' {
        { Write-LogMessage } | Should -Throw 'No message provided'
    }
 
    it 'Permits severity of Info' {
        $validateSet.ValidValues -Contains 'Info' | Should -be $true
    }
 
    it 'Permits severity of Error' {
        $validateSet.ValidValues -Contains 'Error' | Should -be $true
    }
 
    it 'Permits severity of Debug' {
        $validateSet.ValidValues -Contains 'Debug' | Should -be $true
    }
 
    it 'Permits severity of Warning' {
        $validateSet.ValidValues -Contains 'Warning' | Should -be $true
    }
 
    it 'Permits severity of None' {
        $validateSet.ValidValues -Contains 'None' | Should -be $true
    }
 
    it 'Permits severity of Critical' {
        $validateSet.ValidValues -Contains 'Critical' | Should -be $true
    }
 
    it 'Does not permit an invalid severity' {
        $validateSet.ValidValues -Contains 'Hi Mom' | Should -be $false
    }
}