本文整理汇总了C#中Cubico.UnitConverter类的典型用法代码示例。如果您正苦于以下问题:C# UnitConverter类的具体用法?C# UnitConverter怎么用?C# UnitConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnitConverter类属于Cubico命名空间,在下文中一共展示了UnitConverter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:irperez,项目名称:Cubico,代码行数:9,代码来源:UnitConverterTest4.cs
示例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);
}
开发者ID:irperez,项目名称:Cubico,代码行数:9,代码来源:UnitConverterTest4.cs
示例3: 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);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest.cs
示例4: UnitConverter_ConvertUnits_chain_to_ft_Test2
public void UnitConverter_ConvertUnits_chain_to_ft_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "chain";
string targetUnitName = "ft";
Measurement expected = new Measurement (Convert.ToDouble (65.999999934), "ft");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例5: UnitConverter_ConvertUnits_bit_to_gigabyte_Test
public void UnitConverter_ConvertUnits_bit_to_gigabyte_Test()
{
UnitConverter target = new UnitConverter();
double value = Convert.ToDouble(8388608);
string currentUnitName = "bit";
string targetUnitName = "gigabyte";
Measurement expected = new Measurement(Convert.ToDouble(0.0009765625), "gigabyte");
Measurement actual = default(Measurement);
actual = target.ConvertUnits(value, currentUnitName, targetUnitName);
Assert.AreEqual(expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTestMemSize.cs
示例6: 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);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest3.cs
示例7: UnitConverter_ConvertUnits_bit_to_bit_Test
public void UnitConverter_ConvertUnits_bit_to_bit_Test()
{
UnitConverter target = new UnitConverter();
double value = Convert.ToDouble(100);
string currentUnitName = "bit";
string targetUnitName = "bit";
Measurement expected = new Measurement(Convert.ToDouble(100), "bit");
Measurement actual = default(Measurement);
actual = target.ConvertUnits(value, currentUnitName, targetUnitName);
Assert.AreEqual(expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTestMemSize.cs
示例8: UnitConverter_ConvertUnits_BTUperMin_to_Horsepower_Test2
public void UnitConverter_ConvertUnits_BTUperMin_to_Horsepower_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "BTU/min";
string targetUnitName = "hp";
Measurement expected = new Measurement (Convert.ToDouble (0.023580890005749), "hp");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest3.cs
示例9: 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);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例10: UnitConverter
public void UnitConverter_ConvertUnits_µm_to_mile_Test()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (100);
string currentUnitName = "µm";
string targetUnitName = "mi";
Measurement expected = new Measurement (Convert.ToDouble (6.2137119E-08), "mi");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例11: UnitConverter_ConvertUnits_tonf_to_mN_Test2
public void UnitConverter_ConvertUnits_tonf_to_mN_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "tonf";
string targetUnitName = "mN";
Measurement expected = new Measurement (Convert.ToDouble (8896443.22162456), "mN");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例12: UnitConverter_ConvertUnits_yd_to_furlong_Test2
public void UnitConverter_ConvertUnits_yd_to_furlong_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "yd";
string targetUnitName = "furlong";
Measurement expected = new Measurement (Convert.ToDouble (0.004545454540909), "furlong");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例13: UnitConverter_ConvertUnits_tonnef_to_tonf_Test
public void UnitConverter_ConvertUnits_tonnef_to_tonf_Test()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (100);
string currentUnitName = "tonnef";
string targetUnitName = "tonf";
Measurement expected = new Measurement (Convert.ToDouble (110.231131092439), "tonf");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例14: UnitConverter_ConvertUnits_tonnef_to_N_Test2
public void UnitConverter_ConvertUnits_tonnef_to_N_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "tonnef";
string targetUnitName = "N";
Measurement expected = new Measurement (Convert.ToDouble (9806.64999019335), "N");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例15: UnitConverter_ConvertUnits_tonnef_to_nN_Test
public void UnitConverter_ConvertUnits_tonnef_to_nN_Test()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (100);
string currentUnitName = "tonnef";
string targetUnitName = "nN";
Measurement expected = new Measurement (Convert.ToDouble (980665000000000.0), "nN");
//should be 98066500000000, .net conversion bug
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:12,代码来源:UnitConverterTest2.cs
示例16: 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);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例17: UnitConverter_ConvertUnits_dyn_to_kN_Test2
public void UnitConverter_ConvertUnits_dyn_to_kN_Test2()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (0.999999999);
string currentUnitName = "dyn";
string targetUnitName = "kN";
Measurement expected = new Measurement (Convert.ToDouble (1E-08), "kN");
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例18: 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);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTest2.cs
示例19: UnitConverter_ConvertUnits_yd_to_m_Test
public void UnitConverter_ConvertUnits_yd_to_m_Test()
{
UnitConverter target = new UnitConverter ();
double value = Convert.ToDouble (100);
string currentUnitName = "yd";
string targetUnitName = "m";
Measurement expected = new Measurement (Convert.ToDouble (91.44), "m");
//expected altered to meet .net conversion bug (91.44 m)
Measurement actual = default(Measurement);
actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
Assert.AreEqual (expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:12,代码来源:UnitConverterTest2.cs
示例20: UnitConverter_ConvertUnits_bit_to_petabit_Test
public void UnitConverter_ConvertUnits_bit_to_petabit_Test()
{
UnitConverter target = new UnitConverter();
double value = Convert.ToDouble(8795755265206);
string currentUnitName = "bit";
string targetUnitName = "petabit";
Measurement expected = new Measurement(Convert.ToDouble(0.007812199979521), "petabit");
Measurement actual = default(Measurement);
actual = target.ConvertUnits(value, currentUnitName, targetUnitName);
Assert.AreEqual(expected.Value, actual.Value);
}
开发者ID:irperez,项目名称:Cubico,代码行数:11,代码来源:UnitConverterTestMemSize.cs
注:本文中的Cubico.UnitConverter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论