Skip to content

Commit 13ca9c0

Browse files
committed
chore: modify PowerManagementApplierTests
1 parent 63f3a71 commit 13ca9c0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/BenchmarkDotNet.IntegrationTests/PowerManagementApplierTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using BenchmarkDotNet.Running;
44
using BenchmarkDotNet.Tests.Loggers;
55
using BenchmarkDotNet.Tests.XUnit;
6+
using System.Globalization;
67
using Xunit;
78
using 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

Comments
 (0)