File size: 1,121 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

Describe 'Enable-PSBreakpoint' -Tags 'CI' {
	
    BeforeEach {
        # Set some breakpoints
        $lineBp = Set-PSBreakpoint -Line ([int]::MaxValue) -Script $PSCommandPath | Disable-PSBreakpoint -PassThru
        $cmdBp = Set-PSBreakpoint -Command Test-ThisIsNotReallyACommand | Disable-PSBreakpoint -PassThru
        $varBp = Set-PSBreakpoint -Variable thisIsNotReallyAVariable | Disable-PSBreakpoint -PassThru
    }

    AfterEach {
        # Clean up after ourselves
        Get-PSBreakpoint | Remove-PSBreakpoint
    }

    It 'Should enable breakpoints using pipeline input by value' {
        foreach ($bp in $lineBp, $cmdBp, $varBp) {
            $bp = $bp | Enable-PSBreakpoint -PassThru
            $bp.Enabled | Should -BeTrue
        }
    }

    It 'Should enable breakpoints using pipeline input by property name' {
        foreach ($bp in $lineBp, $cmdBp, $varBp) {
            $bp = [pscustomobject]@{ Id = $bp.Id } | Enable-PSBreakpoint -PassThru
            $bp.Enabled | Should -BeTrue
        }
    }
}