Tests/Unit/Public/Helper/Test-Microsoft365LicenseContainsServicePlan.Tests.ps1

# Module: Orbit.Tools
# 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.Tools' {
    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 }

      # 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 'Input' {
      # Pipeline, Position, etc.

    }

    Context 'Execution' {
      # Code Logic

    }

    Context 'Output' {
      #Properties, Values, Types
      It 'should return FALSE for ServicePlans not contained in the License' {
        Test-Microsoft365LicenseContainsServicePlan -License 'CommonAreaPhone' -ServicePlan 'MCOEV_GOV' | Should -BeFalse
      }

      It 'should return TRUE for ServicePlans contained in the License' {
        Test-Microsoft365LicenseContainsServicePlan -License 'CommonAreaPhone' -ServicePlan 'MCOEV' | Should -BeTrue
      }
    }

  }
}