public/orca/Test-ORCA228.ps1

<#
.SYNOPSIS
    No trusted senders in Anti-phishing policy.
 
.DESCRIPTION
    Generated on 08/10/2025 15:41:32 by .\build\orca\Update-OrcaTests.ps1
 
.EXAMPLE
    Test-ORCA228
 
    Returns true or false
 
.LINK
    https://maester.dev/docs/commands/Test-ORCA228
#>

function Test-ORCA228{
    [CmdletBinding()]
    [OutputType([bool])]
    param()

    Write-Verbose "Test-ORCA228"
    if(!(Test-MtConnection ExchangeOnline)){
        Add-MtTestResultDetail -SkippedBecause NotConnectedExchange
        return = $null
    }
    if(Test-MtConnection SecurityCompliance){
        $SCC = $true
    } else {
        $SCC = $false
    }

    if(($__MtSession.OrcaCache.Keys|Measure-Object).Count -eq 0){
        Write-Verbose "OrcaCache not set, Get-ORCACollection"
        $__MtSession.OrcaCache = Get-ORCACollection -SCC:$SCC # Specify SCC to include tests in Security & Compliance
    }
    $Collection = $__MtSession.OrcaCache
    $obj = New-Object -TypeName ORCA228
    try { # Handle "SkipInReport" which has a continue statement that makes this function exit unexpectedly
        $obj.Run($Collection)
    } catch {
        Write-OrcaError -TestId "ORCA228" -ErrorRecord $_ -AdditionalContext "Running ORCA228 test"
        throw
    } finally {
        if($obj.SkipInReport) {
            Add-MtTestResultDetail -SkippedBecause 'Custom' -SkippedCustomReason 'The statement "SkipInReport" was specified by ORCA.'
        }
    }

    if($obj.CheckFailed) {
        Add-MtTestResultDetail -SkippedBecause 'Custom' -SkippedCustomReason $obj.CheckFailureReason
        return $null