本文整理汇总了C#中Cubico.UnitConverter.ParseUnitString方法的典型用法代码示例。如果您正苦于以下问题:C# UnitConverter.ParseUnitString方法的具体用法?C# UnitConverter.ParseUnitString怎么用?C# UnitConverter.ParseUnitString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cubico.UnitConverter
的用法示例。
在下文中一共展示了UnitConverter.ParseUnitString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnitConverter_ParseUnitStringTest9
public void UnitConverter_ParseUnitStringTest9()
{
UnitConverter target = new UnitConverter ();
string input = "-10 µK";
Measurement expected = new Measurement (-10, "µK");
Measurement actual = default(Measurement);
actual = target.ParseUnitString (input);
Assert.AreEqual (expected, actual);
}
示例2: UnitConverter_ParseUnitStringNoValueTest
public void UnitConverter_ParseUnitStringNoValueTest()
{
UnitConverter target = new UnitConverter ();
string input = "ft";
Measurement expected = new Measurement (0, "ft");
Measurement actual = default(Measurement);
actual = target.ParseUnitString (input);
Assert.AreEqual (expected, actual);
}
示例3: UnitConverter_ParseUnitStringNullTest
public void UnitConverter_ParseUnitStringNullTest()
{
UnitConverter target = new UnitConverter ();
Measurement expected = new Measurement (0, Result.BadValue);
Measurement actual = default(Measurement);
actual = target.ParseUnitString (null);
Assert.AreNotEqual (expected, actual);
Assert.AreEqual (expected.ConversionResult, actual.ConversionResult);
}
示例4: UnitConverter_ParseUnitStringNotFoundTest
public void UnitConverter_ParseUnitStringNotFoundTest()
{
UnitConverter target = new UnitConverter ();
string input = "10 ZZZZ";
Measurement expected = new Measurement (0, Result.BadUnit);
Measurement actual = default(Measurement);
actual = target.ParseUnitString (input);
Assert.AreNotEqual (expected, actual);
Assert.AreEqual (expected.ConversionResult, actual.ConversionResult);
}