2016-07-25 14:01:41 -07:00
|
|
|
Describe "Get-PSBreakpoint" -Tags "CI" {
|
2016-03-18 02:30:26 -07:00
|
|
|
|
|
|
|
|
$scriptName = "Get-PSBreakpoint.Tests.ps1"
|
2016-03-20 22:04:08 -07:00
|
|
|
$fullScriptPath = Join-Path -Path $PSScriptRoot -ChildPath $scriptName
|
2016-03-18 02:30:26 -07:00
|
|
|
|
|
|
|
|
AfterEach {
|
2016-03-20 22:04:08 -07:00
|
|
|
Get-PSBreakpoint -Script $fullScriptPath | Remove-PSBreakpoint
|
2016-03-18 02:30:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "should be able to get PSBreakpoint with using Id switch" {
|
2016-03-20 22:04:08 -07:00
|
|
|
Set-PSBreakpoint -Script $fullScriptPath -Line 1
|
2016-03-18 02:30:26 -07:00
|
|
|
|
2016-03-20 22:04:08 -07:00
|
|
|
{ Get-PSBreakpoint -Script $fullScriptPath } | Should Not Throw
|
2016-03-18 02:30:26 -07:00
|
|
|
|
2016-03-20 22:04:08 -07:00
|
|
|
$Id = (Get-PSBreakpoint -Script $fullScriptPath).Id
|
2016-07-20 12:54:59 -07:00
|
|
|
# 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
|
2016-03-18 02:30:26 -07:00
|
|
|
}
|
|
|
|
|
|
2016-07-20 12:54:59 -07:00
|
|
|
It "should be able to get PSBreakpoint with using Variable switch" {
|
2016-03-20 22:04:08 -07:00
|
|
|
Set-PSBreakpoint -Script $fullScriptPath -Variable "$scriptName"
|
2016-03-18 02:30:26 -07:00
|
|
|
|
2016-03-20 22:04:08 -07:00
|
|
|
{ Get-PSBreakpoint -Variable "$scriptName" -Script $fullScriptPath } | Should Not Throw
|
2016-03-18 02:30:26 -07:00
|
|
|
|
2016-03-20 22:04:08 -07:00
|
|
|
$Id = (Get-PSBreakpoint -Variable "$scriptName" -Script $fullScriptPath).Variable
|
2016-03-18 02:30:26 -07:00
|
|
|
$Id | Should be $scriptName
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|