2016-03-04 23:48:30 +01:00
|
|
|
Describe "Set-PSBreakpoint" {
|
2015-12-28 20:05:48 +01:00
|
|
|
# Set up test script
|
2016-03-04 23:42:08 +01:00
|
|
|
$testScript = Join-Path -Path $PSScriptRoot -ChildPath psbreakpointtestscript.ps1
|
2015-12-28 20:05:48 +01:00
|
|
|
|
|
|
|
"`$var = 1 " > $testScript
|
|
|
|
|
|
|
|
It "Should be able to set a psbreakpoint on a line" {
|
2016-03-04 23:52:27 +01:00
|
|
|
$lineNumber = 1
|
|
|
|
$brk = Set-PSBreakpoint -Line $lineNumber -Script $testScript
|
|
|
|
$brk.Line | Should Be $lineNumber
|
|
|
|
Remove-PSBreakPoint -Id $brk.Id
|
2015-12-28 20:05:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should throw when a string is entered for a line number" {
|
2016-03-04 23:52:27 +01:00
|
|
|
{
|
|
|
|
$lineNumber = "one"
|
|
|
|
Set-PSBreakpoint -Line $lineNumber -Script $testScript
|
2015-12-28 20:05:48 +01:00
|
|
|
|
2016-03-04 23:52:27 +01:00
|
|
|
} | Should Throw
|
2015-12-28 20:05:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should be able to set a psbreakpoint on a Command" {
|
2016-03-04 23:52:27 +01:00
|
|
|
$command = "theCommand"
|
|
|
|
$brk = Set-PSBreakpoint -Command $command -Script $testScript
|
|
|
|
$brk.Command | Should Be $command
|
|
|
|
Remove-PSBreakPoint -Id $brk.Id
|
2015-12-28 20:05:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should be able to set a psbreakpoint on a variable" {
|
2016-03-04 23:52:27 +01:00
|
|
|
$var = "theVariable"
|
|
|
|
$brk = Set-PSBreakpoint -Command $var -Script $testScript
|
|
|
|
$brk.Command | Should Be $var
|
|
|
|
Remove-PSBreakPoint -Id $brk.Id
|
2015-12-28 20:05:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# clean up after ourselves
|
|
|
|
Remove-Item -Path $testScript
|
2015-10-22 18:15:19 +02:00
|
|
|
}
|