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-03-04 14:42:08 -08:00
|
|
|
$assetsDir = Join-Path -Path $PSScriptRoot -ChildPath assets
|
2016-02-10 16:02:28 -08:00
|
|
|
|
2016-07-25 14:01:41 -07:00
|
|
|
Describe "Import-LocalizedData" -Tags "CI" {
|
2016-02-10 16:02:28 -08:00
|
|
|
|
|
|
|
|
BeforeAll {
|
2016-03-04 14:52:27 -08:00
|
|
|
$script = "localized.ps1"
|
|
|
|
|
$sunday = "Sunday"
|
|
|
|
|
$sundayInGerman = $sunday + " (in German)"
|
2016-02-10 16:02:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should be able to import string using default culture" {
|
2016-03-04 14:52:27 -08:00
|
|
|
# Set-Culture is broken, but let's verify that default culture is en-US
|
|
|
|
|
$culture = Get-Culture
|
2018-03-23 10:26:23 -07:00
|
|
|
$culture.Name | Should -BeExactly "en-US"
|
2016-02-10 16:02:28 -08:00
|
|
|
|
2016-03-04 14:52:27 -08:00
|
|
|
$d = Import-LocalizedData -FileName $script -BaseDirectory $assetsDir
|
2018-03-23 10:26:23 -07:00
|
|
|
$d.d0 | Should -Be $sunday
|
2016-03-04 14:52:27 -08:00
|
|
|
}
|
2016-02-10 16:02:28 -08:00
|
|
|
|
2016-03-04 14:52:27 -08:00
|
|
|
It "Should be able to import string using en-US culture" {
|
|
|
|
|
$d = Import-LocalizedData -FileName $script -BaseDirectory $assetsDir -UICulture en-US
|
2018-03-23 10:26:23 -07:00
|
|
|
$d.d0 | Should -Be $sunday
|
2016-03-04 14:52:27 -08:00
|
|
|
}
|
2016-02-10 16:02:28 -08:00
|
|
|
|
2016-03-04 14:52:27 -08:00
|
|
|
It "Should be able to import string using de-DE culture" {
|
|
|
|
|
$d = Import-LocalizedData -FileName $script -BaseDirectory $assetsDir -UICulture de-DE
|
2018-03-23 10:26:23 -07:00
|
|
|
$d.d0 | Should -Be $sundayInGerman
|
2016-03-04 14:52:27 -08:00
|
|
|
}
|
2016-02-10 16:02:28 -08:00
|
|
|
|
2016-03-04 14:52:27 -08:00
|
|
|
It "Should be able to import string and store in binding variable" {
|
|
|
|
|
Import-LocalizedData -FileName $script -BaseDirectory $assetsDir -UICulture de-DE -BindingVariable d
|
2018-03-23 10:26:23 -07:00
|
|
|
$d.d0 | Should -Be $sundayInGerman
|
2016-03-04 14:52:27 -08:00
|
|
|
}
|
2016-02-10 16:02:28 -08:00
|
|
|
|
|
|
|
|
}
|