本文整理汇总了C#中Cubico.UnitConverter.ConvertUnits方法的典型用法代码示例。如果您正苦于以下问题:C# UnitConverter.ConvertUnits方法的具体用法?C# UnitConverter.ConvertUnits怎么用?C# UnitConverter.ConvertUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cubico.UnitConverter
的用法示例。
在下文中一共展示了UnitConverter.ConvertUnits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnitConverter_ConvertUnitsNullTest
public void UnitConverter_ConvertUnitsNullTest()
{
UnitConverter target = new UnitConverter ();
Measurement expected = new Measurement (0, Result.BadUnit);
Measurement actual = default(Measurement);
actual = target.ConvertUnits (0, null, null);
Assert.AreNotEqual (expected, actual);
Assert.AreEqual (expected.ConversionResult, actual.ConversionResult);
}
示例2: UnitConverter_ConvertUnitsEmptyTest3
public void UnitConverter_ConvertUnitsEmptyTest3()
{
UnitConverter target = new UnitConverter ();
Measurement expected = new Measurement (0, Result.BadUnit);
Measurement actual = default(Measurement);
actual = target.ConvertUnits (0, string.Empty, "m");
Assert.AreNotEqual (expected, actual);
Assert.AreEqual (expected.ConversionResult, actual.ConversionResult);
}
示例3: UnitConverter_ConvertUnits_chain_to_cm_Test2
public void UnitConverter_ConvertUnits_chain_to_cm_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "chain";
string targetUnitName = "cm";
Measurement expected = new Measurement (Convert.ToDouble (2011.67999798832), "cm");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例4: UnitConverter_ConvertUnits_Celcius_to_Kelvin_Test3
public void UnitConverter_ConvertUnits_Celcius_to_Kelvin_Test3()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0);
string currentUnitName = "C";
string targetUnitName = "K";
Measurement expected = new Measurement (Convert.ToDouble (273.15), "K");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例5: UnitConverter_ConvertUnits_chain_to_ft_Test
public void UnitConverter_ConvertUnits_chain_to_ft_Test()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (100);
string currentUnitName = "chain";
string targetUnitName = "ft";
Measurement expected = new Measurement (Convert.ToDouble (6600), "ft");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例6: UnitConverter_ConvertUnits_bit_to_gigabit_Test
public void UnitConverter_ConvertUnits_bit_to_gigabit_Test()
{
UnitConverter target = new UnitConverter();
double value = Convert.ToDouble(8388608);
string currentUnitName = "bit";
string targetUnitName = "gigabit";
Measurement expected = new Measurement(Convert.ToDouble(0.0078125), "gigabit");
Measurement actual = default(Measurement);
actual = target.ConvertUnits(value, currentUnitName, targetUnitName);
Assert.AreEqual(expected.Value, actual.Value);
}
示例7: UnitConverter_ConvertUnits_BTUperMin_to_FtLbPerMin_Test2
public void UnitConverter_ConvertUnits_BTUperMin_to_FtLbPerMin_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "BTU/min";
string targetUnitName = "ft lb/min";
Measurement expected = new Measurement (Convert.ToDouble (778.169370189705), "ft lb/min");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例8: UnitConverter_ConvertUnits_BTUperMin_to_Horsepower_Test
public void UnitConverter_ConvertUnits_BTUperMin_to_Horsepower_Test()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (100);
string currentUnitName = "BTU/min";
string targetUnitName = "hp";
Measurement expected = new Measurement (Convert.ToDouble (2.35808900293295), "hp");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例9: UnitConverter
public void UnitConverter_ConvertUnits_µm_to_yd_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "µm";
string targetUnitName = "yd";
Measurement expected = new Measurement (Convert.ToDouble (1.093613297E-06), "yd");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例10: UnitConverter_ConvertUnits_dyn_to_ng_Test
public void UnitConverter_ConvertUnits_dyn_to_ng_Test()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (100);
string currentUnitName = "dyn";
string targetUnitName = "tonnef";
Measurement expected = new Measurement (Convert.ToDouble (1.01971621E-07), "tonnef");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例11: UnitConverter_ConvertUnits_tonnef_to_lbf_Test2
public void UnitConverter_ConvertUnits_tonnef_to_lbf_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "tonnef";
string targetUnitName = "lbf";
Measurement expected = new Measurement (Convert.ToDouble (2204.62261964738), "lbf");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例12: UnitConverter_ConvertUnits_byte_to_kilobyte_Test
public void UnitConverter_ConvertUnits_byte_to_kilobyte_Test()
{
UnitConverter target = new UnitConverter();
double value = Convert.ToDouble(1);
string currentUnitName = "byte";
string targetUnitName = "kilobyte";
Measurement expected = new Measurement(Convert.ToDouble(0.0009765625), "kilobyte");
Measurement actual = default(Measurement);
actual = target.ConvertUnits(value, currentUnitName, targetUnitName);
Assert.AreEqual(expected.Value, actual.Value);
}
示例13: UnitConverter_ConvertUnits_bit_to_megabyte_Test
public void UnitConverter_ConvertUnits_bit_to_megabyte_Test()
{
UnitConverter target = new UnitConverter();
double value = Convert.ToDouble(1024);
string currentUnitName = "bit";
string targetUnitName = "megabyte";
Measurement expected = new Measurement(Convert.ToDouble(0.0001220703125), "megabyte");
Measurement actual = default(Measurement);
actual = target.ConvertUnits(value, currentUnitName, targetUnitName);
Assert.AreEqual(expected.Value, actual.Value);
}
示例14: UnitConverter_ConvertUnits_dyn_to_nN_Test2
public void UnitConverter_ConvertUnits_dyn_to_nN_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "dyn";
string targetUnitName = "nN";
Measurement expected = new Measurement (Convert.ToDouble (9999.99999), "nN");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
示例15: UnitConverter_ConvertUnits_yd_to_millimetres_Test2
public void UnitConverter_ConvertUnits_yd_to_millimetres_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "yd";
string targetUnitName = "mm";
Measurement expected = new Measurement (Convert.ToDouble (914.3999990856), "mm");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}