File size: 667 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
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

        ( . $FilePath ) | Should -Match 'Some value'
    }
}