33using BenchmarkDotNet . Running ;
44using BenchmarkDotNet . Tests . Loggers ;
55using BenchmarkDotNet . Tests . XUnit ;
6+ using System . Globalization ;
67using Xunit ;
78using Xunit . Abstractions ;
89
@@ -18,13 +19,15 @@ public PowerManagementApplierTests(ITestOutputHelper output) : base(output) { }
1819 public void TestSettingAndRevertingBackGuid ( )
1920 {
2021 var userPlan = PowerManagementHelper . CurrentPlan ;
21- var powerManagementApplier = new PowerManagementApplier ( new OutputLogger ( Output ) ) ;
22+
23+ using var powerManagementApplier = new PowerManagementApplier ( new OutputLogger ( Output ) ) ;
2224
2325 powerManagementApplier . ApplyPerformancePlan ( PowerManagementApplier . Map ( PowerPlan . HighPerformance ) ) ;
2426
2527 Assert . Equal ( HighPerformancePlanGuid , PowerManagementHelper . CurrentPlan . ToString ( ) ) ;
26- Assert . Equal ( "High performance" , PowerManagementHelper . CurrentPlanFriendlyName ) ;
27- powerManagementApplier . Dispose ( ) ;
28+
29+ if ( CultureInfo . CurrentUICulture . Name == "en-us" )
30+ Assert . Equal ( "High performance" , PowerManagementHelper . CurrentPlanFriendlyName ) ;
2831
2932 Assert . Equal ( userPlan , PowerManagementHelper . CurrentPlan ) ;
3033 }
@@ -33,12 +36,11 @@ public void TestSettingAndRevertingBackGuid()
3336 public void TestPowerPlanShouldNotChange ( )
3437 {
3538 var userPlan = PowerManagementHelper . CurrentPlan ;
36- var powerManagementApplier = new PowerManagementApplier ( new OutputLogger ( Output ) ) ;
39+ using var powerManagementApplier = new PowerManagementApplier ( new OutputLogger ( Output ) ) ;
3740
3841 powerManagementApplier . ApplyPerformancePlan ( PowerManagementApplier . Map ( PowerPlan . UserPowerPlan ) ) ;
3942
4043 Assert . Equal ( userPlan . ToString ( ) , PowerManagementHelper . CurrentPlan . ToString ( ) ) ;
41- powerManagementApplier . Dispose ( ) ;
4244
4345 Assert . Equal ( userPlan , PowerManagementHelper . CurrentPlan ) ;
4446 }
0 commit comments