[Run.Plugin.Calculator] Enable analyzer and fix warnings (#16998)

This commit is contained in:
CleanCodeDeveloper
2022-03-14 16:46:08 +01:00
committed by GitHub
parent 3e9c7f83c8
commit 79b2cdca7b
3 changed files with 8 additions and 8 deletions

View File

@@ -32,7 +32,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
var engine = new CalculateEngine();
// Act
Assert.ThrowsException<ArgumentNullException>(() => engine.Interpret(input));
Assert.ThrowsException<ArgumentNullException>(() => engine.Interpret(input, CultureInfo.CurrentCulture));
}
[DataTestMethod]
@@ -46,7 +46,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
var engine = new CalculateEngine();
// Act
var result = engine.Interpret(input);
var result = engine.Interpret(input, CultureInfo.CurrentCulture);
// Assert
Assert.AreEqual(default(CalculateResult), result);

View File

@@ -21,12 +21,10 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
public const int RoundingDigits = 10;
public CalculateResult Interpret(string input)
{
// Using CurrentCulture this is user facing
return Interpret(input, CultureInfo.CurrentCulture);
}
/// <summary>
/// Interpret
/// </summary>
/// <param name="cultureInfo">Use CultureInfo.CurrentCulture if something is user facing</param>
public CalculateResult Interpret(string input, CultureInfo cultureInfo)
{
if (!CalculateHelper.InputValid(input))

View File

@@ -13,6 +13,8 @@
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Platforms>x64</Platforms>
<NeutralLanguage>en-US</NeutralLanguage>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">