From bb5dc68a6abca7343e48659bea7c255d4033c105 Mon Sep 17 00:00:00 2001 From: lordmilko Date: Tue, 1 Nov 2022 17:30:53 +1100 Subject: [PATCH] Fix PrtgAPI.Build unit tests that mock Compress-Archive failing on systems whose UI Culture is not en-US --- .../Support/PowerShell/Build.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/PrtgAPI.Tests.UnitTests/Support/PowerShell/Build.ps1 b/src/PrtgAPI.Tests.UnitTests/Support/PowerShell/Build.ps1 index a226c717..2b4abb99 100644 --- a/src/PrtgAPI.Tests.UnitTests/Support/PowerShell/Build.ps1 +++ b/src/PrtgAPI.Tests.UnitTests/Support/PowerShell/Build.ps1 @@ -52,6 +52,15 @@ function It Write-LogInfo "Processing test '$name'" + # Microsoft.PowerShell.Archive wants to import a file + # "Microsoft.PowerShell.Archive\en-US\ArchiveResources.psd1" + # however if the current UI Culture is not en-US it will try and look + # for a different culture folder instead + + $originalCulture = [Threading.Thread]::CurrentThread.CurrentUICulture + + [Threading.Thread]::CurrentThread.CurrentUICulture = 'en-US' + try { & $script @args @@ -64,6 +73,7 @@ function It } finally { + [Threading.Thread]::CurrentThread.CurrentUICulture = $originalCulture #RemoveMocks } }