Tests/STTools.Tests.ps1
$here = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) $sut = ((Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.') -replace '\.ps1', '.psm1' get-module sttools |remove-module import-module "$here\$sut" Describe "Get-STGroupsFromCSV" { It "does something useful" { $true | Should -Be $false } } 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 SamAccountName" { $result.SamAccountName |Should -Match "jon0001" } It "Produces correct Surname" { $result.Surname |Should -Match "Jones" } It "Produces correct UPN" { $result.UserPrincipalName |Should -Match "" } } |