Files
PowerShell-PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-PSBreakpoint.Tests.ps1
T
James Truher 84041fb37d fix Get-PSBreakpoint test to not require 0 as the breakpoint id
Essentially, other tests may set breakpoints and the Id is ever
increasing, so a test for Id 0 will only be true if this is the
first time a breakpoint has been set in this session
2016-07-20 12:54:59 -07:00

34 lines
1.2 KiB
PowerShell

Describe "Get-PSBreakpoint" {
$scriptName = "Get-PSBreakpoint.Tests.ps1"
$fullScriptPath = Join-Path -Path $PSScriptRoot -ChildPath $scriptName
AfterEach {
Get-PSBreakpoint -Script $fullScriptPath | Remove-PSBreakpoint
}
It "should be able to get PSBreakpoint with using Id switch" {
Set-PSBreakpoint -Script $fullScriptPath -Line 1
{ Get-PSBreakpoint -Script $fullScriptPath } | Should Not Throw
$Id = (Get-PSBreakpoint -Script $fullScriptPath).Id
# if breakpoints have been set by other tests, the number may or may not be 0
# so we can't check against a specific number
# however, we can be sure that we're getting an int and that the int is
# greater or equal to 0
([int]$Id) -ge 0 | should be $true
}
It "should be able to get PSBreakpoint with using Variable switch" {
Set-PSBreakpoint -Script $fullScriptPath -Variable "$scriptName"
{ Get-PSBreakpoint -Variable "$scriptName" -Script $fullScriptPath } | Should Not Throw
$Id = (Get-PSBreakpoint -Variable "$scriptName" -Script $fullScriptPath).Variable
$Id | Should be $scriptName
}
}