STTools.Tests.ps1
# Execute the file with the function(s) we want to test. # Running each time ensures we have the most current copy in memory $dir = 'C:\Users\ev00\Documents\WindowsPowerShell\Modules\STtools' Set-Location $dir Import-Module sttools -Force Describe "Unit Tests for ConvertFrom-STEduHubST" -Tag "Unit" { $fakeUser = [PSCustomObject]@{ FIRST_NAME = "George"; SURNAME = "Jones"; STKEY = "JON0001"; STATUS = "ACTV"; BIRTHDATE = "15/07/2001 12:00:00 AM"; } $result = ConvertFrom-STEduHubST -UserList $fakeUser -HomeDirBase \\abcd1234\ -Domain blah.com -HomeDrive H: It "Produces correct display name" { $result.DisplayName |Should -Match "George Jones" } It "Produces correct email address" { $result.EmailAddress |Should -Match "jon0001@blah.com" } It "Produces correct enablement" { $result.Enabled |Should -Match $true } It "Produces correct given name" { $result.GivenName |Should -Match "George" } It "Produces correct home directory" { $result.HomeDirectory |Should -Contain "\\abcd1234\jon0001" } It "Produces correct home drive" { $result.HomeDrive |Should -Match "H:" } It "Produces correct Name" { $result.Name |Should -Match "JON0001" } It "Produces correct DOB" { $result.DOB |Should -Contain "150701" } It "Produces correct SamAccountName" { $result.SamAccountName |Should -Match "jon0001" } It "Produces correct Surname" { $result.Surname |Should -Match "Jones" } It "Produces correct UPN" { $result.UserPrincipalName |Should -Match "" } } |