Skip to content

Commit

Permalink
💚Fix compile after upgrading nugets, nullability error in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
angularsen committed Dec 15, 2024
1 parent c974c0b commit f374f65
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions UnitsNet.Tests/CustomCode/ParseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public void ParseLengthToMetersUsEnglish(string s, double expected)
[InlineData("1 kg", typeof(FormatException))] // Wrong measurement type.
[InlineData("1ft monkey 1in", typeof(FormatException))] // Invalid separator between two valid measurements.
[InlineData("1ft 1invalid", typeof(FormatException))] // Valid
public void ParseLength_InvalidString_USEnglish_ThrowsException(string s, Type expectedExceptionType)
public void ParseLength_InvalidString_USEnglish_ThrowsException(string? s, Type expectedExceptionType)
{
var usEnglish = CultureInfo.GetCultureInfo("en-US");
Assert.Throws(expectedExceptionType, () => Length.Parse(s, usEnglish));
Assert.Throws(expectedExceptionType, () => Length.Parse(s!, usEnglish));
}

/// <exception cref="UnitsNetException">Error parsing string.</exception>
Expand Down Expand Up @@ -125,10 +125,10 @@ public void ParseLengthUnitUsEnglish(string s, LengthUnit expected)
[Theory]
[InlineData("kg", typeof(UnitNotFoundException))]
[InlineData(null, typeof(ArgumentNullException))]
public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string s, Type expectedExceptionType)
public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string? s, Type expectedExceptionType)
{
var usEnglish = CultureInfo.GetCultureInfo("en-US");
Assert.Throws(expectedExceptionType, () => Length.ParseUnit(s, usEnglish));
Assert.Throws(expectedExceptionType, () => Length.ParseUnit(s!, usEnglish));
}

[Theory]
Expand All @@ -137,7 +137,7 @@ public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string s, Ty
[InlineData("2 kg", false)]
[InlineData(null, false)]
[InlineData("foo", false)]
public void TryParseLengthUnitUsEnglish(string s, bool expected)
public void TryParseLengthUnitUsEnglish(string? s, bool expected)
{
CultureInfo usEnglish = CultureInfo.GetCultureInfo("en-US");
bool actual = Length.TryParse(s, usEnglish, out Length _);
Expand Down

0 comments on commit f374f65

Please sign in to comment.