-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathConvertTo-TeamsFact.Tests.ps1
43 lines (40 loc) · 1.73 KB
/
ConvertTo-TeamsFact.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
param (
$TeamsID = $Env:TEAMSPESTERID
)
#Requires -Modules Pester
Import-Module $PSScriptRoot\..\PSTeams.psd1 -Force #-Verbose
Describe "Conversion of different objects to Teams fact" {
Context "Object types: PSObject, unordered dictionary, ordered dictionary and string" {
It "Convert PSObject to Teams facts" {
$Output = New-Object -TypeName PSObject -Property ([ordered]@{
Application = 'Microsoft Teams'
Developer = 'Microsoft Corporation'
}
) | ConvertTo-TeamsFact
$Output | Should -HaveCount 2
$Output | Should -BeOfType 'System.Collections.Specialized.OrderedDictionary'
$Output[0].type | Should -Be 'fact'
}
It "Convert unordered dictionary to Teams facts" {
$Output = @{
Application = 'Microsoft Teams'
Developer = 'Microsoft Corporation'
} | ConvertTo-TeamsFact
$Output | Should -HaveCount 2
$Output | Should -BeOfType 'System.Collections.Specialized.OrderedDictionary'
$Output[0].type | Should -Be 'fact'
}
It "Convert ordered dictionary to Teams facts" {
$Output = [ordered]@{
Application = 'Microsoft Teams'
Developer = 'Microsoft Corporation'
} | ConvertTo-TeamsFact
$Output | Should -HaveCount 2
$Output | Should -BeOfType 'System.Collections.Specialized.OrderedDictionary'
$Output[0].type | Should -Be 'fact'
}
It "Throw an error when a plain string is passed in" {
{ 'My Plain String' | ConvertTo-TeamsFact } | Should -Throw
}
}
}