Functions/Convert-ExchangeOnlineUserToMSPCompleteUser.Tests.ps1

describe "BitTitan.Runbooks.ExchangeOnline/Convert-ExchangeOnlineUserToMSPCompleteUser" -Tag "module", "unit" {

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

    it "converts an Exchange Online user to a MSPComplete user" {
        # Declare the task inputs
        $exchangeOnlineUser = [PSCustomObject]@{
            FirstName = "firstName"
            LastName = "lastName"
            DisplayName = "displayName"
            Name = "name"
            UserPrincipalName = "userPrincipalName"
            StreetAddress = "streetAddress"
            City = "city"
            StateOrProvince = "stateOrProvince"
            PostalCode = "postalCode"
            CountryOrRegion = "countryOrRegion"
            MobilePhone = "mobilePhone"
            HomePhone = "homePhone"
            Company = "company"
            Department = "department"
            Title = "title"
            ManagerEmailAddress = "managerEmailAddress"
            Sid = "sid"
        }

        # Call the function
        $output = Convert-ExchangeOnlineUserToMSPCompleteUser -User $exchangeOnlineUser

        # Verify the output
        $output.FirstName | Should Be "firstName"
        $output.LastName | Should Be "lastName"
        $output.DisplayName | Should Be "displayName"
        $output.FullName | Should Be "name"
        $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.ManagerEmailAddress | Should Be "managerEmailAddress"
        $output.ExtendedProperties.OnPremisesSecurityIdentifier | Should Be "sid"
    }
}