MegaBites-AI/Windows-powershell
0372
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3Describe "Invoke-Expression" -Tags "CI" {4 5 Context "Should execute the invoked command validly" {6 7 It "Should return the echoed text" {8 (Invoke-Expression -Command "echo pestertest1") | Should -BeExactly "pestertest1"9 }10 11 It "Should return the echoed text from a script" {12 $testfile = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath echoscript.ps113 $testcommand = "echo pestertestscript"14 $testcommand | Add-Content -Path "$testfile"15 (Invoke-Expression "& '$testfile'") | Should -BeExactly "pestertestscript"16 Remove-Item "$testfile"17 }18 }19}20Describe "Invoke-Expression DRT Unit Tests" -Tags "CI" {21 It "Invoke-Expression should work"{22 $result=Invoke-Expression -Command 2+223 $result | Should -Be 424 }25}26 