Functions/Compare-MSPCompleteCustomer.Tests.ps1

describe "BitTitan.Runbooks.MSPComplete/Compare-MSPCompleteCustomer" -Tag "module", "unit" {

    # Import the function to test
    . "$($PSScriptRoot)\Compare-MSPCompleteCustomer.ps1"

    it "returns true for identical objects" {
        # Declare the function inputs
        $referenceCustomer = [PSCustomObject]@{
            CompanyName = "companyName"
            PrimaryDomain = "primaryDomain"
            CountryName = "countryName"
            StateProvinceName = "stateProvinceName"
            CityName = "cityName"
            CompanySizeBucket = "companySizeBucket"
            IndustryType = "industryType"
        }

        # Call the function
        $output = Compare-MSPCompleteCustomer -ReferenceCustomer $referenceCustomer -ComparisonCustomer $referenceCustomer `
            -ErrorAction SilentlyContinue -ErrorVariable errorVariable

        # Verify the output
        $errorVariable | Should BeNullOrEmpty
        $output | Should Be $true
    }

    it "returns false for objects with different property values" {
        # Declare the function inputs
        $referenceCustomer = [PSCustomObject]@{
            CompanyName = "companyName"
            PrimaryDomain = "primaryDomain"
            CountryName = "countryName"
            StateProvinceName = "stateProvinceName"
            CityName = "cityName"
            CompanySizeBucket = "companySizeBucket"
            IndustryType = "industryType"
        }
        $comparisonCustomer = [PSCustomObject]@{
            CompanyName = "companyName1"
            PrimaryDomain = "primaryDomain"
            CountryName = "countryName"
            StateProvinceName = "stateProvinceName"
            CityName = "cityName"
            CompanySizeBucket = "companySizeBucket"
            IndustryType = "industryType"
        }

        # Call the function
        $output = Compare-MSPCompleteCustomer -ReferenceCustomer $referenceCustomer -ComparisonCustomer $comparisonCustomer `
            -ErrorAction SilentlyContinue -ErrorVariable errorVariable

        # Verify the output
        $errorVariable | Should Not BeNullOrEmpty
        $output | Should Be $false
    }
}