We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 27a0ad7 commit a0e783cCopy full SHA for a0e783c
UnitsNet.Tests/CustomCode/ParseTests.cs
@@ -104,5 +104,17 @@ public LengthUnit ParseLengthUnitUsEnglish(string s)
104
105
return Length.ParseUnit(s, usEnglish);
106
}
107
+
108
+ [TestCase("1 m", Result = true)]
109
+ [TestCase("1 m 50 cm", Result = true)]
110
+ [TestCase("2 kg", Result = false)]
111
+ [TestCase(null, Result = false)]
112
+ [TestCase("foo", Result = false)]
113
+ public bool TryParseLengthUnitUsEnglish(string s)
114
+ {
115
+ CultureInfo usEnglish = CultureInfo.GetCultureInfo("en-US");
116
+ Length result;
117
+ return Length.TryParse(s, usEnglish, out result);
118
+ }
119
120
0 commit comments