2020-03-24 11:08:37 -07:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
2018-02-13 09:23:53 -08:00
|
|
|
# Licensed under the MIT License.
|
2016-07-25 14:01:41 -07:00
|
|
|
Describe "Measure-Command" -Tags "CI" {
|
2015-11-19 06:22:06 +00:00
|
|
|
|
|
|
|
|
Context "Validate return types for Measure-Command" {
|
|
|
|
|
|
2017-02-16 04:40:51 +04:00
|
|
|
It "Should return TimeSpan as the return type" {
|
2018-03-23 10:26:23 -07:00
|
|
|
Measure-Command { Get-Date } | Should -BeOfType timespan
|
2017-02-16 04:40:51 +04:00
|
|
|
}
|
2015-11-19 06:22:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Context "Validate that it is executing commands correctly" {
|
|
|
|
|
|
2017-02-16 04:40:51 +04:00
|
|
|
It "Should return TimeSpan after executing a script" {
|
2018-12-28 08:48:23 +00:00
|
|
|
Measure-Command { Write-Output hi } | Should -BeOfType timespan
|
2017-02-16 04:40:51 +04:00
|
|
|
}
|
2015-11-19 06:22:06 +00:00
|
|
|
|
2017-02-16 04:40:51 +04:00
|
|
|
It "Should return TimeSpan after executing a cmdlet" {
|
|
|
|
|
$pesterscript = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath echoscript.ps1
|
|
|
|
|
$testfile = $pesterscript
|
2018-12-28 08:48:23 +00:00
|
|
|
$testcommand = "Write-Output pestertestscript"
|
2017-02-16 04:40:51 +04:00
|
|
|
$testcommand | Add-Content -Path $testfile
|
2015-11-19 06:22:06 +00:00
|
|
|
|
2018-03-23 10:26:23 -07:00
|
|
|
Measure-Command { $pesterscript } | Should -BeOfType timespan
|
2017-02-16 04:40:51 +04:00
|
|
|
Remove-Item $testfile
|
|
|
|
|
}
|
2015-11-19 06:22:06 +00:00
|
|
|
}
|
|
|
|
|
}
|