Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
 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);
 }
Example #4
0
 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);
 }
 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);
 }
Example #6
0
 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);
 }
 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);
 }
Example #8
0
 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);
 }
Example #9
0
 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);
 }
Example #10
0
 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);
 }
Example #11
0
 public void UnitConverter_ConvertUnits_µm_to_furlong_Test()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (100);
     string currentUnitName = "µm";
     string targetUnitName = "furlong";
     Measurement expected = new Measurement (Convert.ToDouble (4.97096954E-07), "furlong");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }
Example #12
0
 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);
 }
Example #13
0
 public void UnitConverter_ConvertUnits_µN_to_tonf_Test2()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (0.999999999);
     string currentUnitName = "µN";
     string targetUnitName = "tonf";
     Measurement expected = new Measurement (Convert.ToDouble (1.12404E-10), "tonf");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }
Example #14
0
 public void UnitConverter_ConvertUnits_µN_to_lbf_Test()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (100);
     string currentUnitName = "µN";
     string targetUnitName = "lbf";
     Measurement expected = new Measurement (Convert.ToDouble (2.248089431E-05), "lbf");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }
Example #15
0
 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);
 }
Example #16
0
 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);
 }
Example #17
0
 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);
 }
Example #18
0
 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);
 }
Example #19
0
 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);
 }
Example #20
0
 public void UnitConverter_ConvertUnits_tonf_to_µN_Test()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (100);
     string currentUnitName = "tonf";
     string targetUnitName = "µN";
     Measurement expected = new Measurement (Convert.ToDouble (889644323052.1), "µN");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }
Example #21
0
 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);
 }
Example #22
0
 public void UnitConverter_ConvertUnits_µm_to_thou_Test2()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (0.999999999);
     string currentUnitName = "µm";
     string targetUnitName = "thou";
     Measurement expected = new Measurement (Convert.ToDouble (0.039370078700787), "thou");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }
Example #23
0
 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);
 }
Example #24
0
 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);
 }
Example #25
0
 public void UnitConverter_ConvertUnits_µN_to_Meganewton_Test2()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (0.999999999);
     string currentUnitName = "µN";
     string targetUnitName = "Meganewton";
     Measurement expected = new Measurement (Convert.ToDouble (1E-12), "Meganewton");
     //should be 0.000000000000999999999, .net rounds to 15 places
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }
Example #26
0
 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);
 }
 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);
 }
Example #28
0
 public void UnitConverter_ConvertUnits_µm_to_ft_Test()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (100);
     string currentUnitName = "µm";
     string targetUnitName = "ft";
     Measurement expected = new Measurement (Convert.ToDouble (0.000328083989501), "ft");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
     Assert.AreEqual (Result.NoError, actual.ConversionResult);
 }
Example #29
0
 public void UnitConverter_ConvertUnits_yd_to_Megametres_Test()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (100);
     string currentUnitName = "yd";
     string targetUnitName = "Mm";
     Measurement expected = new Measurement (Convert.ToDouble (9.144E-05), "Mm");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }
Example #30
0
 public void UnitConverter_ConvertUnits_thou_to_millimetres_Test()
 {
     UnitConverter target = new UnitConverter ();
     double value = Convert.ToDouble (100);
     string currentUnitName = "thou";
     string targetUnitName = "mm";
     Measurement expected = new Measurement (Convert.ToDouble (2.54), "mm");
     Measurement actual = default(Measurement);
     actual = target.ConvertUnits (value, currentUnitName, targetUnitName);
     Assert.AreEqual (expected.Value, actual.Value);
 }