MegaBites-AI/Windows-powershell
0308
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3Describe "Measure-Command" -Tags "CI" {4 5 Context "Validate return types for Measure-Command" {6 7 It "Should return TimeSpan as the return type" {8 Measure-Command { Get-Date } | Should -BeOfType timespan9 }10 }11 12 Context "Validate that it is executing commands correctly" {13 14 It "Should return TimeSpan after executing a script" {15 Measure-Command { Write-Output hi } | Should -BeOfType timespan16 }17 18 It "Should return TimeSpan after executing a cmdlet" {19 $pesterscript = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath echoscript.ps120 $testfile = $pesterscript21 $testcommand = "Write-Output pestertestscript"22 $testcommand | Add-Content -Path $testfile23 24 Measure-Command { $pesterscript } | Should -BeOfType timespan25 Remove-Item $testfile26 }27 }28}29 