Functions/Convert-ExchangeOnlineUserToMSPCompleteUser.Tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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"
            OnPremisesSecurityIdentifier = "onPremisesSecurityIdentifier"
        }

        # 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.LandLinePhoneNumber | 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 "onPremisesSecurityIdentifier"
    }
}