Files
PowerShell/test/powershell/Measure-Command.Tests.ps1
T

26 lines
811 B
PowerShell
Raw Normal View History

2015-11-19 06:22:06 +00:00
Describe "Measure-Command" {
Context "Validate return types for Measure-Command" {
It "Should return TimeSpan as the return type" {
(Measure-Command { Get-Date }).GetType() | Should Be timespan
}
2015-11-19 06:22:06 +00:00
}
Context "Validate that it is executing commands correctly" {
It "Should return TimeSpan after executing a script" {
(Measure-Command { echo hi }).GetType() | Should Be timespan
}
2015-11-19 06:22:06 +00:00
It "Should return TimeSpan after executing a cmdlet" {
$pesterscript = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath echoscript.ps1
$testfile = $pesterscript
$testcommand = "echo pestertestscript"
$testcommand | Add-Content -Path $testfile
2015-11-19 06:22:06 +00:00
(Measure-Command { $pesterscript }).GetType() | Should Be timespan
Remove-Item $testfile
}
2015-11-19 06:22:06 +00:00
}
}