Functions/Convert-AzureADUserToMSPCompleteUser.Tests.ps1

describe "BitTitan.Runbooks.AzureAD/Convert-AzureADUserToMSPCompleteUser" -Tag "module", "unit" {

    # Import the function to test
    . "$($PSScriptRoot)\Convert-AzureADUserToMSPCompleteUser.ps1"

    it "converts an Azure AD user to a MSPComplete user" {
        # Declare the task inputs
        $azureADUser = [PSCustomObject]@{
            GivenName = "givenName"
            Surname = "surname"
            DisplayName = "displayName"
            UserPrincipalName = "userPrincipalName"
            StreetAddress = "streetAddress"
            City = "city"
            StateOrProvince = "stateOrProvince"
            PostalCode = "postalCode"
            CountryOrRegion = "countryOrRegion"
            MobilePhone = "mobilePhone"
            HomePhone = "homePhone"
            Company = "company"
            Department = "department"
            Title = "title"
            OnPremisesSecurityIdentifier = "onPremisesSecurityIdentifier"
        }

        # Call the function
        $output = Convert-AzureADUserToMSPCompleteUser -User $azureADUser

        # Verify the output
        $output.FirstName | Should Be "givenName"
        $output.LastName | Should Be "surname"
        $output.DisplayName | Should Be "displayName"
        $output.PrimaryEmailAddress | Should Be "userPrincipalName"
        $output.UserPrincipalName | Should Be "userPrincipalName"
        $output.ExtendedProperties.AddressLine1 | Should Be "streetAddress"
        $output.ExtendedProperties.City | Should Be "city"
        $output.ExtendedProperties.StateOrProvince | Should Be "stateOrProvince"
        $output.ExtendedProperties.PostalOrZipCode | Should Be "postalCode"
        $output.ExtendedProperties.CountryOrRegion | Should Be "countryOrRegion"
        $output.ExtendedProperties.MobilePhoneNumber | Should Be "mobilePhone"
        $output.ExtendedProperties.TelephoneNumber | Should Be "homePhone"
        $output.ExtendedProperties.CompanyName | Should Be "company"
        $output.ExtendedProperties.Department | Should Be "department"
        $output.ExtendedProperties.JobTitle | Should Be "title"
        $output.ExtendedProperties.OnPremisesSecurityIdentifier | Should Be "onPremisesSecurityIdentifier"
    }
}