2020-03-24 19:08:37 +01:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
2018-02-13 18:23:53 +01:00
|
|
|
# Licensed under the MIT License.
|
2017-07-06 20:32:54 +02:00
|
|
|
Describe "Script with a class definition run path" -Tags "CI" {
|
|
|
|
|
|
|
|
$TestCases = @(
|
|
|
|
@{ FileName = 'MyTest.ps1'; Name = 'path without a comma' }
|
|
|
|
@{ FileName = 'My,Test.ps1'; Name = 'path with a comma' }
|
|
|
|
)
|
|
|
|
|
|
|
|
It "Script with a class definition can run from a <Name>" -TestCases $TestCases {
|
|
|
|
param( $FileName )
|
|
|
|
|
|
|
|
$FilePath = Join-Path -Path $TestDrive -ChildPath $FileName
|
|
|
|
|
|
|
|
@'
|
|
|
|
class MyClass { static [string]$MyProperty = 'Some value' }
|
|
|
|
[MyClass]::MyProperty
|
|
|
|
'@ | Out-File -FilePath $FilePath
|
|
|
|
|
2018-03-21 18:47:08 +01:00
|
|
|
( . $FilePath ) | Should -Match 'Some value'
|
2017-07-06 20:32:54 +02:00
|
|
|
}
|
|
|
|
}
|