@@ -23,28 +23,36 @@ Describe 'Remove-TeamViewerDuplicateDevicesV2' {
23
23
It ' Should not remove any devices if -WhatIf parameter has been set' {
24
24
$result = (Remove-TeamViewerDuplicateDevicesV2 - force:$false - WhatIf)
25
25
$result | Should - HaveCount 3
26
- $result [0 ].TeamViewerId | Should - Be ' older device A'
27
- $result [0 ].Status | Should - Be ' Unchanged'
28
- $result [1 ].TeamViewerId | Should - Be ' newer device A'
29
- $result [1 ].Status | Should - Be ' Unchanged'
30
- $result [2 ].TeamViewerId | Should - Be ' older device B'
31
- $result [2 ].Status | Should - Be ' Unchanged'
32
-
33
- Assert-MockCalled Get-TeamViewerCompanyManagedDevice - Times 1 - Scope It
34
- Assert-MockCalled Remove-TeamViewerManagedDeviceManagement - Times 0 - Scope It
26
+
27
+ $result_names = $result | ForEach-Object { $_.TeamViewerId }
28
+ $result_names | Should - Contain ' older device A'
29
+ $result_names | Should - Contain ' newer device A'
30
+ $result_names | Should - Contain ' older device B'
31
+
32
+ $result_statuses = $result | ForEach-Object { $_.Status }
33
+ $result_statuses [0 ] | Should - Be ' Unchanged'
34
+ $result_statuses [1 ] | Should - Be ' Unchanged'
35
+ $result_statuses [2 ] | Should - Be ' Unchanged'
36
+
37
+ Assert-MockCalled Get-TeamViewerCompanyManagedDevice - Times 1 - Exactly - Scope It
38
+ Assert-MockCalled Remove-TeamViewerManagedDeviceManagement - Times 0 - Exactly - Scope It
35
39
}
36
40
37
41
It ' Should remove duplicate devices with an older last-seen timestamp' {
38
42
$result = (Remove-TeamViewerDuplicateDevicesV2 - force:$true )
39
43
$result | Should - HaveCount 3
40
- $result [0 ].TeamViewerId | Should - Be ' older device A'
41
- $result [0 ].Status | Should - Be ' Removed'
42
- $result [1 ].TeamViewerId | Should - Be ' newer device A'
43
- $result [1 ].Status | Should - Be ' Removed'
44
- $result [2 ].TeamViewerId | Should - Be ' older device B'
45
- $result [2 ].Status | Should - Be ' Removed'
46
-
47
- Assert-MockCalled Get-TeamViewerCompanyManagedDevice - Times 1 - Scope It
48
- Assert-MockCalled Remove-TeamViewerManagedDeviceManagement - Times 3 - Scope It
44
+
45
+ $result_names = $result | ForEach-Object { $_.TeamViewerId }
46
+ $result_names | Should - Contain ' older device A'
47
+ $result_names | Should - Contain ' newer device A'
48
+ $result_names | Should - Contain ' older device B'
49
+
50
+ $result_statuses = $result | ForEach-Object { $_.Status }
51
+ $result_statuses [0 ] | Should - Be ' Removed'
52
+ $result_statuses [1 ] | Should - Be ' Removed'
53
+ $result_statuses [2 ] | Should - Be ' Removed'
54
+
55
+ Assert-MockCalled Get-TeamViewerCompanyManagedDevice - Times 1 - Exactly - Scope It
56
+ Assert-MockCalled Remove-TeamViewerManagedDeviceManagement - Times 3 - Exactly - Scope It
49
57
}
50
58
}
0 commit comments