diff --git a/CHANGELOG.txt b/CHANGELOG.txt new file mode 100644 index 0000000..4d853b2 --- /dev/null +++ b/CHANGELOG.txt @@ -0,0 +1,8 @@ +CHANGELOG + +Version 0.2 +- Added number string parser +- Converted tests to run against NUnit + +Version 0.1 +- Initial project \ No newline at end of file diff --git a/Cubico.Tests/ConversionResultTest.cs b/Cubico.Tests/ConversionResultTest.cs new file mode 100644 index 0000000..0143e54 --- /dev/null +++ b/Cubico.Tests/ConversionResultTest.cs @@ -0,0 +1,264 @@ +using System; +using Cubico; +using NUnit.Framework; + +namespace Cubico.Tests +{ + [TestFixture] + public class ConversionResultTest + { + TestContext testContextInstance; + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "ConversionResult.ConversionResult()" + + [Test] + public void ConversionResultConstructorTest () + { + ConversionResult res = new ConversionResult (); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + #endregion + #region "ConversionResult.ConversionResult(Double)" + + [Test] + public void ConversionResultConstructorDoubleTest () + { + ConversionResult res = new ConversionResult (10.5); + + Assert.IsNotNull (res); + Assert.AreEqual (10.5, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + [Test] + public void ConversionResultConstructorDoubleZeroTest () + { + ConversionResult res = new ConversionResult ((double)0); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + #endregion + #region "ConversionResult.ConversionResult(Double, String)" + + [Test] + public void ConversionResultConstructorDoubleStringTest () + { + ConversionResult res = new ConversionResult (10.5, "lb"); + + Assert.IsNotNull (res); + Assert.AreEqual (10.5, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual ("lb", res.Symbol); + } + + [Test] + public void ConversionResultConstructorDoubleStringNullTest () + { + ConversionResult res = new ConversionResult (0, Convert.ToString (null)); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + [Test] + public void ConversionResultConstructorDoubleStringNullTest2 () + { + ConversionResult res = new ConversionResult (10.5, Convert.ToString (null)); + + Assert.IsNotNull (res); + Assert.AreEqual (10.5, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + [Test] + public void ConversionResultConstructorDoubleStringZeroTest3 () + { + ConversionResult res = new ConversionResult (0, "lb"); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual ("lb", res.Symbol); + } + + #endregion + #region "ConversionResult.ConversionResult(Double, Result)" + + [Test] + public void ConversionResultConstructorDoubleResultTest () + { + ConversionResult res = new ConversionResult (10.5, Result.GenericError); + + Assert.IsNotNull (res); + Assert.AreEqual (10.5, res.Value); + Assert.AreEqual (Result.GenericError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + [Test] + public void ConversionResultConstructorDoubleResultNullTest () + { + ConversionResult res = new ConversionResult (0, (Result)0); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + [Test] + public void ConversionResultConstructorDoubleResultNullTest2 () + { + ConversionResult res = new ConversionResult (10.5, (Result)0); + + Assert.IsNotNull (res); + Assert.AreEqual (10.5, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + [Test] + public void ConversionResultConstructorDoubleResultNullTest3 () + { + ConversionResult res = new ConversionResult (0, Result.GenericError); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.GenericError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + #endregion + #region "ConversionResult.ConversionResult(Result)" + + [Test] + public void ConversionResultConstructorResultTest () + { + ConversionResult res = new ConversionResult (Result.GenericError); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.GenericError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + [Test] + public void ConversionResultConstructorResultNullTest () + { + ConversionResult res = new ConversionResult (0.0); + + Assert.IsNotNull (res); + Assert.AreEqual (0, res.Value); + Assert.AreEqual (Result.NoError, res.Result); + Assert.AreEqual (null, res.Symbol); + } + + #endregion + #region "ConversionResult.Result" + + [Test] + public void ConversionResultResultTest () + { + ConversionResult res = new ConversionResult (Result.GenericError); + + Assert.IsNotNull (res); + Assert.AreEqual (Result.GenericError, res.Result); + + res.Result = Result.UnitNotFound; + + Assert.AreEqual (Result.UnitNotFound, res.Result); + } + + [Test] + public void ConversionResultResultNullTest () + { + ConversionResult res = new ConversionResult (Result.GenericError); + + Assert.IsNotNull (res); + Assert.AreEqual (Result.GenericError, res.Result); + + res.Result = Result.NoError; + + Assert.AreEqual (Result.NoError, res.Result); + } + + #endregion + #region "ConversionResult.Value" + + [Test] + public void ConversionResultValueTest () + { + ConversionResult res = new ConversionResult (12.1); + + Assert.IsNotNull (res); + Assert.AreEqual (12.1, res.Value); + + res.Value = 0.33; + + Assert.AreEqual (0.33, res.Value); + } + + [Test] + public void ConversionResultValueNullTest () + { + ConversionResult res = new ConversionResult (12.1); + + Assert.IsNotNull (res); + Assert.AreEqual (12.1, res.Value); + + res.Value = 0.0; + + Assert.AreEqual (0, res.Value); + } + + #endregion + #region "ConversionResult.Symbol" + + [Test] + public void ConversionResultSymbolTest () + { + ConversionResult res = new ConversionResult (12.1, "ft"); + + Assert.IsNotNull (res); + Assert.AreEqual ("ft", res.Symbol); + + res.Symbol = "C"; + + Assert.AreEqual ("C", res.Symbol); + } + + [Test] + public void ConversionResultSymbolNullTest () + { + ConversionResult res = new ConversionResult (12.1, "ft"); + + Assert.IsNotNull (res); + Assert.AreEqual ("ft", res.Symbol); + + res.Symbol = null; + + Assert.AreEqual (null, res.Symbol); + } + + #endregion + } +} \ No newline at end of file diff --git a/Cubico.Tests/Cubico.Tests.csproj b/Cubico.Tests/Cubico.Tests.csproj new file mode 100644 index 0000000..d5acfee --- /dev/null +++ b/Cubico.Tests/Cubico.Tests.csproj @@ -0,0 +1,58 @@ + + + + Debug + AnyCPU + 12.0.0 + 2.0 + {8D4882D3-8D97-4D82-BE0E-AAC8A1D8B487} + Exe + Cubico.Tests + Cubico.Tests + + + true + false + bin\Debug + DEBUG; + prompt + 4 + false + + + true + bin\Release + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + {5C21F8E4-02C4-4614-97C7-1899F4E6E634} + Cubico + + + + + + + False + + + \ No newline at end of file diff --git a/Cubico.Tests/MeasurementTests.cs b/Cubico.Tests/MeasurementTests.cs new file mode 100644 index 0000000..01e7773 --- /dev/null +++ b/Cubico.Tests/MeasurementTests.cs @@ -0,0 +1,1401 @@ +using System; +using NUnit.Framework; +using Cubico; + +namespace Cubico.Tests +{ + [TestFixture] + public class MeasurementTests + { + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "Measurement.Value" + + [Test] + public void MeasurementValueTest () + { + double expected = 10; + Measurement target = new Measurement (expected, "ft"); + double actual = 0; + actual = target.Value; + + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Unit" + + [Test] + public void MeasurementUnitTest () + { + Unit expected = unitPro.Units ["Feet"]; + Measurement target = new Measurement (10, "ft"); + Unit actual = default(Unit); + actual = target.Unit; + + Assert.AreEqual (expected.Name, actual.Name); + } + + #endregion + #region "Measurement.Symbol" + + [Test] + public void MeasurementSymbolTest () + { + string expected = "ft"; + Measurement target = new Measurement (10, expected); + string actual = null; + actual = target.Symbol; + + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementSymbolNullTest () + { + string expected = null; + Measurement target = new Measurement (10, expected); + string actual = null; + actual = target.Symbol; + + } + + #endregion + #region "Measurement.IsValid" + + [Test] + public void MeasurementIsValidTest () + { + bool expected = true; + Measurement target = new Measurement (10, "ft"); + bool actual = false; + actual = target.IsValid; + + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementIsValidNullTest () + { + bool expected = false; + Measurement target = new Measurement (null); + bool actual = false; + actual = target.IsValid; + + Assert.AreEqual (expected, actual); + } + + //[Test] + //public void MeasurementIsValidNullTest2() + //{ + // bool expected = false; + // Measurement target = null; + // bool actual = false; + // actual = target.IsValid; + + // Assert.AreEqual(expected, actual); + // Assert.IsTrue(target == null); + // Assert.IsFalse(target != null); + //} + + [Test] + public void MeasurementIsValidBadUnitTest () + { + bool expected = false; + Measurement target = new Measurement (10, "ft", Result.BadUnit); + bool actual = false; + actual = target.IsValid; + + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.FullValue" + + [Test] + public void MeasurementFullValueTest () + { + string expected = "10ft"; + Measurement target = new Measurement (10, "ft"); + string actual = null; + actual = target.FullValue; + + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Flags" + + [Test] + public void MeasurementFlagsTest () + { + Measurement target = new Measurement (10, "ft"); + MeasurementFlags expected = MeasurementFlags.UseMaxBound; + MeasurementFlags actual = default(MeasurementFlags); + target.Flags = expected; + actual = target.Flags; + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Converter" + + [Test] + public void MeasurementConverterTest () + { + Measurement target = new Measurement (10, "ft"); + UnitConverter actual = default(UnitConverter); + actual = target.Converter; + + Assert.IsNotNull (actual); + } + + #endregion + #region "Measurement.ConversionResult" + + [Test] + public void MeasurementConversionResultTest () + { + Measurement target = new Measurement (10, "ft"); + Result expected = Result.GroupNotFound; + Result actual = default(Result); + target.ConversionResult = expected; + actual = target.ConversionResult; + + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementConversionResultNullTest () + { + Measurement target = new Measurement (10, "ft"); + Result expected = Result.NoError; + Result actual = default(Result); + target.ConversionResult = Result.NoError; + actual = target.ConversionResult; + + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.ValidateEntry(Value,Symbol)" + + [Test] + public void MeasurementValidateEntryValueSymbolTest () + { + Measurement target = new Measurement (10, "ft"); + double value = 100; + string symbol = "in"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.ValidateEntry (value, symbol); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementValidateEntryValueSymbolIncompatibleTest () + { + Measurement target = new Measurement (10, "ft"); + double value = 100; + string symbol = "hr"; + Result expected = Result.UnitMismatch; + Result actual = default(Result); + actual = target.ValidateEntry (value, symbol); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementValidateEntryValueSymbolMaxTest () + { + Measurement target = new Measurement (10, "ft"); + target.SetMaxBound (100, "ft"); + target.Flags = MeasurementFlags.UseMaxBound; + double value = 200; + string symbol = "ft"; + Result expected = Result.ValueTooHigh; + Result actual = default(Result); + actual = target.ValidateEntry (value, symbol); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementValidateEntryValueSymbolMinTest () + { + Measurement target = new Measurement (10, "ft"); + target.SetMinBound (5, "ft"); + target.Flags = MeasurementFlags.UseMinBound; + double value = 1; + string symbol = "ft"; + Result expected = Result.ValueTooLow; + Result actual = default(Result); + actual = target.ValidateEntry (value, symbol); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.ValidateEntry(entry)" + + [Test] + public void MeasurementValidateEntrySymbolTest () + { + Measurement target = new Measurement (10, "ft"); + string entry = "100in"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.ValidateEntry (entry); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementValidateEntrySymbolIncompatibleTest () + { + Measurement target = new Measurement (10, "ft"); + string entry = "100hr"; + Result expected = Result.UnitMismatch; + Result actual = default(Result); + actual = target.ValidateEntry (entry); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementValidateEntrySymbolMaxTest () + { + Measurement target = new Measurement (10, "ft"); + target.SetMaxBound (100, "ft"); + target.Flags = MeasurementFlags.UseMaxBound; + string entry = "200ft"; + Result expected = Result.ValueTooHigh; + Result actual = default(Result); + actual = target.ValidateEntry (entry); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementValidateEntrySymbolMinTest () + { + Measurement target = new Measurement (10, "ft"); + target.SetMinBound (5, "ft"); + target.Flags = MeasurementFlags.UseMinBound; + string entry = "1ft"; + Result expected = Result.ValueTooLow; + Result actual = default(Result); + actual = target.ValidateEntry (entry); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.ToString" + + [Test] + public void MeasurementToStringTest () + { + Measurement target = new Measurement (10, "ft"); + string expected = "10ft"; + string actual = null; + actual = target.ToString (); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.SetValue(measurementString)" + + [Test] + public void MeasurementSetValueStringTest () + { + Measurement target = new Measurement ("ft"); + string measurement = "10ft"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetValue (measurement); + Assert.AreEqual (expected, actual); + Assert.AreEqual (10, target.Value); + } + + [Test] + public void MeasurementSetValueStringTest2 () + { + Measurement target = new Measurement ("ft"); + string measurement = "12in"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetValue (measurement); + Assert.AreEqual (expected, actual); + Assert.AreEqual (12, target.Value); + } + + [Test] + public void MeasurementSetValueStringTest3 () + { + Measurement target = new Measurement ("ft"); + target.Flags = MeasurementFlags.ForceUnit; + string measurement = "12in"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetValue (measurement); + Assert.AreEqual (expected, actual); + Assert.AreEqual (1, target.Value); + } + + [Test] + public void MeasurementSetValueStringInvalidTest () + { + Measurement target = new Measurement ("ft"); + string measurement = "12hr"; + Result expected = Result.UnitMismatch; + Result actual = default(Result); + actual = target.SetValue (measurement); + Assert.AreEqual (expected, actual); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetValueStringNullTest () + { + Measurement target = new Measurement ("ft"); + Result actual = default(Result); + actual = target.SetValue ((string)null); + Assert.Fail (); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetValueStringEmptyTest () + { + Measurement target = new Measurement ("ft"); + Result actual = default(Result); + actual = target.SetValue (string.Empty); + Assert.Fail (); + } + + #endregion + #region "Measurement.SetValue(value)" + + [Test] + public void MeasurementSetValueTest () + { + Measurement target = new Measurement ("ft"); + double value = 15; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetValue (value); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.SetUnit(symbol)" + + [Test] + public void MeasurementSetUnitTest () + { + Measurement target = new Measurement ("ft"); + string unitSymbol = "s"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetUnit (unitSymbol); + Assert.AreEqual (expected, actual); + Assert.AreEqual ("Second", target.Unit.Name); + } + + [Test] + public void MeasurementSetUnitTest2 () + { + Measurement target = new Measurement ("ft"); + string unitSymbol = "ft"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetUnit (unitSymbol); + Assert.AreEqual (expected, actual); + Assert.AreEqual ("Feet", target.Unit.Name); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetUnitNullTest () + { + Measurement target = new Measurement ("ft"); + Result expected = Result.BadUnit; + Result actual = default(Result); + actual = target.SetUnit (null); + Assert.AreEqual (expected, actual); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetUnitEmptyTest () + { + Measurement target = new Measurement ("ft"); + Result expected = Result.BadUnit; + Result actual = default(Result); + actual = target.SetUnit (string.Empty); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.SetMinBound" + + [Test] + public void MeasurementSetMinBoundTest () + { + Measurement target = new Measurement (10, "ft"); + double minbound = 0; + string unitSymbol = "ft"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetMinBound (minbound, unitSymbol); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementSetMinBoundTest2 () + { + Measurement target = new Measurement (10, "ft"); + double minbound = 12; + string unitSymbol = "in"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetMinBound (minbound, unitSymbol); + Assert.AreEqual (expected, actual); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetMinBoundNullTest () + { + Measurement target = new Measurement (10, "ft"); + Result actual; + actual = target.SetMinBound (0, null); + Assert.Fail (); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetMinBoundEmptyTest () + { + Measurement target = new Measurement (10, "ft"); + Result actual = default(Result); + actual = target.SetMinBound (1, string.Empty); + Assert.Fail (); + } + + #endregion + #region "Measurement.SetMaxBound" + + [Test] + public void MeasurementSetMaxBoundTest () + { + Measurement target = new Measurement (10, "ft"); + double maxbound = 100; + string unitSymbol = "ft"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetMaxBound (maxbound, unitSymbol); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementSetMaxBoundTest2 () + { + Measurement target = new Measurement (10, "ft"); + double maxbound = 8; + string unitSymbol = "in"; + Result expected = Result.NoError; + Result actual = default(Result); + actual = target.SetMaxBound (maxbound, unitSymbol); + Assert.AreEqual (expected, actual); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetMaxBoundNullTest () + { + Measurement target = new Measurement (10, "ft"); + Result actual = default(Result); + actual = target.SetMinBound (0, null); + Assert.Fail (); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void MeasurementSetMaxBoundEmptyTest () + { + Measurement target = new Measurement (10, "ft"); + Result actual = default(Result); + actual = target.SetMinBound (1, string.Empty); + Assert.Fail (); + } + + #endregion + #region "Measurement.Operator -" + + [Test] + public void Measurementop_SubtractionTest () + { + Measurement d1 = new Measurement (5, "ft"); + Measurement d2 = new Measurement (5, "ft"); + Measurement expected = new Measurement (0, "ft"); + Measurement actual = default(Measurement); + actual = (d1 - d2); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_SubtractionDiffUnitTest () + { + Measurement d1 = new Measurement (5, "ft"); + Measurement d2 = new Measurement (60, "in"); + Measurement expected = new Measurement (0, "ft"); + Measurement actual = default(Measurement); + actual = (d1 - d2); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator *" + + [Test] + public void Measurementop_MultiplyTest () + { + Measurement d1 = new Measurement (5, "ft"); + Measurement d2 = new Measurement (5, "ft"); + Measurement expected = new Measurement (25, "ft"); + Measurement actual = default(Measurement); + actual = (d1 * d2); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_MultiplyDiffUnitTest () + { + Measurement d1 = new Measurement (5, "ft"); + Measurement d2 = new Measurement (60, "in"); + Measurement expected = new Measurement (25, "ft"); + Measurement actual = default(Measurement); + actual = (d1 * d2); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator <=" + + [Test] + public void Measurementop_LessThanOrEqualTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (6, "ft"); + bool expected = true; + bool actual = false; + actual = (left <= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanOrEqualTest2 () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (5, "ft"); + bool expected = true; + bool actual = false; + actual = (left <= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanOrEqualFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "ft"); + bool expected = false; + bool actual = false; + actual = (left <= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanOrEqualDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (600, "in"); + bool expected = true; + bool actual = false; + actual = (left <= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanOrEqualDiffUnitTest2 () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (60, "in"); + bool expected = true; + bool actual = false; + actual = (left <= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanOrEqualFalseDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "in"); + bool expected = false; + bool actual = false; + actual = (left <= right); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator <" + + [Test] + public void Measurementop_LessThanTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (6, "ft"); + bool expected = true; + bool actual = false; + actual = (left < right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (5, "ft"); + bool expected = false; + bool actual = false; + actual = (left < right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (400, "in"); + bool expected = true; + bool actual = false; + actual = (left < right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_LessThanFalseDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (60, "in"); + bool expected = false; + bool actual = false; + actual = (left < right); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator <>" + + [Test] + public void Measurementop_InequalityTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "ft"); + bool expected = true; + bool actual = false; + actual = (left != right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_InequalityFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (5, "ft"); + bool expected = false; + bool actual = false; + actual = (left != right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_InequalityDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "in"); + bool expected = true; + bool actual = false; + actual = (left != right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_InequalityDiffUnitFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (60, "in"); + bool expected = false; + bool actual = false; + actual = (left != right); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator >=" + + [Test] + public void Measurementop_GreaterThanOrEqualTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "ft"); + bool expected = true; + bool actual = false; + actual = (left >= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanOrEqualTest2 () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (5, "ft"); + bool expected = true; + bool actual = false; + actual = (left >= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanOrEqualFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (6, "ft"); + bool expected = false; + bool actual = false; + actual = (left >= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanOrEqualDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "in"); + bool expected = true; + bool actual = false; + actual = (left >= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanOrEqualDiffUnitTest2 () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (60, "in"); + bool expected = true; + bool actual = false; + actual = (left >= right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanOrEqualDiffUnitFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (600, "in"); + bool expected = false; + bool actual = false; + actual = (left >= right); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator >" + + [Test] + public void Measurementop_GreaterThanTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "ft"); + bool expected = true; + bool actual = false; + actual = (left > right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (5, "ft"); + bool expected = false; + bool actual = false; + actual = (left > right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "in"); + bool expected = true; + bool actual = false; + actual = (left > right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_GreaterThanDiffUnitFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (60, "in"); + bool expected = false; + bool actual = false; + actual = (left > right); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator =" + + [Test] + public void Measurementop_EqualityTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (5, "ft"); + bool expected = true; + bool actual = false; + actual = (left == right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_EqualityDiffUnitTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (60, "in"); + bool expected = true; + bool actual = false; + actual = (left == right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_EqualityFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (4, "ft"); + bool expected = false; + bool actual = false; + actual = (left == right); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_EqualityDiffUnitFalseTest () + { + Measurement left = new Measurement (5, "ft"); + Measurement right = new Measurement (61, "in"); + bool expected = false; + bool actual = false; + actual = (left == right); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator /" + + [Test] + public void Measurementop_DivisionTest () + { + Measurement d1 = new Measurement (25, "ft"); + Measurement d2 = new Measurement (5, "ft"); + Measurement expected = new Measurement (5, "ft"); + Measurement actual = default(Measurement); + actual = (d1 / d2); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_DivisionDiffUnitTest () + { + Measurement d1 = new Measurement (25, "ft"); + Measurement d2 = new Measurement (60, "in"); + Measurement expected = new Measurement (5, "ft"); + Measurement actual = default(Measurement); + actual = (d1 / d2); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Operator +" + + [Test] + public void Measurementop_AdditionTest () + { + Measurement d1 = new Measurement (5, "ft"); + Measurement d2 = new Measurement (5, "ft"); + Measurement expected = new Measurement (10, "ft"); + Measurement actual = default(Measurement); + actual = (d1 + d2); + Assert.AreEqual (expected, actual); + } + + [Test] + public void Measurementop_AdditionDiffUnitTest () + { + Measurement d1 = new Measurement (5, "ft"); + Measurement d2 = new Measurement (60, "in"); + Measurement expected = new Measurement (10, "ft"); + Measurement actual = default(Measurement); + actual = (d1 + d2); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.GetValueAs(unitSymbol)" + + [Test] + public void MeasurementGetValueAsTest() + { + Measurement target = new Measurement(5, "ft"); + string unitSymbol = "in"; + Measurement expected = new Measurement(Convert.ToDecimal("60.0000"), "in"); + Measurement actual = default(Measurement); + actual = target.GetValueAs(unitSymbol); + Assert.AreEqual(expected.Value, actual.Value); + Assert.AreEqual(expected.ToString, actual.ToString); + } + + [Test] + public void MeasurementGetValueAsInvalidUnitSymbolTest () + { + Measurement target = new Measurement (5, "ft"); + string unitSymbol = "F"; + Measurement actual = default(Measurement); + actual = target.GetValueAs (unitSymbol); + + Assert.IsTrue (actual.ConversionResult == Result.UnitMismatch); + Assert.IsTrue (actual.Value == 0); + Assert.IsTrue (actual.Value == 0); + } + + #endregion + #region "Measurement.GetStringValueAs(unitSymbol)" + + [Test] + public void MeasurementGetStringValueAsTest () + { + Measurement target = new Measurement (5, "ft"); + string unitSymbol = "in"; + string expected = "60in"; + string actual = null; + actual = target.GetStringValueAs (unitSymbol); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementGetStringValueAsInvalidUnitSymbolTest () + { + Measurement target = new Measurement (10, "ft"); + string unitSymbol = "F"; + string expected = "Conversion Error"; + string actual = null; + actual = target.GetStringValueAs (unitSymbol); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.GetHashCode" + + [Test] + public void MeasurementGetHashCodeTest () + { + Measurement target = new Measurement (10, "ft"); + + Measurement Mes = target.Converter.ConvertUnits (target.Value, target.Unit.DefaultSymbol, "m"); + + string expectedStr = null; + + if (Mes.ConversionResult != Result.NoError) { + expectedStr = target.Value.ToString () + "|" + target.ConversionResult.ToString (); + } else { + expectedStr = Mes.Value.ToString () + "|" + Mes.Symbol; + } + + int expected = (expectedStr).GetHashCode (); + int actual = 0; + actual = target.GetHashCode (); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Equals(Of Measurement)" + + [Test] + public void MeasurementEqualsOfTest () + { + IEquatable target = new Measurement (5, "ft"); + Measurement other = new Measurement (60, "in"); + bool expected = true; + bool actual = false; + actual = target.Equals (other); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementEqualsOfTest2 () + { + IEquatable target = new Measurement (5, "ft"); + Measurement other = new Measurement (5, "ft"); + bool expected = true; + bool actual = false; + actual = target.Equals (other); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementEqualsOfFalseTest () + { + IEquatable target = new Measurement (5, "ft"); + Measurement other = new Measurement (5, "in"); + bool expected = false; + bool actual = false; + actual = target.Equals (other); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementEqualsOfInvalidUnitTest () + { + IEquatable target = new Measurement (5, "ft"); + Measurement other = new Measurement (5, "F"); + bool expected = false; + bool actual = false; + actual = target.Equals (other); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Equals(obj)" + + [Test] + public void MeasurementEqualsTest () + { + Measurement target = new Measurement (5, "ft"); + object obj = new Measurement (5, "ft"); + bool expected = true; + bool actual = false; + actual = target.Equals (obj); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementEqualsTest2 () + { + Measurement target = new Measurement (5, "ft"); + object obj = new Measurement (60, "in"); + bool expected = true; + bool actual = false; + actual = target.Equals (obj); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementEqualsFalseTest () + { + Measurement target = new Measurement (5, "ft"); + object obj = new Measurement (5, "in"); + bool expected = false; + bool actual = false; + actual = target.Equals (obj); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementEqualsInvalidTest () + { + Measurement target = new Measurement (5, "ft"); + object obj = new Measurement (5, "F"); + bool expected = false; + bool actual = false; + actual = target.Equals (obj); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementEqualsInvalidTypeTest () + { + Measurement target = new Measurement (5, "ft"); + object obj = 5; + bool expected = false; + bool actual = false; + actual = target.Equals (obj); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.CompareTo" + + [Test] + public void MeasurementCompareToTest () + { + IComparable target = new Measurement (5, "ft"); + Measurement other = new Measurement (5, "ft"); + int expected = 0; + int actual = 0; + actual = target.CompareTo (other); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementCompareToGreaterTest () + { + IComparable target = new Measurement (5, "ft"); + Measurement other = new Measurement (4, "ft"); + int expected = 1; + int actual = 0; + actual = target.CompareTo (other); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementCompareToGreaterDifferentUnitTest () + { + IComparable target = new Measurement (5, "ft"); + Measurement other = new Measurement (41, "in"); + int expected = 1; + int actual; + actual = target.CompareTo (other); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementCompareToLessTest () + { + IComparable target = new Measurement (5, "ft"); + Measurement other = new Measurement (6, "ft"); + int expected = -1; + int actual = 0; + actual = target.CompareTo (other); + Assert.AreEqual (expected, actual); + } + + [Test] + public void MeasurementCompareToGreaterLessUnitTest () + { + IComparable target = new Measurement (5, "ft"); + Measurement other = new Measurement (61, "in"); + int expected = -1; + int actual = 0; + actual = target.CompareTo (other); + Assert.AreEqual (expected, actual); + } + + #endregion + #region "Measurement.Measurement(Value, UnitSymbol)" + + [Test] + public void MeasurementConstructorValueUnitSymbolTest () + { + double value = 10; + string unitSymbol = "ft"; + Measurement target = new Measurement (value, unitSymbol); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.AreEqual ("Feet", target.Unit.Name); + Assert.AreEqual (10, target.Value); + } + + [Test] + public void MeasurementConstructorValueUnitSymbolNullNullTest () + { + Measurement target = new Measurement (0, (string)null); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.BadUnit); + Assert.AreEqual (null, target.Unit); + Assert.AreEqual (0, target.Value); + } + + [Test] + public void MeasurementConstructorValueUnitSymbolValueNullTest () + { + Measurement target = new Measurement (0, "ft"); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.AreEqual ("Feet", target.Unit.Name); + Assert.AreEqual (0, target.Value); + } + + [Test] + public void MeasurementConstructorValueUnitSymbolUnitSymbolNullTest () + { + Measurement target = new Measurement (10, (string)null); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.BadUnit); + Assert.AreEqual (null, target.Unit); + Assert.AreEqual (10, target.Value); + } + + [Test] + public void MeasurementConstructorValueUnitSymbolEmptyTest () + { + Measurement target = new Measurement (10, string.Empty); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.BadUnit); + Assert.AreEqual (null, target.Unit); + Assert.AreEqual (10, target.Value); + } + + #endregion + #region "Measurement.Measurement(unitSymbol)" + + [Test] + public void MeasurementConstructorUnitSymbolTest () + { + string unitSymbol = "ft"; + Measurement target = new Measurement (unitSymbol); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.AreEqual ("Feet", target.Unit.Name); + Assert.AreEqual (0, target.Value); + } + + [Test] + public void MeasurementConstructorUnitSymbolNullTest () + { + Measurement target = new Measurement (null); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.BadUnit); + Assert.AreEqual (null, target.Unit); + Assert.AreEqual (0, target.Value); + } + + [Test] + public void MeasurementConstructorUnitSymbolEmptyTest () + { + Measurement target = new Measurement (null); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.BadUnit); + Assert.AreEqual (null, target.Unit); + Assert.AreEqual (0, target.Value); + } + + #endregion + #region "Measurement.Measurement(Value, UnitSymbol, ConversionResult)" + + [Test] + public void MeasurementConstructorValueUnitSymbolResultTest () + { + double value = 10; + string unitSymbol = "ft"; + Result ConversionResult = Result.NoError; + Measurement target = new Measurement (value, unitSymbol, ConversionResult); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.AreEqual ("Feet", target.Unit.Name); + Assert.AreEqual (10, target.Value); + } + + [Test] + public void MeasurementConstructorValueUnitSymbolResultTest2 () + { + double value = 10; + string unitSymbol = "ft"; + Result ConversionResult = Result.GenericError; + Measurement target = new Measurement (value, unitSymbol, ConversionResult); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.GenericError); + Assert.AreEqual ("Feet", target.Unit.Name); + Assert.AreEqual (10, target.Value); + } + + #endregion + #region "Measurement.Measurement(Value,Unit,ConversionResult)" + + // A test for Measurement Constructor + [Test] + public void MeasurementConstructorValueUnitConversionResultTest () + { + double value = 10; + Unit unit = unitPro.Units ["Feet"]; + Result ConversionResult = Result.NoError; + Measurement target = new Measurement (value, unit, ConversionResult); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.AreEqual ("Feet", target.Unit.Name); + Assert.AreEqual (10, target.Value); + } + + [Test] + public void MeasurementConstructorValueUnitConversionResultNullTest () + { + Measurement target = new Measurement (0, (Unit)null, Result.NoError); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.IsNull (target.Unit); + Assert.AreEqual (0, target.Value); + } + + #endregion + #region "Measurement.Measurement(Value,Result)" + + // A test for Measurement Constructor + [Test] + public void MeasurementConstructorValueResultTest () + { + double value = 10; + Result ConversionResult = Result.NoError; + Measurement target = new Measurement (value, ConversionResult); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.IsNull (target.Unit); + Assert.AreEqual (10, target.Value); + } + + [Test] + public void MeasurementConstructorValueResultNullTest () + { + Measurement target = new Measurement (0, Result.NoError); + + Assert.IsNotNull (target); + Assert.IsTrue (target.Flags == MeasurementFlags.None); + Assert.IsTrue (target.ConversionResult == Result.NoError); + Assert.IsNull (target.Unit); + Assert.AreEqual (0, target.Value); + } + + #endregion + } +} \ No newline at end of file diff --git a/Cubico.Tests/ModifierTest.cs b/Cubico.Tests/ModifierTest.cs new file mode 100644 index 0000000..fb56344 --- /dev/null +++ b/Cubico.Tests/ModifierTest.cs @@ -0,0 +1,109 @@ +using System; +using Cubico; +using NUnit.Framework; + +namespace Cubico.Tests +{ + [TestFixture] + public class ModifierTest + { + TestContext testContextInstance; + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "Modifier.Modifier()" + + [Test] + public void ModifierNewTest () + { + Modifier testObj = new Modifier (); + + Assert.IsNotNull (testObj); + Assert.IsTrue (testObj.ID == 0); + Assert.IsTrue (testObj.Value == 0); + Assert.IsNull (testObj.ParentUnit); + } + + #endregion + #region "Modifier.ID" + + [Test] + public void ModifierIDTest () + { + Modifier testObj = new Modifier (); + testObj.ID = 99; + + Assert.AreEqual (99, testObj.ID); + } + + #endregion + #region "Modifier.ParentUnit" + + [Test] + public void ModifierParentUnitTest () + { + Unit testUnitObj = new Unit { + ID = 99, + Name = "Name" + }; + + Modifier testObj = new Modifier (); + testObj.ParentUnit = testUnitObj; + + Assert.IsNotNull (testObj.ParentUnit); + Assert.AreEqual (testUnitObj.ID, testObj.ParentUnit.ID); + Assert.AreEqual (testUnitObj.Name, testObj.ParentUnit.Name); + } + + [Test] + public void ModifierParentUnitNullTest () + { + Modifier testObj = new Modifier (); + testObj.ParentUnit = null; + + Assert.IsNull (testObj.ParentUnit); + } + + #endregion + #region "Modifier.Value" + + [Test] + public void ModifierValueTest () + { + Modifier testObj = new Modifier (); + testObj.Value = Convert.ToDecimal (0.001); + + Assert.AreEqual (Convert.ToDecimal(0.001), testObj.Value); + } + + #endregion + #region "Modifier.Order" + + [Test] + public void ModifierOrderTest () + { + Modifier testObj = new Modifier (); + testObj.Order = 10; + + Assert.AreEqual (10, testObj.Order); + } + + #endregion + #region "Modifier.ModifierType" + + [Test] + public void ModifierTypeTest () + { + Modifier testObj = new Modifier (); + testObj.ModifierType = ModifierType.Multiply; + + Assert.AreEqual (ModifierType.Multiply, testObj.ModifierType); + } + + #endregion + } +} \ No newline at end of file diff --git a/Cubico.Tests/Properties/AssemblyInfo.cs b/Cubico.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5d21599 --- /dev/null +++ b/Cubico.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Cubico.Tests")] +[assembly: AssemblyDescription("Tests for Cubico")] +//[assembly: AssemblyConfiguration("")] +//[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Cubico.Tests")] +//[assembly: AssemblyCopyright("")] +//[assembly: AssemblyTrademark("")] +//[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +//[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] \ No newline at end of file diff --git a/Cubico.Tests/SymbolTest.cs b/Cubico.Tests/SymbolTest.cs new file mode 100644 index 0000000..b09d6cc --- /dev/null +++ b/Cubico.Tests/SymbolTest.cs @@ -0,0 +1,292 @@ +using System; +using Cubico; +using NUnit.Framework; + +namespace Cubico.Tests +{ + [TestFixture] + public class SymbolTest + { + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "Symbol.Symbol()" + + [Test] + public void SymbolNewTest () + { + Symbol testObj = new Symbol (); + + Assert.IsNotNull (testObj); + Assert.IsTrue (testObj.Id == 0); + Assert.IsTrue (testObj.Value == null); + Assert.IsNull (testObj.Unit); + } + + #endregion + #region "Symbol.Symbol(Unit)" + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void SymbolNewEfUnitSymbolUnitNullTest () + { + Symbol testObj = new Symbol (null); + + Assert.Fail ("Null values are not allowed for this constructor."); + } + + [Test] + public void SymbolNewEfUnitSymbolUnitTest () + { + Unit unitObj = new Unit { + ID = 99, + Name = "Name" + }; + Symbol testObj = new Symbol (unitObj); + + Assert.IsNotNull (testObj); + + Assert.IsTrue (string.IsNullOrEmpty(testObj.Value)); + + Assert.IsNotNull (testObj.Unit); + Assert.IsTrue (testObj.Unit.ID == unitObj.ID); + } + + #endregion + #region "Symbol.ID" + + [Test] + public void SymbolIDNullTest() + { + Symbol testObj = new Symbol(); + + testObj.Id = null; + + Assert.AreEqual(null, testObj.Id); + } + + [Test] + public void SymbolIDTest () + { + Symbol testObj = new Symbol (); + + testObj.Id = 99; + + Assert.AreEqual (99, testObj.Id); + } + + #endregion + #region "Symbol.ParentUnit" + + [Test] + public void SymbolParentUnitTest () + { + Unit testUnitObj = new Unit (); + Symbol testObj = new Symbol (testUnitObj); + testObj.Unit = testUnitObj; + + Assert.IsNotNull (testObj.Unit); + Assert.AreEqual (testUnitObj.ID, testObj.Unit.ID); + Assert.AreEqual (testUnitObj.Name, testObj.Unit.Name); + } + + [Test] + public void SymbolParentUnitNullTest () + { + Symbol testObj = new Symbol (); + + testObj.Unit = null; + + Assert.IsNull (testObj.Unit); + } + + #endregion + #region "Symbol.Value" + + [Test] + public void SymbolValueTest () + { + Symbol testObj = new Symbol (); + + testObj.Value = "Test Name"; + + Assert.AreEqual ("Test Name", testObj.Value); + } + + #endregion + #region "Symbol.IsDefault" + + [Test] + public void SymbolIsDefaultTest () + { + Symbol testObj = new Symbol (); + + testObj.IsDefault = true; + + Assert.AreEqual (true, testObj.IsDefault); + } + + #endregion + #region "IEquatable" + + [Test] + public void Symbol_EqualityTest () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = unitPro.Symbols ["ft"].Symbols [0]; + + Assert.IsTrue (expected == target); + } + + [Test] + public void Unit_EqualityTest2 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = unitPro.Symbols ["in"].Symbols [0]; + + Assert.IsFalse (expected == target); + } + + [Test] + public void Unit_EqualityTest3 () + { + Symbol expected = null; + Symbol target = unitPro.Symbols ["in"].Symbols [0]; + + Assert.IsFalse (expected == target); + } + + [Test] + public void Unit_EqualityTest4 () + { + Symbol expected = unitPro.Symbols ["in"].Symbols [0]; + Symbol target = null; + + Assert.IsFalse (expected == target); + } + + [Test] + public void Unit_EqualityTest5 () + { + Symbol expected = null; + Symbol target = null; + + Assert.IsTrue (expected == target); + } + + [Test] + public void Unit_EqualityTest6 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = unitPro.Symbols ["in"].Symbols [0]; + + Assert.IsTrue (expected != target); + } + + [Test] + public void Unit_EqualityTest7 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = null; + + Assert.IsTrue (expected != target); + } + + [Test] + public void Unit_EqualityTest8 () + { + Symbol expected = null; + Symbol target = unitPro.Symbols ["ft"].Symbols [0]; + + Assert.IsTrue (expected != target); + } + + [Test] + public void Unit_EqualityTest8_1 () + { + Symbol expected = null; + Symbol target = null; + + Assert.IsFalse (expected != target); + } + + [Test] + public void Unit_EqualityTest9 () + { + Symbol expected = unitPro.Symbols ["in"].Symbols [0]; + Symbol target = unitPro.Symbols ["ft"].Symbols [0]; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest10 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = unitPro.Symbols ["ft"].Symbols [0]; + + Assert.IsTrue (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest11 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = unitPro.Symbols ["in"].Symbols [0]; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest12 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = null; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest13 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = unitPro.Symbols ["ft"].Symbols [0]; + + Assert.IsTrue (expected.Equals((object)target)); + } + + [Test] + public void Unit_EqualityTest14 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = unitPro.Symbols ["in"].Symbols [0]; + + Assert.IsFalse (expected.Equals((object)target)); + } + + [Test] + public void Unit_EqualityTest154 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + Symbol target = null; + + Assert.IsFalse (expected.Equals((object)target)); + } + + [Test] + public void Unit_EqualityTest15 () + { + Symbol expected = unitPro.Symbols ["ft"].Symbols [0]; + + Assert.IsTrue (expected.GetHashCode() == expected.Value.GetHashCode()); + } + + #endregion + } +} \ No newline at end of file diff --git a/Cubico.Tests/UnitConverterTest.cs b/Cubico.Tests/UnitConverterTest.cs new file mode 100644 index 0000000..41ff1d6 --- /dev/null +++ b/Cubico.Tests/UnitConverterTest.cs @@ -0,0 +1,9047 @@ +using System; +using NUnit.Framework; +using Cubico; + +namespace Cubico.Tests +{ + [TestFixture] + public class UnitConverterTest + { + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "UnitConverter.ParseUnitString" + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest () + { + UnitConverter target = new UnitConverter (); + string input = "10ft"; + Measurement expected = new Measurement (10, "ft"); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (input); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest2 () + { + UnitConverter target = new UnitConverter (); + string input = "10 ft"; + Measurement expected = new Measurement (10, "ft"); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (input); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest3 () + { + UnitConverter target = new UnitConverter (); + string input = "10 m/s"; + Measurement expected = new Measurement (10, "m/s"); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (input); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest4 () + { + UnitConverter target = new UnitConverter (); + string input = "10'"; + Measurement expected = new Measurement (10, "'"); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (input); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest5 () + { + UnitConverter target = new UnitConverter (); + string input = "10ft²"; + Measurement expected = new Measurement (10, "ft²"); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (input); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest6 () + { + UnitConverter target = new UnitConverter (); + string input = "10˚"; + Measurement expected = new Measurement (10, "˚"); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (input); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest7 () + { + UnitConverter target = new UnitConverter (); + string input = "10 ˚F"; + Measurement expected = new Measurement (10, "˚F"); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (input); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringTest8 () + { + 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); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringNoSymbolTest () + { + UnitConverter target = new UnitConverter (); + string input = "10"; + 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); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ParseUnitStringEmptyTest () + { + UnitConverter target = new UnitConverter (); + Measurement expected = new Measurement (0, Result.BadValue); + Measurement actual = default(Measurement); + actual = target.ParseUnitString (string.Empty); + Assert.AreNotEqual (expected, actual); + Assert.AreEqual (expected.ConversionResult, actual.ConversionResult); + } + + #endregion + #region "UnitConverter.IsCompatible" + + [Test] + [TestCase(UnitTestCategory.Integration)] + public void UnitConverter_IsCompatibleTest () + { + UnitConverter target = new UnitConverter (); + string leftSymbol = "C"; + string rightSymbol = "F"; + bool actual = false; + actual = target.IsCompatible (leftSymbol, rightSymbol); + Assert.IsTrue (actual); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + public void UnitConverter_IsCompatibleFalseTest () + { + UnitConverter target = new UnitConverter (); + string leftSymbol = "C"; + string rightSymbol = "in"; + bool actual = false; + actual = target.IsCompatible (leftSymbol, rightSymbol); + Assert.IsFalse (actual); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_IsCompatibleNullTest () + { + UnitConverter target = new UnitConverter (); + bool actual = false; + actual = target.IsCompatible (null, null); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_IsCompatibleLeftNullTest () + { + UnitConverter target = new UnitConverter (); + string rightSymbol = "in"; + bool actual = false; + actual = target.IsCompatible (null, rightSymbol); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_IsCompatibleRightNullTest () + { + UnitConverter target = new UnitConverter (); + string leftSymbol = "C"; + bool actual = false; + actual = target.IsCompatible (leftSymbol, null); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_IsCompatibleEmptyTest () + { + UnitConverter target = new UnitConverter (); + bool actual = false; + actual = target.IsCompatible (string.Empty, string.Empty); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_IsCompatibleLeftEmptyTest () + { + UnitConverter target = new UnitConverter (); + string rightSymbol = "in"; + bool actual = false; + actual = target.IsCompatible (string.Empty, rightSymbol); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_IsCompatibleRightEmptyTest () + { + UnitConverter target = new UnitConverter (); + string leftSymbol = "C"; + bool actual = false; + actual = target.IsCompatible (leftSymbol, string.Empty); + + Assert.Fail (); + } + + #endregion + #region "UnitProvider.GetUnitBySymbol" + + [Test] + [TestCase(UnitTestCategory.CRUD)] + public void UnitConverter_GetUnitBySymbol_Test () + { + UnitConverter target = new UnitConverter (); + string unitSymbol = "C"; + Unit expected = unitPro.Symbols ["C"]; + Unit actual = default(Unit); + actual = target.GetUnitBySymbol (unitSymbol); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.ExceptionTest)] + [ExpectedException(typeof(ArgumentNullException))] + public void UnitConverter_GetUnitBySymbolNull_Test () + { + UnitConverter target = new UnitConverter (); + Unit actual = default(Unit); + actual = target.GetUnitBySymbol (null); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.ExceptionTest)] + [ExpectedException(typeof(ArgumentNullException))] + public void UnitConverter_GetUnitBySymbolEmpty_Test () + { + UnitConverter target = new UnitConverter (); + Unit actual = default(Unit); + actual = target.GetUnitBySymbol (string.Empty); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.ExceptionTest)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_GetUnitBySymbol_UnrecognizedSymbol_Test () + { + UnitConverter target = new UnitConverter (); + string unitName = "BogusUnitSymbol"; + Unit actual = default(Unit); + actual = target.GetUnitByName (unitName); + Assert.Fail (); + } + + #endregion + #region "UnitConverter.GetUnitByName" + + [Test] + [TestCase(UnitTestCategory.CRUD)] + public void UnitConverter_GetUnitByName_Test () + { + UnitConverter target = new UnitConverter (); + string unitName = "Celsius"; + Unit expected = unitPro.Units ["Celsius"]; + Unit actual = default(Unit); + actual = target.GetUnitByName (unitName); + Assert.AreEqual (expected, actual); + } + + [Test] + [TestCase(UnitTestCategory.ExceptionTest)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_GetUnitByNameNull_Test () + { + UnitConverter target = new UnitConverter (); + + Unit actual = default(Unit); + actual = target.GetUnitByName (null); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.ExceptionTest)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_GetUnitByNameEmpty_Test () + { + UnitConverter target = new UnitConverter (); + + Unit actual = default(Unit); + actual = target.GetUnitByName (string.Empty); + + Assert.Fail (); + } + + [Test] + [TestCase(UnitTestCategory.ExceptionTest)] + [ExpectedException(typeof(ArgumentException))] + public void UnitConverter_GetUnitByName_UnrecognizedName_Test () + { + UnitConverter target = new UnitConverter (); + string unitName = "BogusUnitName"; + Unit actual = default(Unit); + actual = target.GetUnitByName (unitName); + Assert.Fail (); + } + + #endregion + #region "UnitConverter.ConvertUnits" + #region "Temperature Tests" + #region "Source as Kelvin" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Celcius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-173.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Celcius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-272.65), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Celcius_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "K"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-279.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-458.77), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Fahrenheit_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "K"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(500), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(500000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(500000000), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.0005), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(5E-07), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-138.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.12), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Reaumur_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "K"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "K"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(180), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "K"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(0.9), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kelvin_to_Rankine_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "K"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(0), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Celsius" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celcius_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(373.15), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celcius_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(273.65), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(212), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(32.9), "F"); + Measurement actual; + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Fahrenheit_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "C"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(32), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(373150), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(273650), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(373150000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(273650000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(373150000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(273650000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.37315), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.27365), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.00037315), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.00027365), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(80), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(0.4), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Reaumur_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "C"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(0), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "C"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(671.67), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "C"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(492.57), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Celsius_to_Rankine_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "C"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(491.67), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Fahrenheit" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(310.93), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(255.65), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Kelvin_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "F"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(255.37), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(37.78), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-17.5), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Celsius_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "F"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-17.78), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(310927.78), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(255650), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(310927777.78), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(255650000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(310927777777.78), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(255650000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.310927777777778), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.25565), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.000310927777778), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.00025565), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(30.22), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-14), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Reaumur_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "F"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-14.22), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "F"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(559.67), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "F"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(460.17), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Fahrenheit_to_Rankine_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "F"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(459.67), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Millikelvin" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(0.0005), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.05), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.49), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(500), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(500000), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(5E-07), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(5E-10), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.44), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(0.18), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Millikelvin_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "mK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(0.0009), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Millikelvin" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(5E-07), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(0.0005), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(500), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(5E-10), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(5E-13), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(0.00018), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microkelvin_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "µK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(9E-07), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Millikelvin" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(5E-10), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(5E-07), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(0.0005), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(5E-13), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0), "MK"); + //should be 0.0000000000000005; can only round to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(1.8E-07), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nK_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "nK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(9E-10), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Kilokelvin" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(500), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(99726.85), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(226.85), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(179540.33), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(440.33), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(500000), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(500000000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(500000000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.0005), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(79781.48), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(181.48), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(180000), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kK_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "kK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(900), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Megakelvin" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(500000), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(99999726.85), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(499726.85), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(179999540.33), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(899540.33), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(500000000), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(500000000000L), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(500000000000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(500), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(79999781.48), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(399781.48), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(180000000), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megakelvin_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "MK"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(900000), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Reaumur" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(398.15), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(273.77), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Kelvin_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Re"; + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(257), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(33.12), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Fahrenheit_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Re"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(32), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(398150), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(273775), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(398150000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(273775000), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(398150000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(273775000000L), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.39815), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.273775), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.00039815), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(0.000273775), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(125), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(0.62), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Celsius_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Re"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(0), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Rankine_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Re"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(716.67), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Rankine_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Re"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(492.8), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Reaumur_to_Rankine_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Re"; + string targetUnitName = "Ra"; + Measurement expected = new Measurement (Convert.ToDouble(491.67), "Ra"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Rankine" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Kelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(55.56), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Kelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(0.28), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Kelvin_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Ra"; + string targetUnitName = "K"; + Measurement expected = new Measurement (Convert.ToDouble(0), "K"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Fahrenheit_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-359.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Fahrenheit_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.17), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Fahrenheit_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Ra"; + string targetUnitName = "F"; + Measurement expected = new Measurement (Convert.ToDouble(-459.67), "F"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Millikelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(55555.56), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Millikelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "mK"; + Measurement expected = new Measurement (Convert.ToDouble(277.78), "mK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Microkelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(55555555.56), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Microkelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "µK"; + Measurement expected = new Measurement (Convert.ToDouble(277777.78), "µK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_nK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(55555555555.56), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_nK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "nK"; + Measurement expected = new Measurement (Convert.ToDouble(277777777.78), "nK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_kK_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.055555555555556), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_kK_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "kK"; + Measurement expected = new Measurement (Convert.ToDouble(0.000277777777778), "kK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Megakelvin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(5.5555555556E-05), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Megakelvin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "MK"; + Measurement expected = new Measurement (Convert.ToDouble(2.77777778E-07), "MK"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Celsius_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-217.59), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Celsius_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-272.87), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Celsius_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Ra"; + string targetUnitName = "C"; + Measurement expected = new Measurement (Convert.ToDouble(-273.15), "C"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Reaumur_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Ra"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-174.08), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Reaumur_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.5); + string currentUnitName = "Ra"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.3), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Rankine_to_Reaumur_Test3 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0); + string currentUnitName = "Ra"; + string targetUnitName = "Re"; + Measurement expected = new Measurement (Convert.ToDouble(-218.52), "Re"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #endregion + #region "Mass Tests" + #region "Source as kg" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.110231131092439), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.001102311309822), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(15.747304441777), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(0.157473044260297), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.20462262184878), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(0.022046226196442), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(220.462262184878), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2.20462261964415), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3527.39619495804), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kg_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(35.2739619143064), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as g" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.000110231131092), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.10231131E-06), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(0.015747304441777), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(0.00015747304426), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(0.002204622621849), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.2046226196E-05), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(0.220462262184878), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(0.002204622619644), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3.5273961949580408), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_g_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(0.035273961914306), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as mg" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Mg"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "Gg"); + //value 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "t"); + // value should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.10231131E-07), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.102311E-09), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(1.5747304442E-05), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(1.57473044E-07), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.204622622E-06), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.2046226E-08), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(0.000220462262185), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2.20462262E-06), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(0.003527396194958), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mg_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3.5273961914E-05), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as µg" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "Mg"); + //should be 0.000000000000099999999, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "Gg"); + //should be 0.00000000000000099999999, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "t"); + //value should be 0.000000000000999999999, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.10231E-10), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.102E-12), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(1.5747304E-08), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(1.57473E-10), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.204623E-09), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.2046E-11), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2.20462262E-07), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2.204623E-09), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3.527396195E-06), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µg_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3.5273962E-08), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as ng" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "kg"); + //value should be 0.000000000000999999999, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "g"); + //value should be 0.000000000999999999, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "Mg"); + //should be 0.000000000000000999999999, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0), "Gg"); + //value should be 0.0000000000000001, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.0), "Gg"); + //value should be 9.99999999E-19, .net rounds at 15 total digits + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.1E-13), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(1.5747E-11), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(1.57E-13), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.205E-12), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2.2E-14), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2.20462E-10), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2.205E-12), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ng"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3.527396E-09), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ng_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ng"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3.5274E-11), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Megagram" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagrams_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(100), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagrams_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.999999999), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(110.231131092439), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.10231130982208), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(15747.304441777), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(157.473044260297), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2204.62262184878), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(22.0462261964415), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(220462.262184878), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2204.62261964415), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3527396.194958), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megagram_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(35273.961914306), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Gigagram" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000.0), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(1E+20), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(110231.131092439), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1102.31130982208), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(15747304.441777), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(157473.044260297), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2204622.62184878), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(22046.2261964415), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(220462262.184878), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2204622.61964415), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3527396194.95804), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gg_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gg"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(35273961.9143064), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Tonnes" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_Megagrams_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(100), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_Megagrams_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.999999999), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(110.231131092439), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(1.10231130982208), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(2204.62262184878), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(22.0462261964415), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(15747.304441777), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(157.473044260297), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(220462.262184878), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(2204.62261964415), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "t"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3527396.194958), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonne_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "t"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(35273.961914306), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Tons" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(90718.474), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(907.184739092815), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(90718474000L), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(907184739.092815), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(90718474), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(907184.739092815), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(90718474000000.0), "µg"); + //should be 90718474000000, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(907184739092.815), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(90718474000000016L), "ng"); + //should be 90718474000000000, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(907184739092815.0), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_Megagrams_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(90.718474), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_Megagrams_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.907184739092815), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.090718474), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000907184739093), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(90.718474), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.907184739092815), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(200000), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(1999.999998), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ton"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(3200000), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ton_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ton"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(31999.999968), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Stone" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(635.029318), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(6.35029317364971), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(635029.318), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(6350.29317364971), "g"); + //actual value 6350.29318, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(635029318.0), "mg"); + //actual value 635029318, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(6350293.17364971), "mg"); + //actual value 6350293.1736, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(635029318000L), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(6350293173.64971), "µg"); + //actual value 6350293173.6, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(635029318000000L), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(6350293173649.71), "ng"); + //actual value 6350293173600, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.635029318), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.00635029317365), "Mg"); + //actual value .006350293173600, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000635029318), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(6.350293174E-06), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.635029318), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.00635029317365), "t"); + //actual value 0.006350293, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.7), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.006999999993), "ton"); + //should be 0.007, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(14), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(0.13999999986), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(1400), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(13.999999986), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "st"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(22400), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_stone_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "st"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(223.999999776), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as CWT" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(4535.9237), "kg"); + // actual value 4535.9237, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(45.3592369546408), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(4535923700L), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(45359236.9546408), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(4535923.7), "g"); + //should be 4535923.7, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(45359.2369546408), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + + //var d = Math.(expected.Value); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(4535923700000.0), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(45359236954.640762), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(4.5359237E+15), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(45359236954640.8), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(4.5359237), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.045359236954641), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(0.0045359237), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(4.5359236955E-05), "Gg"); + //actual value 0.000045359, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(4.5359237), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.045359236954641), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(5), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.04999999995), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(714.285714285714), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(7.14285713571429), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(10000), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(99.9999999), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cwt"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(160000), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cwt_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cwt"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(1599.9999984), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Pound" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(45.359237), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(0.453592369546408), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(45359.237), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(453.592369546408), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(45359237), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(453592.369546408), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(45359237000.0), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(453592369.546408), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(45359237000000.0), "ng"); + //should be 45359237000000, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(453592369546.41), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.045359237), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.000453592369546), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(4.5359237E-05), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(4.5359237E-07), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.045359237), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.000453592369546), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.05), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.0004999999995), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(7.14285714285714), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(0.071428571357143), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(1), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(0.00999999999), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_oz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(1600), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lb_to_oz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb"; + string targetUnitName = "oz"; + Measurement expected = new Measurement (Convert.ToDouble(15.999999984), "oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Ounce" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_kg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(2.8349523125), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_kg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "kg"; + Measurement expected = new Measurement (Convert.ToDouble(0.02834952309665), "kg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_g_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(2834.9523125), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_g_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "g"; + Measurement expected = new Measurement (Convert.ToDouble(28.3495230966505), "g"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_mg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(2834952.3125), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_mg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "mg"; + Measurement expected = new Measurement (Convert.ToDouble(28349.5230966505), "mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_µg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(2834952312.5), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_µg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "µg"; + Measurement expected = new Measurement (Convert.ToDouble(28349523.0966505), "µg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(2834952312500.0), "ng"); + //should be 2834952312500, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_ng_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "ng"; + Measurement expected = new Measurement (Convert.ToDouble(28349523096.6505), "ng"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_Megagram_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(0.0028349523125), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_Megagram_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "Mg"; + Measurement expected = new Measurement (Convert.ToDouble(2.8349523097E-05), "Mg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_Gg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(2.834952313E-06), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_Gg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "Gg"; + Measurement expected = new Measurement (Convert.ToDouble(2.8349523E-08), "Gg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_tonne_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(0.0028349523125), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_tonne_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "t"; + Measurement expected = new Measurement (Convert.ToDouble(2.8349523097E-05), "t"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_ton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(0.003125), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_ton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "ton"; + Measurement expected = new Measurement (Convert.ToDouble(3.1249999969E-05), "ton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_stone_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(0.446428571428571), "st"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_stone_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "st"; + Measurement expected = new Measurement (Convert.ToDouble(0.004464285709821), "st"); + //UK stone; US stone 0.005 + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_cwt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(0.0625), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_cwt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "cwt"; + Measurement expected = new Measurement (Convert.ToDouble(0.000624999999375), "cwt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_lb_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "oz"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(6.25), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_oz_to_lb_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "oz"; + string targetUnitName = "lb"; + Measurement expected = new Measurement (Convert.ToDouble(0.0624999999375), "lb"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #endregion + #region "Time Tests" + #region "Source as Seconds" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_min_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "s"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(1.66666666666667), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_min_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "s"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(0.01666666665), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_hr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "s"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(0.027777777777778), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_hr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "s"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(0.0002777777775), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_ms_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "s"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_ms_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "s"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_day_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "s"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(0.001157407407407), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_day_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "s"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(1.1574074062E-05), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_wk_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "s"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(0.000165343915344), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_sec_to_wk_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "s"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(1.653439152E-06), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Minutes" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_sec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "min"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(6000), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_sec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "min"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(59.99999994), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_hr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "min"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(1.66666666666667), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_hr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "min"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(0.01666666665), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_ms_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "min"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(6000000), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_ms_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "min"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(59999.99994), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_day_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "min"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(0.069444444444444), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_day_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "min"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(0.00069444444375), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_wk_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "min"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(0.009920634920635), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_min_to_wk_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "min"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(9.9206349107E-05), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Hours" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_sec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hr"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(360000), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_sec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hr"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(3599.9999964), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_min_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hr"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(6000), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_min_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hr"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(59.99999994), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_ms_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hr"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(360000000), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_ms_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hr"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(3599999.9964), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_day_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hr"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(4.16666666666667), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_day_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hr"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(0.041666666625), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_wk_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hr"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(0.595238095238095), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_hr_to_wk_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hr"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(0.005952380946429), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Milliseconds" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_sec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ms"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_sec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ms"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_min_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ms"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(0.001666666666667), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_min_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ms"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(1.666666665E-05), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_hr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ms"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(2.7777777778E-05), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_hr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ms"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(2.77777778E-07), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_day_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ms"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(1.157407407E-06), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_day_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ms"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(1.1574074E-08), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_wk_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ms"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(1.65343915E-07), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ms_to_wk_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ms"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(1.653439E-09), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Days" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_sec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "d"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(8640000), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_sec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "d"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(86399.9999136), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_min_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "d"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(144000), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_min_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "d"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(1439.99999856), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_hr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "d"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(2400), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_hr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "d"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(23.999999976), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_ms_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "d"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(8640000000L), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_ms_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "d"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(86399999.9136), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_wk_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "d"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(14.2857142857143), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_day_to_wk_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "d"; + string targetUnitName = "wk"; + Measurement expected = new Measurement (Convert.ToDouble(0.142857142714286), "wk"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #region "Source as Weeks" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_sec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "wk"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(60480000), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_sec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "wk"; + string targetUnitName = "s"; + Measurement expected = new Measurement (Convert.ToDouble(604799.9993952), "s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_min_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "wk"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(1008000), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_min_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "wk"; + string targetUnitName = "min"; + Measurement expected = new Measurement (Convert.ToDouble(10079.99998992), "min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_hr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "wk"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(16800), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_hr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "wk"; + string targetUnitName = "hr"; + Measurement expected = new Measurement (Convert.ToDouble(167.999999832), "hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_ms_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "wk"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(60480000000L), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_ms_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "wk"; + string targetUnitName = "ms"; + Measurement expected = new Measurement (Convert.ToDouble(604799999.3952), "ms"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_day_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "wk"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(700), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_wk_to_day_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "wk"; + string targetUnitName = "d"; + Measurement expected = new Measurement (Convert.ToDouble(6.999999993), "d"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #endregion + #endregion + } +} \ No newline at end of file diff --git a/Cubico.Tests/UnitConverterTest2.cs b/Cubico.Tests/UnitConverterTest2.cs new file mode 100644 index 0000000..d9014d7 --- /dev/null +++ b/Cubico.Tests/UnitConverterTest2.cs @@ -0,0 +1,10136 @@ +using System; +using NUnit.Framework; +using Cubico; + +namespace Cubico.Tests +{ + [TestFixture] + public class UnitConverterTest2 + { + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "UnitConverter.ConvertUnits" + #region "Force Tests" + #region "Source as Newton (N)" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(10000000.0), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(99999.9999), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(22.4808943099999), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(0.22480894287519), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(0.011240447154986), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(0.000112404471437), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(0.010197162129779), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(0.000101971621196), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(9.99999999E-07), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "GN"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "N"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000.0), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_N_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "N"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Dyne (dyn)" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(0.001), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-06), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(0.0002248089431), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(2.248089429E-06), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.12404472E-07), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.124045E-09), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(1.019716E-09), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-11), "Meganewton"); + //should be 0.00000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-14), "GN"); + //should be 0.00000000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-06), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(1), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(0.00999999999), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(1000), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "dyn"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_dyn_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "dyn"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(1000000), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + #endregion + + #region "Source as Pound-force (lbf)" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(444.82216152548), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(4.44822161080658), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(44482216.152548), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(444822.161080658), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(0.05), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(0.0004999999995), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(0.045359236999934), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(0.000453592369546), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.000444822161525), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(4.448221611E-06), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(4.44822162E-07), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(4.448222E-09), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(0.44482216152548), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(0.004448221610807), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(444822.16152548), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(4448.22161080658), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(444822161.52548), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(4448221.61080658), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lbf"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(444822161525.48), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbf_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lbf"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(4448221610.80658), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Ton-force(short) (tonf)" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(889644.3230521), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(8896.44322162456), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(88964432305.21), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(889644322.162456), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(200000), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(1999.999998), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(90.718474), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(0.907184739092815), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.8896443230521), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.008896443221625), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(0.000889644323052), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(8.896443222E-06), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(889.6443230521), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(8.89644322162456), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(889644323.0521), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(8896443221.62456), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonf"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(889644323052100L), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonf_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonf"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(8896443221624.56), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Tonnes force(metric) (tonnef,tf)" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(980665), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(98066500000.0), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonnef"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(980664999.019335), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(220462.2621852), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonnef"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.10231130982208), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.980665), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonnef"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.009806649990193), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(0.000980665), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonnef"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(9.80664999E-06), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(980.665), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonnef"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(9.80664999019335), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(980665000), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonnef"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(9806649.99019335), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "tonnef"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(980665000000.0), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(9806649990.19335), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_tonnef_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "tonnef"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(9806649990193.35), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Meganewton (MN)" + + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(10000000000000.0), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(99999999900.0), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(22480894.3099999), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(224808.94287519), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(11240.4471549855), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(112.404471437451), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(10197.1621297793), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(101.971621195821), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999.0), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000.0), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000.0), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Meganewton"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(1E+17), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Meganewton_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Meganewton"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000.0), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Giganewton (GN)" + + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000.0), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(1E+16), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(99999999900000.0), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(22480894309.9999), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(224808942.87519), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(11240447.154986), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(112404.471437456), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_ng_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(10197162.1297793), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(101971.621195821), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000.0), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000.0), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(1E+17), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000.0), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(1E+20), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GN_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E+17), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Kilonewton (kN)" + + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(10000000000L), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(99999999.9), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(22480.8943099999), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(224.80894287519), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(11.2404471549855), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(0.112404471437451), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(10.1971621297793), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(0.101971621195821), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000.0), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000.0), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kN_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000.0), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Milinewton (mN)" + + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(10000), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(99.9999999), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(0.02248089431), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(0.000224808942875), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.1240447155E-05), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.12404471E-07), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(1.019716213E-05), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Meganewton"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "GN"); + //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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mN_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Micronewton (µN)" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(10), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(0.0999999999), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(2.24808943E-07), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.1240447E-08), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(1.0197162E-08), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(1.01972E-10), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "GN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "GN"); + //should be 0.000000000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "kN"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_nN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µN_to_nN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µN"; + string targetUnitName = "nN"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "nN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Nananewton (nN)" + + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_N_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "N"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_N_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "N"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "N"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_dyn_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(0.01), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_dyn_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "dyn"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-05), "dyn"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_lbf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(2.2480894E-08), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_lbf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "lbf"; + Measurement expected = new Measurement (Convert.ToDouble(2.24809E-10), "lbf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_tonf_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.124E-11), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_tonf_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "tonf"; + Measurement expected = new Measurement (Convert.ToDouble(1.12E-13), "tonf"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_tonnef_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(1.0197E-11), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_tonnef_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "tonnef"; + Measurement expected = new Measurement (Convert.ToDouble(1.02E-13), "tonnef"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_Meganewton_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "Meganewton"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_Meganewton_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "Meganewton"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "Meganewton"); + //should be 0.000000000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_GN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(0), "GN"); + //should be .0000000000000001, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_GN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "GN"; + Measurement expected = new Measurement (Convert.ToDouble(0), "GN"); + //should be 9.99999999E-19, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_kN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "kN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_kN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "kN"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "kN"); + //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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_mN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_mN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "mN"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "mN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_µN_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nN_to_µN_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nN"; + string targetUnitName = "µN"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "µN"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + + #region "Momentum Tests" + #region "Source as kg m/s" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMetersPerSec_to_lbFtPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg m/s"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(2603884.98643556), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMetersPerSec_to_lbFtPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg m/s"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(26038.8498383168), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMeterPerSec_to_GramCentimeterPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg m/s"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(10000000), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMeterPerSec_to_GramCentimeterPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg m/s"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(99999.9999), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg m/s"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(43398.0831072594), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg m/s"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(433.980830638613), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kg m/s"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(723.301385120989), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kg m/s"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(7.23301384397688), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as lb ft/hr" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_kgMetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.003840415399333), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_kgMetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(3.8404153955E-05), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_GramCentimeterPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(384.041539933333), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_GramCentimeterPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(3.84041539549292), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(1.66666666666667), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.01666666665), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.027777777777778), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/hr"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.0002777777775), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as g cm/s" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_kgMetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g cm/s"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.001), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_kgMetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g cm/s"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-06), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g cm/s"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(26.0388498643556), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g cm/s"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(0.260388498383168), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g cm/s"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.4339808310726), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g cm/s"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.004339808306386), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "g cm/s"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.0072330138512), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "g cm/s"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(7.233013844E-05), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as lb ft/min" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_kgMetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/min"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.23042492396), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_kgMetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/min"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.002304249237296), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/min"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(6000), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/min"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(59.99999994), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_GramCentimeterPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/min"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(23042.4923959997), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_GramCentimeterPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/min"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(230.424923729572), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/min"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(1.66666666666667), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/min"; + string targetUnitName = "lb ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.01666666665), "lb ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as lb ft/sec" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_kgMetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/s"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(13.8254954376), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_kgMetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/s"; + string targetUnitName = "kg m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.138254954237745), "kg m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/s"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(360000), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/s"; + string targetUnitName = "lb ft/hr"; + Measurement expected = new Measurement (Convert.ToDouble(3599.9999964), "lb ft/hr"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_GramCentimeterPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/s"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(1382549.54376189), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_GramCentimeterPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/s"; + string targetUnitName = "g cm/s"; + Measurement expected = new Measurement (Convert.ToDouble(13825.4954237934), "g cm/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "lb ft/s"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(6000), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "lb ft/s"; + string targetUnitName = "lb ft/min"; + Measurement expected = new Measurement (Convert.ToDouble(59.99999994), "lb ft/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + + #region "Speed Tests" + #region "Source as Meters/Second" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_KmPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/s"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(360), "km/h"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_KmPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/s"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(3.5999999964), "km/h"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_MilesPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/s"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(223.69362920544), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_MilesPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/s"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(2.23693628981747), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_MetersPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/s"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(6000), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_MetersPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/s"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(59.99999994), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_FtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/s"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(328.083989501312), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerSec_to_FtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/s"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(3.28083989173228), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Kilometers/Hour" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km/h"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(27.7777777777778), "m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km/h"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.2777777775), "m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_MilesPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km/h"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(62.1371192237334), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_MilesPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km/h"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(0.621371191615963), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km/h"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(1666.66666666667), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km/h"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(16.66666665), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_FtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km/h"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(91.1344415281423), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_KmPerHr_to_FtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km/h"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.911344414370079), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Miles/Hour" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mph"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(44.704), "m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mph"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.44703999955296), "m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_KmPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mph"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(160.9344), "km/h"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_KmPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mph"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(1.60934399839066), "km/h"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mph"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(2682.24), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mph"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(26.8223999731776), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_FtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mph"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(146.666666666667), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MilesPerHr_to_FtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mph"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(1.4666666652), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Meters/Minute" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_MetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/min"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(1.66666666666667), "m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_MetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/min"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.01666666665), "m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_KmPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/min"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(6), "km/h"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_KmPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/min"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(0.05999999994), "km/h"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_MilesPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/min"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(3.728227153424), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_MilesPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/min"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(0.037282271496958), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_FtPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m/min"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(5.46806649168854), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_MetersPerMin_to_FtPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m/min"; + string targetUnitName = "ft/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.054680664862205), "ft/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Feet/Second" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerSec_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft/s"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(30.48), "m/s"); + //should be 30.48, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerSec_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft/s"; + string targetUnitName = "m/s"; + Measurement expected = new Measurement (Convert.ToDouble(0.3047999996952), "m/s"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_KmPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft/s"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(109.728), "km/h"); + //should be 109.728, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_KmPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft/s"; + string targetUnitName = "km/h"; + Measurement expected = new Measurement (Convert.ToDouble(1.09727999890272), "km/h"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_MilesPerHr_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft/s"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(68.1818181818182), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_MilesPerHr_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft/s"; + string targetUnitName = "mph"; + Measurement expected = new Measurement (Convert.ToDouble(0.681818181136364), "mph"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft/s"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(1828.8), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft/s"; + string targetUnitName = "m/min"; + Measurement expected = new Measurement (Convert.ToDouble(18.287999981712), "m/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + + #region "Length Tests" + #region "Source as Metres" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(109.361329833771), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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.0936132972441), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(328.083989501312), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + Assert.AreEqual (Result.NoError, actual.ConversionResult); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(3.28083989173228), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4.97096953789867), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.049709695329277), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(0.062137119223733), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.000621371191616), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(0.497096953789867), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.004970969532928), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(3937007.87401575), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(39370.0787007874), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(3937.00787401575), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(39.3700787007874), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(10000), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(99.9999999), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Yards" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.9143999990856), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(300), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(2.999999997), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4.54545454545455), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.045454545409091), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.056818181818182), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.000568181817614), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.09144), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.000914399999086), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(9.14399999E-07), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(9.144E-08), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(9.144E-10), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.454545454545454), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(3600000), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(35999.999964), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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(91440000), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(914399.9990856), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(3600), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(35.999999964), "in"); + //expected altered to meet .net conversion bug (35.999999964) + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(9144), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(91.43999990856), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(91440), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + #endregion + + #region "Source as Feet" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(30.48), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.3047999996952), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_m_negative_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (-0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(-0.3047999996952), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(33.3333333333333), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(0.333333333), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(1.51515151515151), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.015151515136364), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.018939393939394), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.000189393939205), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.03048), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.000304799999695), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(3.048E-05), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(3.048E-07), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(3.048E-08), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(3.048E-10), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.151515151515152), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.001515151513636), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(1200000), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(11999.999988), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(30480000), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(304799.9996952), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(1200), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(11.999999988), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(3048), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(30.47999996952), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(30480), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(304.7999996952), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Chain" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(2011.68), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(20.1167999798832), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(2200), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(21.999999978), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(1.25), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.0124999999875), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(2.01168), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.020116799979883), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.00201168), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(2.011679998E-05), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.01168E-06), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.01168E-08), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(10), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.0999999999), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(79200000), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(791999.999208), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(2011680000), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(20116799.979883), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(79200), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(791.999999208), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(201168), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "chain"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(2011680), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_chain_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "chain"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(20116.7999798832), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Miles" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(160934.4), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(1609.34399839066), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(176000), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(1759.99999824), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(528000), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(5279.99999472), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(8000), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(79.99999992), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(160.9344), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(1.60934399839066), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.1609344), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.001609343998391), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001609344), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1.609343998E-06), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(800), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(7.999999992), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(6336000000L), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(63359999.93664), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(160934400000L), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(1609343998.391), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(6336000), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(63359.99993664), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(16093440), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(160934.399839066), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(160934400), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_miles_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(1609343.998391), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Kilometres" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(109361.329833771), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(1093.61329724409), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(328083.989501312), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(3280.83989173228), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4970.96953789867), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(49.709695329277), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_miles_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(62.1371192237334), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_miles_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.621371191615963), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(497.096953789867), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(4.9709695329277), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(3937007874.01575), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(39370078.7007874), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(3937007.87401575), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(39370.0787007874), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(10000000), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(99999.9999), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Megametres" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(109361329.833771), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(1093613.29724409), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(328083989.501312), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(3280839.89173228), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4970969.53789867), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(49709.695329277), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_miles_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(62137.1192237334), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_miles_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(621.371191615963), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(497096.953789867), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(4970.9695329277), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(3937007874015.75), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(39370078700.7874), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(3937007874.01575), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(39370078.7007874), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(10000000000L), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(99999999.9), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Mm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megametres_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Mm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Gigametres" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(109361329833.771), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(1093613297.24409), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(328083989501.312), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(3280839891.73228), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4970969537.89867), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(49709695.329277), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_miles_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(62137119.2237334), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_miles_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(621371.191615963), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gms_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(497096953.789867), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(4970969.5329277), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(3937007874015748L), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(39370078700787.4), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000000L), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000L), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(3937007874015.75), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(39370078700.7874), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(10000000000000L), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(99999999900L), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gm_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Furlongs" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(20116.8), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(201.167999798832), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(22000), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(219.99999978), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(66000), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(659.99999934), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(12.5), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.124999999875), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(20.1168), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.201167999798832), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.0201168), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.000201167999799), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.01168E-05), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.01168E-07), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(1000), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(792000000), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(7919999.99208), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(20116800000L), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(201167999.799), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(792000), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(7919.99999208), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(2011680), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(20116.7999798832), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "furlong"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(20116800), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_furlong_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "furlong"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(201167.999799), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Thou" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.00254), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(2.5399999975E-05), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(0.002777777777778), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(2.777777775E-05), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(0.008333333333333), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(8.333333325E-05), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(1.578282828E-06), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(1.5782828E-08), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-06), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-08), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-09), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-11), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-12), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.5E-14), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.000126262626263), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(1.262626261E-06), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(2540), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(25.3999999746), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(1.2626262626E-05), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(1.26262626E-07), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "thou"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(0.254), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(0.00253999999746), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_thou_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "thou"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.0253999999746), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Microns" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(0.000109361329834), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(3.280839892E-06), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4.970969538E-06), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4.9709695E-08), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(6.21371E-10), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(4.97097E-09), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(3.93700787401575), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(0.003937007874016), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(3.9370078701E-05), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(0.01), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-05), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µm_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Inches" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(2.54), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.0253999999746), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(2.77777777777778), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(0.02777777775), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(8.33333333333333), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(0.08333333325), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.001578282828283), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(1.5782828267E-05), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.00254), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(2.5399999975E-05), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-06), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-08), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-09), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(2.54E-11), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.126262626262626), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.001262626261364), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(2540000), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(25399.9999746), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.012626262626263), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.000126262626136), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(254), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(2.53999999746), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(2540), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(25.3999999746), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Centimetres" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(1), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.00999999999), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(1.09361329833771), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(0.010936132972441), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(3.280839895013123), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + Assert.AreEqual (Result.NoError, actual.ConversionResult); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(0.032808398917323), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.049709695378987), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.000497096953293), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(0.000621371192237), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(6.213711916E-06), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.001), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-06), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-06), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-08), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-11), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.004970969537899), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(4.9709695329E-05), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(39370.0787401575), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(393.700787007874), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(1000000), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(9999.99999), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(39.3700787401575), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(0.393700787007874), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_millimetres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(1000), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm_to_millimetres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm"; + string targetUnitName = "mm"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999), "mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Millimetres" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_m_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_m_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "m"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "m"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_yd_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(0.109361329833771), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_yd_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "yd"; + Measurement expected = new Measurement (Convert.ToDouble(0.001093613297244), "yd"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_ft_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(0.328083989501312), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + Assert.AreEqual (Result.NoError, actual.ConversionResult); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_ft_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "ft"; + Measurement expected = new Measurement (Convert.ToDouble(0.003280839891732), "ft"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_chain_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(0.004970969537899), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_chain_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "chain"; + Measurement expected = new Measurement (Convert.ToDouble(4.9709695329E-05), "chain"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_mile_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(6.2137119224E-05), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_mile_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "mi"; + Measurement expected = new Measurement (Convert.ToDouble(6.21371192E-07), "mi"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_km_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_km_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "km"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "km"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_Megametres_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_Megametres_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "Mm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Mm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_Gm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_Gm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "Gm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "Gm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_furlong_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(0.00049709695379), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_furlong_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "furlong"; + Measurement expected = new Measurement (Convert.ToDouble(4.970969533E-06), "furlong"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_thou_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(3937.00787401575), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_thou_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "thou"; + Measurement expected = new Measurement (Convert.ToDouble(39.3700787007874), "thou"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_µm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_µm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "µm"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "µm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_in_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(3.93700787401575), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_in_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "in"; + Measurement expected = new Measurement (Convert.ToDouble(0.039370078700787), "in"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_cm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(10), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_millimetres_to_cm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mm"; + string targetUnitName = "cm"; + Measurement expected = new Measurement (Convert.ToDouble(0.0999999999), "cm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + #endregion + } +} \ No newline at end of file diff --git a/Cubico.Tests/UnitConverterTest3.cs b/Cubico.Tests/UnitConverterTest3.cs new file mode 100644 index 0000000..0de3974 --- /dev/null +++ b/Cubico.Tests/UnitConverterTest3.cs @@ -0,0 +1,8670 @@ +using System; +using NUnit.Framework; +using Cubico; + +namespace Cubico.Tests +{ + [TestFixture] + public class UnitConverterTest3 + { + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "UnitConverter.ConvertUnits" + #region "Power Tests" + #region "Source as Watts" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Horsepower_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(0.134102208959503), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Horsepower_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(0.001341022088254), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Kilowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_MilliWatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_MilliWatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5.68690192748063), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.056869019217937), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "W"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(4425.37289566359), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Watts_to_FtLbPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "W"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(44.2537289123822), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Horsepower" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(74569.987158227), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(745.69987083657), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(0.074569987158227), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(0.000745699870837), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Kilowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(74.569987158227), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(0.74569987083657), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(74569987158.227), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(745699870.83657), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(74569987158227.0), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(745699870836.57), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_MilliWatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(74569987.158227), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_MilliWatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(745699.870836571), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(4240.72203702327), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(42.4072203278255), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "hp"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(3300000), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Horsepower_to_FtLbPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "hp"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(32999.999967), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Megawatts" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Horsepower_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(134102.208959503), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Horsepower_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(1341.02208825401), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Kilowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000000L), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000L), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_MilliWatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_MilliWatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5686901.92748063), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(56869.0192179373), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "MW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(4425372895.66359), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megawatts_to_FtLbPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "MW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(44253728.9123822), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Kilowatts" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Horsepower_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(134.102208959503), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Horsepower_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(1.34102208825401), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000L), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000L), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_MilliWatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_MilliWatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5686.90192748063), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(56.8690192179373), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(4425372.89566359), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Kilowatts_to_FtLbPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(44253.7289123822), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Microwatts" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Horsepower_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(1.34102209E-07), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Horsepower_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(1.341022E-09), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "MW"); + //should be 0.000000000000999999999, can only round to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_kikowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "kW"); + //should be 0.000000000999999999, can only round to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Milliwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_Milliwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5.686901927E-06), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5.6869019E-08), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.004425372895664), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Microwatts_to_FtLbPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(4.4253728912E-05), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Nanowatts" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "W"); + //should be 0.000000000999999999, can only round to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Horsepower_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(1.34102E-10), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Horsepower_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(1.341E-12), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "MW"); + //should be 0.000000000000000999999999, can only round to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Kilowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "kW"); + //should be 0.000000000000999999999, can only round to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Milliwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_Milliwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5.686902E-09), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5.6869E-11), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(4.425372896E-06), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Nanowatts_to_FtLbPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(4.4253729E-08), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Milliwatts" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Horsepower_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(0.00013410220896), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Horsepower_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(1.341022088E-06), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "MW"); + //should be 0.000000000999999999, can only round to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Kilowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.005686901927481), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(5.6869019218E-05), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(4.42537289566359), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Milliwatts_to_FtLbPerMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mW"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.044253728912382), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as BTU/min" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "BTU/min"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(1758.42666666667), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "BTU/min"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(17.5842666490824), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "BTU/min"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(0.001758426666667), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "BTU/min"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(1.7584266649E-05), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Kilowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "BTU/min"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(1.75842666666667), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "BTU/min"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(0.017584266649082), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "BTU/min"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(1758426666.66667), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "BTU/min"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(17584266.6490824), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "BTU/min"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(1758426666666.67), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "BTU/min"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(17584266649.0824), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Milliwatts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "BTU/min"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(1758426.66666667), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_Milliwatts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "BTU/min"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(17584.2666490824), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_BTUperMin_to_FtLbPerMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "BTU/min"; + string targetUnitName = "ft lb/min"; + Measurement expected = new Measurement (Convert.ToDouble(77816.9370967875), "ft lb/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + 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); + } + #endregion + + #region "Source as ft lb/min" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Watts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(2.25969658055233), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Watts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "W"; + Measurement expected = new Measurement (Convert.ToDouble(0.022596965782926), "W"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Horsepower_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(0.003030303030303), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Horsepower_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "hp"; + Measurement expected = new Measurement (Convert.ToDouble(3.0303030273E-05), "hp"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Megawatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(2.259696581E-06), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Megawatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "MW"; + Measurement expected = new Measurement (Convert.ToDouble(2.2596966E-08), "MW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Kilowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(0.002259696580552), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Kilowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "kW"; + Measurement expected = new Measurement (Convert.ToDouble(2.2596965783E-05), "kW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Microwatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(2259696.58055233), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Microwatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "µW"; + Measurement expected = new Measurement (Convert.ToDouble(22596.9657829264), "µW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Nanowatt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(2259696580.55233), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Nanowatt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "nW"; + Measurement expected = new Measurement (Convert.ToDouble(22596965.7829264), "nW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Milliwatts_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(2259.69658055233), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_Milliwatts_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "mW"; + Measurement expected = new Measurement (Convert.ToDouble(22.5969657829264), "mW"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_BTUperMin_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft lb/min"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.128506728394644), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_FtLbPerMin_to_BTUperMin_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft lb/min"; + string targetUnitName = "BTU/min"; + Measurement expected = new Measurement (Convert.ToDouble(0.001285067282661), "BTU/min"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + + #region "Energy Tests" + #region "Source as Joule" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1000000000), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(9999999.99), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(23.8845896627496), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(0.23884589638865), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(0.094781712031332), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(0.000947817119366), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.47816988E-07), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.47817E-09), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "GJ"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "J"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000.0), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_J_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "J"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Energy (erg)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(1E-05), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(2.388458966E-06), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(2.388459E-08), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.478171E-09), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.4782E-11), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.5E-14), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "therm"); + //should be 0.000000000000000947816987, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.01), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-05), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-11), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "Megajoule"); + //should be 0.0000000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-08), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "kJ"); + //should be 0.000000000099999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-14), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0), "GJ"); + //should be 9.99999999E-17, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(10), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.0999999999), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "erg"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(10000), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_erg_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "erg"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(99.9999999), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Calorie (cal)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(418.68), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(4.1867999958132), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(4186800000L), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(41867999.958132), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(0.396832071932955), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(0.003968320715361), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(3.968320165E-06), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(3.9683202E-08), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(418680), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(4186.7999958132), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(0.00041868), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(4.186799996E-06), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.41868), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.004186799995813), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(4.1868E-07), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(4.1868E-09), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(418680000), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(4186799.9958132), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cal"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(418680000000.0), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cal_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cal"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(4186799995.8132), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as British thermal unit (Btu)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(105505.585262), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(1055.05585156494), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1055055852620.0), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(10550558515.6494), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(25199.5761111), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(251.995760859004), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(0.001), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-06), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(105505585.262), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(1055055.85156494), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(0.105505585262), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(0.001055055851565), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(105.505585262), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(1.05505585156494), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.000105505585262), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1.055055852E-06), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(105505585262.0), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(1055055851.56494), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Btu"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(105505585262000.0), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Btu_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Btu"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(1055055851564.94), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Therm (therm)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(10550560000.0), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(105505599.894494), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1.055056E+17), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1055055998944944L), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(2519957963.1222), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(25199579.6060224), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(10000000), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(99999.9999), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(10550560000000.0), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(105505599894.494), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(10550.56), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(105.505599894494), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(10550560), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(105505.599894494), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(10.55056), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.105505599894494), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(1.055056E+16), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(105505599894494.0), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "therm"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(1.055056E+19), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_therm_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "therm"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(1.05505599894494E+17), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Millijoules (mJ)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "J"); + //actual value 0.001, .net bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1000000), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(9999.99999), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(0.02388458966275), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(0.000238845896389), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.4781712031E-05), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.47817119E-07), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.47817E-10), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.478E-12), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "Megajoule"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "GJ"); + //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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mJ_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Megajoules (MJ)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1E+15), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(9999999990000.0), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(23884589.6627496), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(238845.89638865), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(94781.7120313317), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(947.8171193655), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(0.947816987913438), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(0.009478169869656), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000.0), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000.0), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000.0), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Megajoule"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E+17), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Megajoule_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Megajoule"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000.0), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Kilojoules (kJ)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1000000000000.0), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(9999999990L), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(23884.5896627496), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(238.84589638865), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(94.7817120313317), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(0.9478171193655), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(0.000947816987913), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.47816987E-06), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000.0), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000.0), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kJ_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000.0), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Gigajoules (GJ)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000.0), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1E+18), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E+15), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(23884589662.75), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(238845896.388654), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(94781712.031332), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(947817.119365503), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(947.816987913438), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.47816986965621), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000000.0), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000.0), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E+17), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(999999999000000.0), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "GJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E+20), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_GJ_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "GJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E+17), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Microjoules (µJ)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1000), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(2.3884589663E-05), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(2.38845896E-07), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.4781712E-08), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.47817E-10), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9.48E-13), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(9E-15), "therm"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "Megajoule"); + //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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "kJ"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "GJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "GJ"); + //should be 0.000000000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_nJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µJ_to_nJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µJ"; + string targetUnitName = "nJ"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "nJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Nanojoules (nJ)" + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_J_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "J"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_J_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "J"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "J"); + //should be 0.000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_erg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(1), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_erg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "erg"; + Measurement expected = new Measurement (Convert.ToDouble(0.00999999999), "erg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_cal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(2.388459E-08), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_cal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "cal"; + Measurement expected = new Measurement (Convert.ToDouble(2.38846E-10), "cal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_Btu_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.4782E-11), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_Btu_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "Btu"; + Measurement expected = new Measurement (Convert.ToDouble(9.48E-13), "Btu"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_therm_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "therm"); + //should be 0.0000000000000009478169879, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_therm_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "therm"; + Measurement expected = new Measurement (Convert.ToDouble(0), "therm"); + //should be 9.47816987E-18, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_mJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_mJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "mJ"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "mJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_Megajoule_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-13), "Megajoule"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_Megajoule_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "Megajoule"; + Measurement expected = new Measurement (Convert.ToDouble(1E-15), "Megajoule"); + //should be 0.000000000000000999999999, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_kJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "kJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_kJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "kJ"; + Measurement expected = new Measurement (Convert.ToDouble(1E-12), "kJ"); + //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); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_GJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0), "GJ"); + //should be 0.0000000000000001, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_GJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "GJ"; + Measurement expected = new Measurement (Convert.ToDouble(0), "GJ"); + //should be 9.99999999E-19, .net rounds to 15 places + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_µJ_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "nJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_nJ_to_µJ_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "nJ"; + string targetUnitName = "µJ"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "µJ"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + + #region "Plane Angle Tests" + + #region "Source as Radians" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rad_to_deg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "rad"; + string targetUnitName = "deg"; + Measurement expected = new Measurement (Convert.ToDouble(5729.57795130823), "deg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rad_to_deg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "rad"; + string targetUnitName = "deg"; + Measurement expected = new Measurement (Convert.ToDouble(57.2957794557866), "deg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rad_to_grad_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "rad"; + string targetUnitName = "grad"; + Measurement expected = new Measurement (Convert.ToDouble(6366.19772367581), "grad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rad_to_grad_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "rad"; + string targetUnitName = "grad"; + Measurement expected = new Measurement (Convert.ToDouble(63.6619771730962), "grad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rad_to_rev_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "rad"; + string targetUnitName = "rev"; + Measurement expected = new Measurement (Convert.ToDouble(15.915494309), "rev"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rad_to_rev_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "rad"; + string targetUnitName = "rev"; + Measurement expected = new Measurement (Convert.ToDouble(0.159154942930845), "rev"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Degrees" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_deg_to_rad_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "deg"; + string targetUnitName = "rad"; + Measurement expected = new Measurement (Convert.ToDouble(1.74532925199433), "rad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_deg_to_rad_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "deg"; + string targetUnitName = "rad"; + Measurement expected = new Measurement (Convert.ToDouble(0.01745329250249), "rad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_deg_to_grad_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "deg"; + string targetUnitName = "grad"; + Measurement expected = new Measurement (Convert.ToDouble(111.111111111111), "grad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_deg_to_grad_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "deg"; + string targetUnitName = "grad"; + Measurement expected = new Measurement (Convert.ToDouble(1.11111111), "grad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_deg_to_rev_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "deg"; + string targetUnitName = "rev"; + Measurement expected = new Measurement (Convert.ToDouble(0.277777777777778), "rev"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_deg_to_rev_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "deg"; + string targetUnitName = "rev"; + Measurement expected = new Measurement (Convert.ToDouble(0.002777777775), "rev"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Gradians" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_grad_to_rad_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "grad"; + string targetUnitName = "rad"; + Measurement expected = new Measurement (Convert.ToDouble(1.5707963267949), "rad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_grad_to_rad_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "grad"; + string targetUnitName = "rad"; + Measurement expected = new Measurement (Convert.ToDouble(0.015707963252241), "rad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_grad_to_deg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "grad"; + string targetUnitName = "deg"; + Measurement expected = new Measurement (Convert.ToDouble(90), "deg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_grad_to_deg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "grad"; + string targetUnitName = "deg"; + Measurement expected = new Measurement (Convert.ToDouble(0.8999999991), "deg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_grad_to_rev_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "grad"; + string targetUnitName = "rev"; + Measurement expected = new Measurement (Convert.ToDouble(0.25), "rev"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_grad_to_rev_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "grad"; + string targetUnitName = "rev"; + Measurement expected = new Measurement (Convert.ToDouble(0.0024999999975), "rev"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Revolutions" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rev_to_rad_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "rev"; + string targetUnitName = "rad"; + Measurement expected = new Measurement (Convert.ToDouble(628.318530725441), "rad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rev_to_rad_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "rev"; + string targetUnitName = "rad"; + Measurement expected = new Measurement (Convert.ToDouble(6.28318530097123), "rad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rev_to_deg_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "rev"; + string targetUnitName = "deg"; + Measurement expected = new Measurement (Convert.ToDouble(36000), "deg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rev_to_deg_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "rev"; + string targetUnitName = "deg"; + Measurement expected = new Measurement (Convert.ToDouble(359.99999964), "deg"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rev_to_grad_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "rev"; + string targetUnitName = "grad"; + Measurement expected = new Measurement (Convert.ToDouble(40000), "grad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_rev_to_grad_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "rev"; + string targetUnitName = "grad"; + Measurement expected = new Measurement (Convert.ToDouble(399.9999996), "grad"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #endregion + + #region "Volume Tests" + #region "Source as Cubic Inches" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.05787037037037), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.000578703703125), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.002143347050754), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(2.1433470486E-05), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.0016387064), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(1.6387063984E-05), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(1638.7064), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(16.387063983613), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(1.6387064), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(0.016387063983613), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(55.4112554112554), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(0.554112553558442), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.432900432900433), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.004329004324675), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(3.46320346320346), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(0.034632034597403), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(1.73160173160173), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in3_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(0.017316017298701), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Cubic Feet" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(172800), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(1727.999998272), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(3.7037037037037), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.037037037), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(2.8316846592), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.028316846563683), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(2831684.6592), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(28316.8465636832), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(2831.6846592), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(28.3168465636832), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(95750.6493506493), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(957.506492548987), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(748.051948051948), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(7.48051947303896), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(5984.41558441558), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(59.8441557843117), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(2992.20779220779), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft3_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(29.9220778921558), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Cubic Yards" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(4665600), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(46655.999953344), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(2700), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(26.999999973), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(76.4554857984), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.764554857219445), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(76455485.7984), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(764554.857219445), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(76455.4857984), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(764.554857219445), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(2585267.53246753), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(25852.6752988226), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(20197.4025974026), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(201.974025772052), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(161579.220779221), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(1615.79220617642), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(80789.6103896104), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd3_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(807.896103088208), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Cubic Meters" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(6102374.40947323), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(61023.7440337085), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(3531.46667214886), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(35.3146666861739), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(130.795061931439), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(1.30795061800644), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(3381402.2701843), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(33814.022668029), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(26417.2052358148), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(264.172052093976), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(211337.641886519), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(2113.37641675181), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(105668.820943259), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m3_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m3"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(1056.68820837591), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Cubic Centimeters" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(6.10237440947323), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(0.061023744033709), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.003531466672149), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(3.5314666686E-05), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.000130795061931), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(1.307950618E-06), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(3.3814022701843), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(0.033814022668029), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.026417205235815), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.000264172052094), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(0.211337641886519), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(0.002113376416752), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cc"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(0.105668820943259), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cc_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cc"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(0.001056688208376), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Liters" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(6102.37440947323), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(61.0237440337085), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(3.53146667214886), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.035314666686174), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.130795061931439), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.001307950618006), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(3381.4022701843), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(33.814022668029), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(26.4172052358148), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.264172052093976), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(211.337641886519), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(2.11337641675181), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "L"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(105.668820943259), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_L_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "L"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(1.05668820837591), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Fluid Ounces" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(180.46875), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(1.80468749819531), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.104437934027778), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.001044379339233), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.003868071630658), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(3.8680716268E-05), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.00295735295625), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(2.9573529533E-05), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(2957.35295625), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(29.5735295329265), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(2.95735295625), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(0.029573529532926), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.78125), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.007812499992188), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(6.25), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(0.0624999999375), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "fl oz"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(3.125), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_floz_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "fl oz"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(0.03124999996875), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Gallons" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(23100), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(230.999999769), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(13.3680555555556), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.133680555421875), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.49511316872428), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.004951131682292), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.3785411784), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.003785411780215), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(378541.1784), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(3785.41178021459), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(378.5411784), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(3.78541178021459), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(12800), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(127.999999872), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(800), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(7.999999992), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "gal"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(400), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_gal_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "gal"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(3.999999996), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Pints" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(2887.5), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(28.874999971125), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(1.67100694444444), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.016710069427734), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.061889146090535), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.000618891460286), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.0473176473), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.000473176472527), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(47317.6473), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(473.176472526824), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(47.3176473), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(0.473176472526824), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(1600), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(15.999999984), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(12.5), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.124999999875), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_qt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "pt"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(50), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_pt_to_qt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "pt"; + string targetUnitName = "qt"; + Measurement expected = new Measurement (Convert.ToDouble(0.4999999995), "qt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Quarts" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_in3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(5775), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_in3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "in3"; + Measurement expected = new Measurement (Convert.ToDouble(57.74999994225), "in3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_ft3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(3.34201388888889), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_ft3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "ft3"; + Measurement expected = new Measurement (Convert.ToDouble(0.033420138855469), "ft3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_yd3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.12377829218107), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_yd3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "yd3"; + Measurement expected = new Measurement (Convert.ToDouble(0.001237782920573), "yd3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_m3_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.0946352946), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_m3_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "m3"; + Measurement expected = new Measurement (Convert.ToDouble(0.000946352945054), "m3"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_cc_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(94635.2946), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_cc_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "cc"; + Measurement expected = new Measurement (Convert.ToDouble(946.352945053647), "cc"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_L_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(94.6352946), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_L_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "L"; + Measurement expected = new Measurement (Convert.ToDouble(0.946352945053647), "L"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_floz_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(3200), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_floz_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "fl oz"; + Measurement expected = new Measurement (Convert.ToDouble(31.999999968), "fl oz"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_gal_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(25), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_gal_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "gal"; + Measurement expected = new Measurement (Convert.ToDouble(0.24999999975), "gal"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_pt_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "qt"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(200), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_qt_to_pt_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "qt"; + string targetUnitName = "pt"; + Measurement expected = new Measurement (Convert.ToDouble(1.999999998), "pt"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + #endregion + } +} diff --git a/Cubico.Tests/UnitConverterTest4.cs b/Cubico.Tests/UnitConverterTest4.cs new file mode 100644 index 0000000..37fa844 --- /dev/null +++ b/Cubico.Tests/UnitConverterTest4.cs @@ -0,0 +1,2919 @@ +using System; +using NUnit.Framework; +using Cubico; + +namespace Cubico.Tests +{ + [TestFixture] + public class UnitConverterTest4 + { + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "UnitConverter.ConvertUnits" + #region "Area Tests" + #region "Source as Square Meters" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(1076.39104167097), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(10.7639104059458), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.8610215854E-05), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.86102158E-07), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(0.024710538146717), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(0.00024710538122), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(155000.31000062), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(1550.0030984562), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(1000000), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(9999.99999), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(119.599004630108), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(1.19599004510509), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "m2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(0.01), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_m2_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "m2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-05), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Square Feet" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(9.290304), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(0.092903039907097), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.587006428E-06), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.5870064E-08), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(0.002295684113866), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(2.2956841116E-05), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(14400), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(143.999999856), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(92903.04), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(929.03039907097), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(11.1111111111111), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(0.111111111), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(9.290304E-06), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(9.290304E-08), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ft2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(0.0009290304), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ft2_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ft2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(9.290303991E-06), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Square Miles" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(258998811.0336), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(2589988.10774601), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(2787840000L), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(27878399.9721216), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(64000), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(639.99999936), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(401448960000L), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(4014489595.98551), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(2589988110336L), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(25899881077.46), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(309760000), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(3097599.9969024), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(258.9988110336), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(2.589988107746), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mi2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(25899.88110336), "ha"); + //should be 25899.88110336, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mi2_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mi2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(258.998810774601), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Acres" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(404685.64224), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(4046.85641835314), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(4356000), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(43559.99995644), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(0.15625), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(0.001562499998438), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(627264000), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(6272639.99372736), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(4046856422.4), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(40468564.1835314), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(484000), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(4839.99999516), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(0.40468564224), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(0.004046856418353), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "acre"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(40.468564224), "ha"); + //should be 40.468564224, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_acre_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "acre"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(0.404685641835314), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Square Inches" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(0.064516), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(0.000645159999355), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(0.694444444444444), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(0.0069444444375), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(2.4909767E-08), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(2.49098E-10), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(1.5942250791E-05), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(1.59422508E-07), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(645.16), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(6.4515999935484), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(0.07716049382716), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(0.0007716049375), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(6.4516E-08), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(6.4516E-10), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "in2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(6.4516E-06), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_in2_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "in2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(6.4516E-08), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Square Centimeters" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(0.107639104167097), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(0.001076391040595), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.861022E-09), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.861E-11), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(2.471053815E-06), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(2.4710538E-08), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(15.500031000062), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(0.15500030984562), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(0.01), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-05), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(0.011959900463011), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(0.000119599004511), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(1E-08), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(1E-10), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cm2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(1E-06), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cm2_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cm2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(1E-08), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Square Yards" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(83.612736), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(0.836127359163873), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(900), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(8.999999991), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.2283057851E-05), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(3.22830578E-07), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(0.020661157024793), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(0.000206611570041), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(129600), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(1295.999998704), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(836127.36), "cm2"); + //should be 836127.36, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(8361.27359163873), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(8.3612736E-05), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(8.36127359E-07), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "yd2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(0.0083612736), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_yd2_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "yd2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(8.3612735916E-05), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Square Kilometers" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(1076391041.67097), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(10763910.4059458), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(38.6102158542446), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(0.386102158156344), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(24710.5381467165), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(247.10538122006), "acre"); + //should be 247.10538122006, .net conversion bug + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(155000310000.62), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(1550003098.4562), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(1000000000000L), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(9999999990L), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(119599004.630108), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(1195990.04510509), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_ha_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "km2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(10000), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_km2_to_ha_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "km2"; + string targetUnitName = "ha"; + Measurement expected = new Measurement (Convert.ToDouble(99.9999999), "ha"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Hectares" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_m2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(1000000.0), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_m2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "m2"; + Measurement expected = new Measurement (Convert.ToDouble(9999.99999), "m2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_ft2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(10763910.4167097), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_ft2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "ft2"; + Measurement expected = new Measurement (Convert.ToDouble(107639.104059458), "ft2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_mi2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(0.386102158542446), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_mi2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "mi2"; + Measurement expected = new Measurement (Convert.ToDouble(0.003861021581563), "mi2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_acre_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(247.105381467165), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_acre_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "acre"; + Measurement expected = new Measurement (Convert.ToDouble(2.4710538122006), "acre"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_in2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(1550003100.0062), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_in2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "in2"; + Measurement expected = new Measurement (Convert.ToDouble(15500030.984562), "in2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_cm2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(10000000000L), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_cm2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "cm2"; + Measurement expected = new Measurement (Convert.ToDouble(99999999.9), "cm2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_yd2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(1195990.04630108), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_yd2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "yd2"; + Measurement expected = new Measurement (Convert.ToDouble(11959.9004510509), "yd2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_km2_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "ha"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(1), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_ha_to_km2_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "ha"; + string targetUnitName = "km2"; + Measurement expected = new Measurement (Convert.ToDouble(0.00999999999), "km2"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + #endregion + + #region "Absorbed Radiation Dose Tests" + #region "Source as Gray" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_cGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(10000), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_cGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(99.9999999), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_mGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_mGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_µGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_µGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_kGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "Gy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_Gy_to_kGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "Gy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Centigray" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_Gy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(1), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_Gy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(0.00999999999), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_mGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cGy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(1000), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_mGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cGy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_µGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cGy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(1000000), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_µGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cGy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(9999.99999), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_kGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "cGy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.001), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_cGy_to_kGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "cGy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-06), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Milligray" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_Gy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_Gy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_cGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mGy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(10), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_cGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mGy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.0999999999), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_µGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mGy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_µGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mGy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_kGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "mGy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_mGy_to_kGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "mGy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Microgray" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_Gy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(0.0001), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_Gy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-07), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_cGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µGy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.01), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_cGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µGy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(9.99999999E-05), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_mGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µGy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.1), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_mGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µGy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(0.000999999999), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_kGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "µGy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(1E-07), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_µGy_to_kGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "µGy"; + string targetUnitName = "kGy"; + Measurement expected = new Measurement (Convert.ToDouble(1E-09), "kGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + #endregion + + #region "Source as Kilogray" + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_Gy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(100000), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_Gy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kGy"; + string targetUnitName = "Gy"; + Measurement expected = new Measurement (Convert.ToDouble(999.999999), "Gy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_cGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kGy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(10000000), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_cGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kGy"; + string targetUnitName = "cGy"; + Measurement expected = new Measurement (Convert.ToDouble(99999.9999), "cGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_mGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kGy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(100000000), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_mGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kGy"; + string targetUnitName = "mGy"; + Measurement expected = new Measurement (Convert.ToDouble(999999.999), "mGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_µGy_Test () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (100); + string currentUnitName = "kGy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(100000000000L), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + [Test] + [TestCase(UnitTestCategory.Integration)] + [TestCase(UnitTestCategory.UnitConversion)] + public void UnitConverter_ConvertUnits_kGy_to_µGy_Test2 () + { + UnitConverter target = new UnitConverter (); + double value = Convert.ToDouble (0.999999999); + string currentUnitName = "kGy"; + string targetUnitName = "µGy"; + Measurement expected = new Measurement (Convert.ToDouble(999999999), "µGy"); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (value, currentUnitName, targetUnitName); + Assert.AreEqual (expected.Value, actual.Value); + } + + #endregion + #endregion + #endregion + #region "UnitConverter.UnitConverter()" + + // A test for UnitConverter Constructor + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverterConstructorTest () + { + UnitConverter target = new UnitConverter (); + Assert.IsNotNull (target); + } + + #endregion + #region "Empty and Null Tests" + + [Test] + [TestCase(UnitTestCategory.Unit)] + 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); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ConvertUnitsNullTest2 () + { + UnitConverter target = new UnitConverter (); + Measurement expected = new Measurement (0, Result.BadUnit); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (0, "ft", null); + Assert.AreNotEqual (expected, actual); + Assert.AreEqual (expected.ConversionResult, actual.ConversionResult); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ConvertUnitsNullTest3 () + { + UnitConverter target = new UnitConverter (); + Measurement expected = new Measurement (0, Result.BadUnit); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (0, null, "m"); + Assert.AreNotEqual (expected, actual); + Assert.AreEqual (expected.ConversionResult, actual.ConversionResult); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ConvertUnitsEmptyTest () + { + UnitConverter target = new UnitConverter (); + Measurement expected = new Measurement (0, Result.BadUnit); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (0, string.Empty, string.Empty); + Assert.AreNotEqual (expected, actual); + Assert.AreEqual (expected.ConversionResult, actual.ConversionResult); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + public void UnitConverter_ConvertUnitsEmptyTest2 () + { + UnitConverter target = new UnitConverter (); + Measurement expected = new Measurement (0, Result.BadUnit); + Measurement actual = default(Measurement); + actual = target.ConvertUnits (0, "ft", string.Empty); + Assert.AreNotEqual (expected, actual); + Assert.AreEqual (expected.ConversionResult, actual.ConversionResult); + } + + [Test] + [TestCase(UnitTestCategory.Unit)] + 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); + } + + #endregion + } +} \ No newline at end of file diff --git a/Cubico.Tests/UnitProviderTest.cs b/Cubico.Tests/UnitProviderTest.cs new file mode 100644 index 0000000..9130b33 --- /dev/null +++ b/Cubico.Tests/UnitProviderTest.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using Cubico; + +namespace Cubico.Tests +{ + // This is a test class for UnitProvider and is intended to contain all UnitProvider Unit Tests + [TestFixture] + public class UnitProviderTest + { + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + // A test for UnitTypes + [Test] + public void UnitTypesTest () + { + Dictionary actual = default(Dictionary); + actual = unitPro.UnitTypes; + + Assert.IsNotNull (actual); + Assert.IsTrue (actual.Count > 0); + } + + // A test for Units + [Test] + public void UnitsTest () + { + Dictionary actual = default(Dictionary); + actual = unitPro.Units; + + Assert.IsNotNull (actual); + Assert.IsTrue (actual.Count > 0); + } + + // A test for Symbols + [Test] + public void SymbolsTest () + { + Dictionary actual = default(Dictionary); + actual = unitPro.Symbols; + + Assert.IsNotNull (actual); + Assert.IsTrue (actual.Count > 0); + } + } +} \ No newline at end of file diff --git a/Cubico.Tests/UnitTest.cs b/Cubico.Tests/UnitTest.cs new file mode 100644 index 0000000..538c291 --- /dev/null +++ b/Cubico.Tests/UnitTest.cs @@ -0,0 +1,283 @@ +using System; +using System.Diagnostics.Contracts; +using Cubico; +using NUnit.Framework; +using System.Collections.ObjectModel; + +[TestFixture] +public class UnitTest +{ + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "Unit.Unit()" + + [Test] + public void UnitNewTest () + { + Unit testObj = new Unit (); + + Assert.IsNotNull (testObj); + Assert.IsTrue (testObj.ID == 0); + Assert.IsTrue (string.IsNullOrEmpty(testObj.DefaultSymbol)); + Assert.IsNull (testObj.UnitType); + Assert.IsNotNull (testObj.Symbols); + Assert.IsTrue (testObj.Symbols.Count == 0); + Assert.IsNotNull (testObj.Modifiers); + Assert.IsTrue (testObj.Modifiers.Count == 0); + Assert.IsTrue (string.IsNullOrEmpty(testObj.Name)); + } + + #endregion + #region "Unit.Unit(UnitType)" + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void UnitNewEfUnitUnitTypeNullTest () + { + Unit testObj = new Unit (null); + + Assert.Fail ("Constructor should cause a ContractException. Nulls are not allowed"); + } + + [Test] + public void UnitNewEfUnitUnitTypeTest () + { + UnitType testunittype = new UnitType { + ID = 99, + Name = "Name" + }; + Unit testObj = new Unit (testunittype); + + Assert.IsNotNull (testObj); + Assert.IsNotNull (testObj.UnitType); + Assert.IsTrue (testObj.UnitTypeID == 99); + Assert.AreEqual (testunittype.Name, testObj.UnitType.Name); + + Assert.IsNotNull (testObj.Symbols); + Assert.IsTrue (testObj.Symbols.Count == 0); + + Assert.IsNotNull (testObj.Modifiers); + Assert.IsTrue (testObj.Modifiers.Count == 0); + // Assert.IsTrue(testUnit.UnitModifiers(0).Value = testObj.Modifiers(0).Value) + } + + #endregion + #region "Unit.ParentType" + + [Test] + public void UnitParentTypeTest () + { + UnitType testUnitType = new UnitType { + ID = 99, + Name = "Name" + }; + + Unit testObj = new Unit (); + + testObj.UnitType = testUnitType; + + Assert.IsNotNull (testObj.UnitType); + Assert.AreEqual (testUnitType.ID, testObj.UnitType.ID); + Assert.AreEqual (testUnitType.Name, testObj.UnitType.Name); + } + + [Test] + public void UnitParentTypeNullTest () + { + Unit testObj = new Unit (); + + testObj.UnitType = null; + + Assert.IsNull (testObj.UnitType); + } + + #endregion + #region "Unit.ID" + + [Test] + public void UnitIDTest () + { + Unit testObj = new Unit (); + + testObj.ID = 99; + + Assert.AreEqual (99, testObj.ID); + } + + #endregion + #region "Unit.Name" + + [Test] + public void UnitNameTest () + { + Unit testObj = new Unit (); + + testObj.Name = "Test Name"; + + Assert.AreEqual ("Test Name", testObj.Name); + } + + #endregion + #region "IEquatable" + + [Test] + public void Unit_EqualityTest () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = unitPro.Units ["Feet"]; + + Assert.IsTrue (expected == target); + } + + [Test] + public void Unit_EqualityTest2 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = unitPro.Units ["Inch"]; + + Assert.IsFalse (expected == target); + } + + [Test] + public void Unit_EqualityTest3 () + { + Unit expected = null; + Unit target = unitPro.Units ["Inch"]; + + Assert.IsFalse (expected == target); + } + + [Test] + public void Unit_EqualityTest4 () + { + Unit expected = unitPro.Units ["Inch"]; + Unit target = null; + + Assert.IsFalse (expected == target); + } + + [Test] + public void Unit_EqualityTest5 () + { + Unit expected = null; + Unit target = null; + + Assert.IsTrue (expected == target); + } + + [Test] + public void Unit_EqualityTest6 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = unitPro.Units ["Inch"]; + + Assert.IsTrue (expected != target); + } + + [Test] + public void Unit_EqualityTest7 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = null; + + Assert.IsTrue (expected != target); + } + + [Test] + public void Unit_EqualityTest8 () + { + Unit expected = null; + Unit target = unitPro.Units ["Feet"]; + + Assert.IsTrue (expected != target); + } + + [Test] + public void Unit_EqualityTest8_1 () + { + Unit expected = null; + Unit target = null; + + Assert.IsFalse (expected != target); + } + + [Test] + public void Unit_EqualityTest9 () + { + Unit expected = unitPro.Units ["Inch"]; + Unit target = unitPro.Units ["Feet"]; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest10 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = unitPro.Units ["Feet"]; + + Assert.IsTrue (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest11 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = unitPro.Units ["Inch"]; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest12 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = null; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void Unit_EqualityTest13 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = unitPro.Units ["Feet"]; + + Assert.IsTrue (expected.Equals((object)target)); + } + + [Test] + public void Unit_EqualityTest14 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = unitPro.Units ["Inch"]; + + Assert.IsFalse (expected.Equals((object)target)); + } + + [Test] + public void Unit_EqualityTest154 () + { + Unit expected = unitPro.Units ["Feet"]; + Unit target = null; + + Assert.IsFalse (expected.Equals((object)target)); + } + + [Test] + public void Unit_EqualityTest15 () + { + Unit expected = unitPro.Units ["Feet"]; + + Assert.IsTrue (expected.GetHashCode() == expected.Name.GetHashCode()); + } + + #endregion +} \ No newline at end of file diff --git a/Units.Test/UnitTestCategory.cs b/Cubico.Tests/UnitTestCategory.cs similarity index 60% rename from Units.Test/UnitTestCategory.cs rename to Cubico.Tests/UnitTestCategory.cs index 12ceaac..0fec8c5 100644 --- a/Units.Test/UnitTestCategory.cs +++ b/Cubico.Tests/UnitTestCategory.cs @@ -2,24 +2,16 @@ public class UnitTestCategory { - //Integration Test: Relies on external dependencies in order to complete, such as a database, file system or network. - public const string Integration = "Integration"; - + public const string Integration = "Integration"; //Unit Test occurs within the code. - public const string Unit = "Unit"; - + public const string Unit = "Unit"; //CRUD Test: The test performs Create, Retrieve, Update, Delete calls on the database. - public const string CRUD = "CRUD"; - + public const string CRUD = "CRUD"; //Unit Test takes more than 3 seconds. - public const string SlowTest = "SlowTest"; - + public const string SlowTest = "SlowTest"; //Unit Test specifically for unit conversions drawing from the database. - public const string UnitConversion = "UnitConversion"; - + public const string UnitConversion = "UnitConversion"; //Unit Test for expected exceptions. - public const string ExceptionTest = "ExceptionTest"; - -} - + public const string ExceptionTest = "ExceptionTest"; +} \ No newline at end of file diff --git a/Cubico.Tests/UnitTypeTest.cs b/Cubico.Tests/UnitTypeTest.cs new file mode 100644 index 0000000..c7fe0b6 --- /dev/null +++ b/Cubico.Tests/UnitTypeTest.cs @@ -0,0 +1,213 @@ +using System; +using Cubico; +using NUnit.Framework; + +[TestFixture] +public class UnitTypeTest +{ + TestContext testContextInstance; + UnitProvider unitPro = new UnitProvider (); + + // Gets or sets the test context which provides information about and functionality for the current test run. + public TestContext TestContext { + get { return testContextInstance; } + set { testContextInstance = value; } + } + + #region "UnitType.UnitType()" + + [Test] + public void UnitTypeNewTest () + { + UnitType testObj = new UnitType (); + + Assert.IsNotNull (testObj); + Assert.IsTrue (testObj.ID == 0); + Assert.IsNotNull (testObj.Units); + Assert.IsTrue (testObj.Units.Count == 0); + Assert.IsTrue (string.IsNullOrEmpty(testObj.Name)); + } + + #endregion + #region "UnitType.ID" + + [Test] + public void UnitTypeIDTest () + { + UnitType testObj = new UnitType (); + + testObj.ID = 99; + + Assert.AreEqual (99, testObj.ID); + } + + #endregion + #region "UnitType.Name" + + [Test] + public void UnitTypeNameTest () + { + UnitType testObj = new UnitType (); + + testObj.Name = "Test Name"; + + Assert.AreEqual ("Test Name", testObj.Name); + } + + #endregion + #region "IEquatable" + + [Test] + public void UnitType_EqualityTest () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = unitPro.UnitTypes ["Length"]; + + Assert.IsTrue (expected == target); + } + + [Test] + public void UnitType_EqualityTest2 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = unitPro.UnitTypes ["Mass"]; + + Assert.IsFalse (expected == target); + } + + [Test] + public void UnitType_EqualityTest3 () + { + UnitType expected = null; + UnitType target = unitPro.UnitTypes ["Mass"]; + + Assert.IsFalse (expected == target); + } + + [Test] + public void UnitType_EqualityTest4 () + { + UnitType expected = unitPro.UnitTypes ["Mass"]; + UnitType target = null; + + Assert.IsFalse (expected == target); + } + + [Test] + public void UnitType_EqualityTest5 () + { + UnitType expected = null; + UnitType target = null; + + Assert.IsTrue (expected == target); + } + + [Test] + public void UnitType_EqualityTest6 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = unitPro.UnitTypes ["Mass"]; + + Assert.IsTrue (expected != target); + } + + [Test] + public void UnitType_EqualityTest7 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = null; + + Assert.IsTrue (expected != target); + } + + [Test] + public void UnitType_EqualityTest8 () + { + UnitType expected = null; + UnitType target = unitPro.UnitTypes ["Length"]; + + Assert.IsTrue (expected != target); + } + + [Test] + public void UnitType_EqualityTest8_1 () + { + UnitType expected = null; + UnitType target = null; + + Assert.IsFalse (expected != target); + } + + [Test] + public void UnitType_EqualityTest9 () + { + UnitType expected = unitPro.UnitTypes ["Mass"]; + UnitType target = unitPro.UnitTypes ["Length"]; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void UnitType_EqualityTest10 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = unitPro.UnitTypes ["Length"]; + + Assert.IsTrue (expected.Equals(target)); + } + + [Test] + public void UnitType_EqualityTest11 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = unitPro.UnitTypes ["Mass"]; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void UnitType_EqualityTest12 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = null; + + Assert.IsFalse (expected.Equals(target)); + } + + [Test] + public void UnitType_EqualityTest13 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = unitPro.UnitTypes ["Length"]; + + Assert.IsTrue (expected.Equals((object)target)); + } + + [Test] + public void UnitType_EqualityTest14 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = unitPro.UnitTypes ["Mass"]; + + Assert.IsFalse (expected.Equals((object)target)); + } + + [Test] + public void UnitType_EqualityTest154 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + UnitType target = null; + + Assert.IsFalse (expected.Equals((object)target)); + } + + [Test] + public void UnitType_EqualityTest15 () + { + UnitType expected = unitPro.UnitTypes ["Length"]; + + Assert.IsTrue (expected.GetHashCode() == expected.Name.GetHashCode()); + } + + #endregion +} \ No newline at end of file diff --git a/Cubico.sln b/Cubico.sln new file mode 100644 index 0000000..b8207a8 --- /dev/null +++ b/Cubico.sln @@ -0,0 +1,168 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cubico", "Cubico\Cubico.csproj", "{5C21F8E4-02C4-4614-97C7-1899F4E6E634}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cubico.Tests", "Cubico.Tests\Cubico.Tests.csproj", "{8D4882D3-8D97-4D82-BE0E-AAC8A1D8B487}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Release|Any CPU.Build.0 = Release|Any CPU + {8D4882D3-8D97-4D82-BE0E-AAC8A1D8B487}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D4882D3-8D97-4D82-BE0E-AAC8A1D8B487}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D4882D3-8D97-4D82-BE0E-AAC8A1D8B487}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D4882D3-8D97-4D82-BE0E-AAC8A1D8B487}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = Cubico\Cubico.csproj + Policies = $0 + $0.DotNetNamingPolicy = $1 + $1.DirectoryNamespaceAssociation = None + $1.ResourceNamePolicy = FileFormatDefault + $0.StandardHeader = $2 + $2.Text = + $2.IncludeInNewFiles = True + $0.NameConventionPolicy = $3 + $3.Rules = $4 + $4.NamingRule = $5 + $5.Name = Namespaces + $5.AffectedEntity = Namespace + $5.VisibilityMask = VisibilityMask + $5.NamingStyle = PascalCase + $5.IncludeInstanceMembers = True + $5.IncludeStaticEntities = True + $4.NamingRule = $6 + $6.Name = Types + $6.AffectedEntity = Class, Struct, Enum, Delegate + $6.VisibilityMask = Public + $6.NamingStyle = PascalCase + $6.IncludeInstanceMembers = True + $6.IncludeStaticEntities = True + $4.NamingRule = $7 + $7.Name = Interfaces + $7.RequiredPrefixes = $8 + $8.String = I + $7.AffectedEntity = Interface + $7.VisibilityMask = Public + $7.NamingStyle = PascalCase + $7.IncludeInstanceMembers = True + $7.IncludeStaticEntities = True + $4.NamingRule = $9 + $9.Name = Attributes + $9.RequiredSuffixes = $10 + $10.String = Attribute + $9.AffectedEntity = CustomAttributes + $9.VisibilityMask = Public + $9.NamingStyle = PascalCase + $9.IncludeInstanceMembers = True + $9.IncludeStaticEntities = True + $4.NamingRule = $11 + $11.Name = Event Arguments + $11.RequiredSuffixes = $12 + $12.String = EventArgs + $11.AffectedEntity = CustomEventArgs + $11.VisibilityMask = Public + $11.NamingStyle = PascalCase + $11.IncludeInstanceMembers = True + $11.IncludeStaticEntities = True + $4.NamingRule = $13 + $13.Name = Exceptions + $13.RequiredSuffixes = $14 + $14.String = Exception + $13.AffectedEntity = CustomExceptions + $13.VisibilityMask = VisibilityMask + $13.NamingStyle = PascalCase + $13.IncludeInstanceMembers = True + $13.IncludeStaticEntities = True + $4.NamingRule = $15 + $15.Name = Methods + $15.AffectedEntity = Methods + $15.VisibilityMask = Protected, Public + $15.NamingStyle = PascalCase + $15.IncludeInstanceMembers = True + $15.IncludeStaticEntities = True + $4.NamingRule = $16 + $16.Name = Static Readonly Fields + $16.AffectedEntity = ReadonlyField + $16.VisibilityMask = Protected, Public + $16.NamingStyle = PascalCase + $16.IncludeInstanceMembers = False + $16.IncludeStaticEntities = True + $4.NamingRule = $17 + $17.Name = Fields + $17.AffectedEntity = Field + $17.VisibilityMask = Protected, Public + $17.NamingStyle = PascalCase + $17.IncludeInstanceMembers = True + $17.IncludeStaticEntities = True + $4.NamingRule = $18 + $18.Name = ReadOnly Fields + $18.AffectedEntity = ReadonlyField + $18.VisibilityMask = Protected, Public + $18.NamingStyle = PascalCase + $18.IncludeInstanceMembers = True + $18.IncludeStaticEntities = False + $4.NamingRule = $19 + $19.Name = Constant Fields + $19.AffectedEntity = ConstantField + $19.VisibilityMask = Protected, Public + $19.NamingStyle = PascalCase + $19.IncludeInstanceMembers = True + $19.IncludeStaticEntities = True + $4.NamingRule = $20 + $20.Name = Properties + $20.AffectedEntity = Property + $20.VisibilityMask = Protected, Public + $20.NamingStyle = PascalCase + $20.IncludeInstanceMembers = True + $20.IncludeStaticEntities = True + $4.NamingRule = $21 + $21.Name = Events + $21.AffectedEntity = Event + $21.VisibilityMask = Protected, Public + $21.NamingStyle = PascalCase + $21.IncludeInstanceMembers = True + $21.IncludeStaticEntities = True + $4.NamingRule = $22 + $22.Name = Enum Members + $22.AffectedEntity = EnumMember + $22.VisibilityMask = VisibilityMask + $22.NamingStyle = PascalCase + $22.IncludeInstanceMembers = True + $22.IncludeStaticEntities = True + $4.NamingRule = $23 + $23.Name = Parameters + $23.AffectedEntity = Parameter + $23.VisibilityMask = VisibilityMask + $23.NamingStyle = CamelCase + $23.IncludeInstanceMembers = True + $23.IncludeStaticEntities = True + $4.NamingRule = $24 + $24.Name = Type Parameters + $24.RequiredPrefixes = $25 + $25.String = T + $24.AffectedEntity = TypeParameter + $24.VisibilityMask = VisibilityMask + $24.NamingStyle = PascalCase + $24.IncludeInstanceMembers = True + $24.IncludeStaticEntities = True + $0.VersionControlPolicy = $26 + $26.inheritsSet = Mono + $0.ChangeLogPolicy = $27 + $27.UpdateMode = None + $27.MessageStyle = $28 + $28.LineAlign = 0 + $27.inheritsSet = Mono + outputpath = Debug + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cubico.userprefs b/Cubico.userprefs new file mode 100644 index 0000000..0e663a0 --- /dev/null +++ b/Cubico.userprefs @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Cubico/ConversionResult.cs b/Cubico/ConversionResult.cs new file mode 100644 index 0000000..777fe2e --- /dev/null +++ b/Cubico/ConversionResult.cs @@ -0,0 +1,119 @@ +using System; +using System.Runtime.Serialization; + +namespace Cubico +{ + [Serializable] + [DataContract] + public class ConversionResult : IEquatable + { + #region "Constructors" + + public ConversionResult () + { + _result = Cubico.Result.NoError; + _value = 0; + } + + public ConversionResult (double value) + { + _result = Cubico.Result.NoError; + _value = value; + } + + public ConversionResult (double value, string symbol) + { + _result = Cubico.Result.NoError; + _value = value; + _symbol = symbol; + } + + public ConversionResult (double value, Result result) + { + _result = result; + _value = value; + } + + public ConversionResult (Result result) + { + _result = result; + } + + #endregion + #region "Properties" + + Result _result; + + [DataMember] + public Result Result { + get { return _result; } + set { _result = value; } + } + + double _value; + + [DataMember] + public double Value { + get { return _value; } + set { _value = value; } + } + + string _symbol; + + [DataMember] + public string Symbol { + get { return _symbol; } + set { _symbol = value; } + } + + #endregion + #region "IEquatable" + + public override int GetHashCode () + { + return (this.Value.ToString () + this.Symbol.ToString () + this.Result.ToString ()).GetHashCode (); + } + + public override bool Equals (object obj) + { + if (obj == null) { + return false; + } else if (!object.ReferenceEquals (obj.GetType(), typeof(ConversionResult))) { + return false; + } + + ConversionResult CrObj = (ConversionResult)obj; + + return this.Equals (CrObj); + } + + public bool Equals (ConversionResult other) + { + if (other == null) { + return false; + } + + if (other.Value != this.Value) { + return false; + } else if (other.Symbol != this.Symbol) { + return false; + } else if (other.Result != this.Result) { + return false; + } else { + return true; + } + } + + public static bool operator != (ConversionResult left, ConversionResult right) + { + return !left.Equals (right); + } + + public static bool operator == (ConversionResult left, ConversionResult right) + { + return left.Equals (right); + } + + #endregion + } +} \ No newline at end of file diff --git a/Units/Cubico.csproj b/Cubico/Cubico.csproj similarity index 89% rename from Units/Cubico.csproj rename to Cubico/Cubico.csproj index a198773..eacd81c 100644 --- a/Units/Cubico.csproj +++ b/Cubico/Cubico.csproj @@ -9,8 +9,9 @@ Properties Cubico Cubico - v4.5 512 + 12.0.0 + 2.0 true @@ -34,19 +35,16 @@ - - - + - @@ -54,11 +52,6 @@ - - - Designer - - + + + \ No newline at end of file diff --git a/Cubico/Measurement.cs b/Cubico/Measurement.cs new file mode 100644 index 0000000..a12008f --- /dev/null +++ b/Cubico/Measurement.cs @@ -0,0 +1,602 @@ +using System; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Runtime.Serialization; + +namespace Cubico +{ + // A structure that defines a measurement with a numeric value and a unit of measure. + [Serializable] + [DataContract] + [KnownType(typeof(Unit))] + [KnownType(typeof(UnitType))] + [KnownType(typeof(Symbol))] + [KnownType(typeof(Modifier))] + [KnownType(typeof(ConversionResult))] + public struct Measurement : IEquatable, IComparable + { + #region "Private Fields" + + MeasurementFlags _flags; + UnitConverter _uc; + double _maxbound; + double _minbound; + double _standardValue; + // Unit _standardUnit; + double _value; + Unit _unit; + string _symbol; + Result _conversionResult; + + public event EventHandler OnValueChanged; + public event EventHandler OnUnitChanged; + + #endregion + #region "Constructors" + + internal Measurement (string unitSymbol) + { + // Reference the unit converter that created us. + _uc = new UnitConverter (); + + _flags = MeasurementFlags.None; + _maxbound = 0; + _minbound = 0; + _standardValue = 0; + // _standardUnit = null; + _symbol = null; + OnValueChanged = null; + OnUnitChanged = null; + + if (string.IsNullOrWhiteSpace (unitSymbol)) { + // System.Diagnostics.Debug.Print("First IF Statement") + _unit = null; + _conversionResult = Result.BadUnit; + } else { + // System.Diagnostics.Debug.Print("First ELSE Statement") + _unit = _uc.GetUnitBySymbol (unitSymbol); + _conversionResult = Result.NoError; + + if (_unit.Symbols.Contains (new Symbol { Value = unitSymbol })) { + _symbol = unitSymbol; + } else { + _symbol = _unit.DefaultSymbol; + } + } + + _value = 0; + } + + public Measurement (double value, string unitSymbol) + : this(unitSymbol) + { + + if (!string.IsNullOrWhiteSpace (unitSymbol)) { + _unit = _uc.GetUnitBySymbol (unitSymbol); + } + + _value = value; + } + + internal Measurement (double value, string unitSymbol, Result conversionResult) + : this(unitSymbol) + { + + _value = value; + + _conversionResult = conversionResult; + } + + internal Measurement (double value, Result conversionResult) + : this(null) + { + + _value = value; + + _conversionResult = conversionResult; + } + + internal Measurement (double value, Unit unit, Result conversionResult = Result.NoError) + { + // Reference the unit converter that created us. + _uc = new UnitConverter (); + _flags = MeasurementFlags.None; + _unit = unit; + _conversionResult = Result.NoError; + _value = value; + _conversionResult = conversionResult; + + _maxbound = 0; + _minbound = 0; + _standardValue = 0; + // _standardUnit = null; + _symbol = null; + OnValueChanged = null; + OnUnitChanged = null; + } + + #endregion + #region "measurement flags and properties methods" + + // Gets a reference to the current unit of the measurement. + public Unit Unit { + get { return _unit; } + } + + // Gets or sets the flags on this measurement. + public MeasurementFlags Flags { + get { return _flags; } + set { _flags = value; } + } + + // Gets the unit converter associated with this measurement. + public UnitConverter Converter { + get { return _uc; } + } + + // Displays the result of a conversion. + // This property will default to NoError unless there were problems after a conversion. + public Result ConversionResult { + get { return _conversionResult; } + set { _conversionResult = value; } + } + + public double Value { + get { return _value; } + } + + public string Symbol { + get { + if (_unit == null) { + return null; + } else { + return _symbol; + } + } + } + + // Gets the current value of the measurement in string form. + public string FullValue { + get { + string str = _value.ToString (); + + if (_unit != null) { + if (!string.IsNullOrEmpty (_unit.DefaultSymbol)) { + str += _unit.DefaultSymbol; + } else { + str += _unit.Name; + } + } + + return str; + } + } + + public bool IsValid { + get { + if (_conversionResult != Result.NoError && _conversionResult != Result.UnitExists) { + return false; + } else if (_uc == null) { + return false; + } else if (_unit == null) { + return false; + } else { + return true; + } + } + } + + #endregion + #region "Value getting and setting methods" + + // Sets the unit of the measurement. + internal Result SetUnit (string unitSymbol) + { + Unit unit = _uc.GetUnitBySymbol (unitSymbol); + + if (unit == null) { + return Result.BadUnit; + } else { + // If its the same don't touch it. + if (unit.DefaultSymbol == _unit.DefaultSymbol) { + return Result.NoError; + } + + _unit = unit; + + if (OnUnitChanged != null) { + OnUnitChanged (this, EventArgs.Empty); + } + + return Result.NoError; + } + } + + // Given a string in the format "[value] [unit]" parses and applies the value and unit. + internal Result SetValue (string measurement) + { + if (string.IsNullOrEmpty (measurement)) { + throw new ArgumentNullException ("measurement"); + } + Contract.EndContractBlock (); + + double d = 0; + string symbol = null; + Result res = default(Result); + + res = ValidateEntry (measurement); + if (res != Result.NoError) { + return res; + } + + Measurement newRes = _uc.ParseUnitString (measurement); + + d = newRes.Value; + symbol = newRes.Symbol; + + // Can we change the unit? + if ((_flags & MeasurementFlags.ForceUnit) > 0) { + // Can't change the unit, so turn the given units into the unit we want. + Measurement convRes = _uc.ConvertUnits (d, symbol, _unit.Name); + d = convRes.Value; + } else { + // Change the measurement unit to the given unit. + SetUnit (symbol); + } + + SetValue (d); + return res; + } + + // Sets a value in the currently set unit format. + internal Result SetValue (double value) + { + Measurement res = default(Measurement); + Unit standardUnit = default(Unit); + UnitType tp = _unit.UnitType; + standardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault (); + res = _uc.ConvertUnits (value, _unit.Name, standardUnit.Name); + + _value = value; + _standardValue = res.Value; + + if (res.ConversionResult != Result.NoError) { + return res.ConversionResult; + } + + if (OnValueChanged != null) { + OnValueChanged (this, EventArgs.Empty); + } + + return res.ConversionResult; + } + + // Gets the value of the measurement in the specified units. + public Measurement GetValueAs (string unitSymbol) + { + return _uc.ConvertUnits (_value, _unit.Name, unitSymbol); + } + + public string GetStringValueAs (string unitSymbol) + { + Measurement res = default(Measurement); + res = _uc.ConvertUnits (_value, _unit.Name, unitSymbol); + + if (res.ConversionResult != Result.NoError) { + return "Conversion Error"; + } else { + return res.FullValue; + } + } + + #endregion + #region "Validation methods" + + // Validates input to the measurement. + public Result ValidateEntry (string entry) + { + string unit = null; + double d = 0; + Measurement res = default(Measurement); + + // Parse the entry. + res = _uc.ParseUnitString (entry); + if (res.ConversionResult != Result.NoError) { + return res.ConversionResult; + } + + unit = res.Symbol; + d = res.Value; + + return ValidateEntryUnitData (unit, d); + } + + public Result ValidateEntry (double value, string symbol) + { + return ValidateEntryUnitData (symbol, value); + } + + Result ValidateEntryUnitData (string unit, double x) + { + + // Make sure the units are compatible. + if (!_uc.IsCompatible (unit, this._unit.DefaultSymbol)) { + return Result.UnitMismatch; + } + + Measurement newRes = _uc.ConvertUnits (x, unit, this.Unit.Name); + x = newRes.Value; + + if ((this._flags & MeasurementFlags.UseMaxBound) > 0) { + if (x > this._maxbound) { + return Result.ValueTooHigh; + } + } + + if ((this._flags & MeasurementFlags.UseMinBound) > 0) { + if (x < this._minbound) { + return Result.ValueTooLow; + } + } + + return Result.NoError; + } + + #endregion + #region "Bounds setting methods" + + // Sets the maximum bound of the measurement. + public Result SetMaxBound (double maxbound, string unitSymbol) + { + if (string.IsNullOrEmpty (unitSymbol)) { + throw new ArgumentNullException ("unitSymbol"); + } + + if (!_uc.IsCompatible (unitSymbol, this._unit.DefaultSymbol)) { + return Result.UnitMismatch; + } + + Measurement res = _uc.ConvertUnits (maxbound, unitSymbol, _unit.Name); + + this._maxbound = res.Value; + + return Result.NoError; + } + + // Sets the minimum bound of the measurement. + public Result SetMinBound (double minbound, string unitSymbol) + { + if (string.IsNullOrEmpty (unitSymbol)) { + throw new ArgumentNullException ("unitSymbol"); + } + + if (!_uc.IsCompatible (unitSymbol, this._unit.DefaultSymbol)) { + return Result.UnitMismatch; + } + + Measurement res = _uc.ConvertUnits (minbound, unitSymbol, _unit.Name); + + this._minbound = res.Value; + + return Result.NoError; + } + + #endregion + #region "Operator overloads" + + // Gets a string representation of the measurement. + public override string ToString () + { + return this.FullValue; + } + + // Adds two measurements together. + public static Measurement operator + (Measurement d1, Measurement d2) + { + double x = 0; + double y = 0; + + x = d1.Value; + + if (d2.Unit.ID == d1.Unit.ID) { + y = d2.Value; + } else { + y = d2.Value; + Measurement res2 = d2.Converter.ConvertUnits (y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); + y = res2.Value; + } + + var result = new Measurement (x + y, d1.Unit); + return result; + } + + // Subtracts two measurements. + public static Measurement operator - (Measurement d1, Measurement d2) + { + double x = 0; + double y = 0; + + x = d1.Value; + + if (d2.Unit.ID == d1.Unit.ID) { + y = d2.Value; + } else { + y = d2.Value; + Measurement res2 = d2.Converter.ConvertUnits (y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); + y = res2.Value; + } + + var result = new Measurement (x - y, d1.Unit); + return result; + } + + // Multiplies two measurements. + public static Measurement operator * (Measurement d1, Measurement d2) + { + double x = 0; + double y = 0; + + x = d1.Value; + + if (d2.Unit.ID == d1.Unit.ID) { + y = d2.Value; + } else { + y = d2.Value; + Measurement res2 = d2.Converter.ConvertUnits (y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); + y = res2.Value; + } + + var result = new Measurement (x * y, d1.Unit); + return result; + } + + // Divides two measurements. + public static Measurement operator / (Measurement d1, Measurement d2) + { + double x = 0; + double y = 0; + + x = d1.Value; + + if (d2.Unit.ID == d1.Unit.ID) { + y = d2.Value; + } else { + y = d2.Value; + Measurement res2 = d2.Converter.ConvertUnits (y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); + y = res2.Value; + } + + Measurement result = new Measurement (x / y, d1.Unit); + return result; + } + + public static bool operator != (Measurement left, Measurement right) + { + return !left.Equals (right); + } + + public static bool operator == (Measurement left, Measurement right) + { + return left.Equals (right); + } + + public static bool operator < (Measurement left, Measurement right) + { + return (left.CompareTo (right) < 0); + } + + public static bool operator > (Measurement left, Measurement right) + { + return (left.CompareTo (right) > 0); + } + + public static bool operator <= (Measurement left, Measurement right) + { + return (left.CompareTo (right) <= 0); + } + + public static bool operator >= (Measurement left, Measurement right) + { + return (left.CompareTo (right) >= 0); + } + + #endregion + #region "IEquatable(Of Measurement)" + + public override int GetHashCode () + { + Measurement MeRes = default(Measurement); + string str = string.Empty; + if (this.ConversionResult != Result.NoError) { + str = this.Value.ToString () + "|" + this.ConversionResult.ToString (); + } else { + Unit standardUnit = default(Unit); + UnitType tp = this.Unit.UnitType; + standardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault (); + + MeRes = this.Converter.ConvertUnits (this._value, this.Unit.DefaultSymbol, standardUnit.DefaultSymbol); + str = MeRes.Value.ToString () + "|" + MeRes.Symbol; + } + + return str.GetHashCode (); + } + + public override bool Equals (object obj) + { + if (obj == null || !object.ReferenceEquals (obj.GetType(), typeof(Measurement))) { + return false; + } + + Measurement Mobj = (Measurement)obj; + return this.Equals (Mobj); + } + + public bool Equals (Measurement other) + { + if (other.ConversionResult != Result.NoError) { + return false; + } + + if (this.ConversionResult != Result.NoError) { + return false; + } + + if (object.ReferenceEquals (this.Unit, null) && object.ReferenceEquals (other.Unit, null)) { + return true; + } + + if (object.ReferenceEquals (this.Unit, null) ^ object.ReferenceEquals (other.Unit, null)) { + return false; + } + + if (this.Unit.Name == other.Unit.Name && this.Value == other.Value) { + return true; + } else { + Measurement OtherRes = other.Converter.ConvertUnits (other._value, other.Unit.Name, this.Unit.Name); + + if (OtherRes.ConversionResult != Result.NoError) { + return false; + } else if (this.Unit.Name != OtherRes.Unit.Name) { + return false; + } else if (this.Value != OtherRes.Value) { + return false; + } else { + return true; + } + } + } + + #endregion + #region "ICompareTo(Of Measurement)" + + public int CompareTo (Measurement other) + { + if (other.ConversionResult != Result.NoError) { + throw new ArgumentException ("other", "the 'other' parameter must have a valid value"); + } + + if (this.ConversionResult != Result.NoError) { + throw new ArgumentException ("this", "object must have a valid value"); + } + + Unit standardUnit = default(Unit); + UnitType tp = this.Unit.UnitType; + standardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault (); + + Unit otherStandardUnit = default(Unit); + tp = this.Unit.UnitType; + otherStandardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault (); + + Measurement meRes = this.Converter.ConvertUnits (this._value, this.Unit.DefaultSymbol, standardUnit.DefaultSymbol); + Measurement otherRes = other.Converter.ConvertUnits (other._value, other.Unit.DefaultSymbol, otherStandardUnit.DefaultSymbol); + + if (meRes.Symbol != otherRes.Symbol) { + throw new ArgumentException ("The parameter must be of the same unit type as this object. " + this.Unit.DefaultSymbol, "other"); + } + + return meRes.Value.CompareTo (otherRes.Value); + } + + #endregion + } +} \ No newline at end of file diff --git a/Cubico/MeasurementFlags.cs b/Cubico/MeasurementFlags.cs new file mode 100644 index 0000000..16c82f3 --- /dev/null +++ b/Cubico/MeasurementFlags.cs @@ -0,0 +1,19 @@ +using System; + +namespace Cubico +{ + [Flags] + public enum MeasurementFlags : int + { + None = 0, + + // Stops the data string unit being changed by reading user input. + ForceUnit = 1, + + // Enforces a maximum value on the data string. + UseMaxBound = 2, + + // Enforces a minimum value on the data string. + UseMinBound = 4 + } +} \ No newline at end of file diff --git a/Cubico/Modifier.cs b/Cubico/Modifier.cs new file mode 100644 index 0000000..8250212 --- /dev/null +++ b/Cubico/Modifier.cs @@ -0,0 +1,92 @@ +using System; +using System.Runtime.Serialization; + +namespace Cubico +{ + [DataContract(IsReference = true)] + [Serializable] + public partial class Modifier + { + #region "Contructors" + + public Modifier () : base() + { + } + + #endregion + #region "Primitive Properties" + + [DataMember] + public int ID { get; set; } + + [DataMember] + public decimal Value { get; set; } + + [DataMember] + public int Order { get; set; } + + [DataMember] + public int UnitSourceID { get; set; } + + [DataMember] + public int UnitTargetID { get; set; } + + [DataMember] + public Nullable Precision { get; set; } + + #endregion + #region "ChangeTracking" + + bool _isDeserializing; + + protected bool IsDeserializing { + get { return _isDeserializing; } + set { _isDeserializing = value; } + } + + [OnDeserializing] + public void OnDeserializingMethod (StreamingContext context) + { + IsDeserializing = true; + } + + [OnDeserialized] + public void OnDeserializedMethod (StreamingContext context) + { + IsDeserializing = false; + } + + bool _isSerializing = false; + + protected bool IsSerializing { + get { return _isSerializing; } + set { _isSerializing = value; } + } + + [OnSerializing] + public void OnSerializingMethod (StreamingContext context) + { + IsSerializing = true; + } + + [OnSerialized] + public void OnSerializedMethod (StreamingContext context) + { + IsSerializing = false; + } + + protected virtual void ClearNavigationProperties () + { + } + + #endregion + #region "Properties" + + [DataMember] + public Unit ParentUnit { get; set; } + + public ModifierType ModifierType { get; set; } + + #endregion + } +} \ No newline at end of file diff --git a/Cubico/ModifierType.cs b/Cubico/ModifierType.cs new file mode 100644 index 0000000..bfc071e --- /dev/null +++ b/Cubico/ModifierType.cs @@ -0,0 +1,12 @@ +namespace Cubico +{ + public enum ModifierType + { + None = 0, + PreAdd = 1, + Add = 2, + Multiply = 3, + Subtract = 4, + Divide = 5 + } +} \ No newline at end of file diff --git a/Units/Properties/AssemblyInfo.cs b/Cubico/Properties/AssemblyInfo.cs similarity index 91% rename from Units/Properties/AssemblyInfo.cs rename to Cubico/Properties/AssemblyInfo.cs index 354e45f..641f724 100644 --- a/Units/Properties/AssemblyInfo.cs +++ b/Cubico/Properties/AssemblyInfo.cs @@ -6,14 +6,14 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Cubico")] -[assembly: AssemblyDescription("Measurement & Unit Conversion library.")] +[assembly: AssemblyDescription("A measurement and unit conversion library.")] //[assembly: AssemblyConfiguration("")] //[assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Cubico")] //[assembly: AssemblyCopyright("")] //[assembly: AssemblyTrademark("")] //[assembly: AssemblyCulture("")] -[assembly: InternalsVisibleTo("Cubico.Test")] +[assembly: InternalsVisibleTo("Cubico.Tests")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/Cubico/Result.cs b/Cubico/Result.cs new file mode 100644 index 0000000..7073c38 --- /dev/null +++ b/Cubico/Result.cs @@ -0,0 +1,35 @@ +namespace Cubico +{ + public enum Result : int + { + // No error occured. + NoError = 0, + + // A general error occured. + GenericError, + + // Specified unit was not found. + UnitNotFound, + + // Specified unit group was not found. + GroupNotFound, + + // Unit exists. + UnitExists, + + // Specified unit was invalid. + BadUnit, + + // Specified value was invalid. + BadValue, + + // Two units were used that are not in the same group. + UnitMismatch, + + // An input value was too high. + ValueTooHigh, + + // An input value was too low. + ValueTooLow + } +} \ No newline at end of file diff --git a/Cubico/Symbol.cs b/Cubico/Symbol.cs new file mode 100644 index 0000000..45103fe --- /dev/null +++ b/Cubico/Symbol.cs @@ -0,0 +1,178 @@ +using System; +using System.Runtime.Serialization; + +namespace Cubico +{ + // Represents a unit of measure's symbol, or alternate methods to identify a unit of measure. + // Inch = ", inches, in, in. etc. + [DataContract(IsReference = true)] + [KnownType(typeof(Unit))] + [Serializable] + public partial class Symbol + { + #region "Constructors" + + public Symbol () + { + } + + public Symbol (Unit unit) + { + if (unit == null) { + throw new ArgumentNullException ("unit"); + } + + this.Unit = unit; + } + + #endregion + #region "Primitive Properties" + + [DataMember] + public int Id { get; set; } + + [DataMember] + public string Value { get; set; } + + [DataMember] + public bool IsDefault { get; set; } + + [DataMember] + public int UnitId { get; set; } + + #endregion + #region "Navigation Properties" + + [DataMember] + public Unit Unit { + get { return _unit; } + set { + if (!object.ReferenceEquals (_unit, value)) { + Unit previousValue = _unit; + _unit = value; + FixupUnit (previousValue); + } + } + } + + Unit _unit; + + #endregion + #region "ChangeTracking" + + bool _isDeserializing; + + protected bool IsDeserializing { + get { return _isDeserializing; } + set { _isDeserializing = value; } + } + + [OnDeserializing] + public void OnDeserializingMethod (StreamingContext context) + { + IsDeserializing = true; + } + + [OnDeserialized] + public void OnDeserializedMethod (StreamingContext context) + { + IsDeserializing = false; + } + + bool _isSerializing = false; + + protected bool IsSerializing { + get { return _isSerializing; } + set { _isSerializing = value; } + } + + [OnSerializing] + public void OnSerializingMethod (StreamingContext context) + { + IsSerializing = true; + } + + [OnSerialized] + public void OnSerializedMethod (StreamingContext context) + { + IsSerializing = false; + } + + #endregion + #region "Association Fixup" + + void FixupUnit (Unit previousValue) + { + if (IsDeserializing) { + return; + } + + if (previousValue != null && previousValue.Symbols.Contains (this)) { + previousValue.Symbols.Remove (this); + } + + if (Unit != null) { + if (!Unit.Symbols.Contains (this)) { + Unit.Symbols.Add (this); + } + + UnitId = Unit.ID; + } + } + + #endregion + #region "IEquatable" + + public override int GetHashCode () + { + return this.Value.GetHashCode (); + } + + public override bool Equals (object obj) + { + if ((object)obj == null) { + return false; + } else if (!object.ReferenceEquals (obj.GetType(), this.GetType ())) { + return false; + } else { + return this.Equals ((Symbol)obj); + } + } + + public bool Equals (Symbol other) + { + if ((object)other == null) { + return false; + } else { + if (this.Value != other.Value) { + return false; + } else { + return true; + } + } + } + + public static bool operator != (Symbol left, Symbol right) + { + return !(left == right); + } + + public static bool operator == (Symbol left, Symbol right) + { + if (object.ReferenceEquals (left, right)) { + return true; + } else if ((object)left == null || (object)right == null) { + return false; + } else { + return left.Equals (right); + } + } + + #endregion + + public override string ToString () + { + return this.Value; + } + } +} \ No newline at end of file diff --git a/Cubico/Unit.cs b/Cubico/Unit.cs new file mode 100644 index 0000000..e2e8f2c --- /dev/null +++ b/Cubico/Unit.cs @@ -0,0 +1,232 @@ +using System; +using System.Runtime.Serialization; +using System.Collections.Generic; +using System.Linq; + +namespace Cubico +{ + [DataContract(IsReference = true)] + [KnownType(typeof(UnitType))] + [KnownType(typeof(Symbol))] + [KnownType(typeof(Modifier))] + [Serializable] + public partial class Unit : IEquatable + { + #region "Constructors" + + public Unit () : base() + { + } + + internal Unit (UnitType unitType) + { + if (unitType == null) { + throw new ArgumentNullException ("unitType"); + } + + this.UnitType = unitType; + } + + public bool IsDefault { + get { + foreach (Modifier mod in this.Modifiers) { + if (mod.UnitSourceID == mod.UnitTargetID && mod.UnitSourceID == this.ID) { + return true; + } + } + + return false; + } + } + + #endregion + #region "Primitive Properties" + + [DataMember] + public int ID { get; set; } + + [DataMember] + public string Name { get; set; } + + [DataMember] + public int UnitTypeID { get; set; } + + #endregion + #region "Navigation Properties" + + [DataMember] + public UnitType UnitType { get; set; } + + private List _symbols; + + [DataMember] + public List Symbols { + get { + if (_symbols == null && IsSerializing == false) { + _symbols = new List (); + } + return _symbols; + } + set { + if (!object.ReferenceEquals (_symbols, value)) { + _symbols = value; + } + } + } + + private List _sources; + + [DataMember] + public List Sources { + get { + if (_sources == null && IsSerializing == false) { + _sources = new List (); + } + return _sources; + } + set { + if (!object.ReferenceEquals (_sources, value)) { + _sources = value; + } + } + } + + private List _modifiers; + + [DataMember] + public List Modifiers { + get { + if (_modifiers == null && IsSerializing == false) { + _modifiers = new List (); + } + return _modifiers; + } + set { + if (!object.ReferenceEquals (_modifiers, value)) { + _modifiers = value; + } + } + } + + #endregion + #region "ChangeTracking" + + private bool _isDeserializing; + + protected bool IsDeserializing { + get { return _isDeserializing; } + private set { _isDeserializing = value; } + } + + [OnDeserializing] + public void OnDeserializingMethod (StreamingContext context) + { + IsDeserializing = true; + } + + [OnDeserialized] + public void OnDeserializedMethod (StreamingContext context) + { + IsDeserializing = false; + } + + private bool _isSerializing = false; + + protected bool IsSerializing { + get { return _isSerializing; } + private set { _isSerializing = value; } + } + + [OnSerializing] + public void OnSerializingMethod (StreamingContext context) + { + IsSerializing = true; + } + + [OnSerialized] + public void OnSerializedMethod (StreamingContext context) + { + IsSerializing = false; + } + + protected virtual void ClearNavigationProperties () + { + UnitType = null; + Symbols.Clear (); + Sources.Clear (); + Modifiers.Clear (); + } + + #endregion + #region "Properties" + + public string DefaultSymbol { + get { + Symbol symbol = (from s in this.Symbols + where s.IsDefault = true + select s).FirstOrDefault (); + + if (symbol == null) { + return string.Empty; + } else { + return symbol.Value; + } + } + } + + #endregion + #region "IEquatable" + + public override int GetHashCode () + { + return this.Name.GetHashCode (); + } + + public override bool Equals (object obj) + { + if ((object)obj == null) { + return false; + } else if (!object.ReferenceEquals (obj.GetType(), this.GetType ())) { + return false; + } else { + return this.Equals ((Unit)obj); + } + } + + public bool Equals (Unit other) + { + if (object.ReferenceEquals (other, null)) { + return false; + } else { + if (this.Name != other.Name) { + return false; + } else { + return true; + } + } + } + + public static bool operator != (Unit left, Unit right) + { + return !(left == right); + } + + public static bool operator == (Unit left, Unit right) + { + if (object.ReferenceEquals (left, right)) { + return true; + } else if ((object)left == null || (object)right == null) { + return false; + } else { + return left.Equals (right); + } + } + + #endregion + + public override string ToString () + { + return this.Name; + } + } +} \ No newline at end of file diff --git a/Cubico/UnitConverter.cs b/Cubico/UnitConverter.cs new file mode 100644 index 0000000..730a1ec --- /dev/null +++ b/Cubico/UnitConverter.cs @@ -0,0 +1,342 @@ +using System; +using System.Diagnostics.Contracts; +using System.Collections.Generic; +using System.Linq; + +namespace Cubico +{ + public class UnitConverter + { + //TODO: Fix this; was Previously NaN + const double _failsafeValue = 0; + Dictionary _SymbolDictionary; + Dictionary _IndividualSymbolDictionary; + Dictionary _UnitDictionary; + Dictionary _UnitTypeDictionary; + + // Constructor, sets up the unit converter. + public UnitConverter () + { + //Set up the tables we need + var unitPro = new UnitProvider (); + _SymbolDictionary = unitPro.Symbols; + _IndividualSymbolDictionary = unitPro.IndividualSymbols; + _UnitDictionary = unitPro.Units; + _UnitTypeDictionary = unitPro.UnitTypes; + + } + + #region "Unit related methods" + + // Given the full name of the unit, returns the unit entry. + public Unit GetUnitByName (string unitName) + { + if (string.IsNullOrEmpty (unitName)) { + throw new ArgumentException ("unitName must have a value."); + } + + if (this._UnitDictionary.ContainsKey (unitName)) { + return this._UnitDictionary [unitName]; + } else { + throw new ArgumentException ("The unit '" + unitName + "' was not found in the UnitConverter. Add this unit to the database for compatability."); + } + } + + // Given a unit symbol, gets the unit entry. + public Unit GetUnitBySymbol (string unitSymbol) + { + if (string.IsNullOrWhiteSpace (unitSymbol)) { + throw new ArgumentNullException ("unitSymbol must have a value"); + } + + //First check to see if they used the actual name of a unit then look at the symbol table. + Unit unitFound = (from val in this._UnitDictionary.Values where val.Name.ToUpper () == unitSymbol.Trim ().ToUpper () select val).FirstOrDefault (); + + if (unitFound != null) { + return unitFound; + } + + Symbol symFound = (from val in this._IndividualSymbolDictionary.Values where val.Value == unitSymbol.Trim () select val).FirstOrDefault (); + + if (symFound != null) { + return symFound.Unit; + } + + throw new ArgumentException ("The unit/symbol '" + unitSymbol + "' was not found in the UnitConverter. Add this unit to the database for compatability."); + + } + + #endregion + #region "Group related methods" + + // Gets a value that determines whether the given units are compatible or not. + public bool IsCompatible (string leftSymbol, string rightSymbol) + { + if (string.IsNullOrEmpty (leftSymbol) || string.IsNullOrEmpty (rightSymbol)) { + throw new ArgumentException ("The left and right symbol values cannot be empty or null."); + } + Contract.EndContractBlock (); + + Unit leftUnit = this.GetUnitBySymbol (leftSymbol); + Unit rightUnit = this.GetUnitBySymbol (rightSymbol); + + if ((leftUnit == null) || (rightUnit == null)) { + return false; + } + + return (this.GetUnitType (leftUnit.Name) == this.GetUnitType (rightUnit.Name)); + } + + // Creates a new unit group and adds it to the group table. + Result CreateNewGroup (string groupName) + { + //Create the new group + var newType = new UnitType { Name = groupName }; + + //Add it to the group table + this._UnitTypeDictionary.Add (groupName, newType); + + return Result.NoError; + } + + // Adds the named unit to the specified group. + Result AddUnitToGroup (string unitName, string unitTypeName) + { + Unit unit = this._UnitDictionary [unitName]; + UnitType group = this._UnitTypeDictionary [unitTypeName]; + + //Make sure the unit exists. + if (unit == null) { + return Result.UnitNotFound; + } + + //Make sure the group exists. + if (group == null) { + return Result.GroupNotFound; + } + + //Add the unit. + group.Units.Add (unit); + + return Result.NoError; + } + + // Given the name of a unit, searches for the unit group it belongs to. + UnitType GetUnitType (string unitName) + { + if (string.IsNullOrEmpty (unitName)) { + throw new ArgumentException ("unitName must have a value"); + } + Contract.EndContractBlock (); + + //Does the unit even exist? + if (this._UnitDictionary.ContainsKey (unitName) == false) { + return null; + } else { + //Iterate through every group + var unitPro = new UnitProvider (); + foreach (var ut in unitPro.UnitTypes) { + if (ut.Value.Units.Contains (new Unit { Name = unitName })) { + return ut.Value; + } + } + return null; + } + } + + #endregion + #region "Conversion methods" + + // Performs a unit conversion between two units, given a value to convert. + public Measurement ConvertUnits (double value, string currentUnitName, string targetUnitName) + { + double x = value; + + //Default to the fail safe value. + double output = 0; + output = _failsafeValue; + + if (string.IsNullOrEmpty (currentUnitName) || string.IsNullOrEmpty (targetUnitName)) { + return new Measurement (0, Result.BadUnit); + } + + Unit currentUnit = GetUnitBySymbol (currentUnitName); + Unit targetUnit = GetUnitBySymbol (targetUnitName); + + //Make sure both units are real units. + if ((currentUnit == null) || (targetUnit == null)) { + return new Measurement (output, Result.BadUnit); + } + + //Make sure the units are of the same group + if (!this.IsCompatible (currentUnit.Name, targetUnit.Name)) { + return new Measurement (output, Result.UnitMismatch); + } + + return ConvertCurrentToTarget (x, currentUnit.Name, targetUnit.Name); + } + + // Performs a unit conversion from the standard value into the specified unit. + public Measurement ConvertCurrentToTarget (double value, string currentUnitName, string targetUnitName) + { + double x = value; + + //Default to the fail safe value. + double output = 0; + output = _failsafeValue; + + if (string.IsNullOrEmpty (targetUnitName)) { + return new Measurement (0, Result.BadUnit); + } + + Unit currentUnit = GetUnitBySymbol (currentUnitName); + Unit targetUnit = GetUnitBySymbol (targetUnitName); + + //Make sure both units are real units. + if (targetUnit == null) { + return new Measurement (output, Result.BadUnit); + } + + try { + var moders = from m in targetUnit.Modifiers + where m.UnitSourceID == currentUnit.ID && m.UnitTargetID == targetUnit.ID + orderby m.Order + select m; + + foreach (var moder in moders) { + int m_intPrecision = 15; + + if (moder.Precision != null) { + m_intPrecision = Convert.ToInt32 (moder.Precision); + } + + switch (moder.ModifierType) { + case ModifierType.PreAdd: + x = x - (double)moder.Value; + break; + case ModifierType.Multiply: + if (moder.Value > 0) { + x = System.Math.Round (x * (double)moder.Value, m_intPrecision); + } + break; + case ModifierType.Divide: + if (moder.Value > 0) { + x = System.Math.Round (x / (double)moder.Value, m_intPrecision); + } + break; + case ModifierType.Add: + x = System.Math.Round (x + (double)moder.Value, m_intPrecision); + break; + case ModifierType.Subtract: + x = System.Math.Round (x - (double)moder.Value, m_intPrecision); + break; + } + } + + output = x; + } catch { + //Probably overflowed or something. + return new Measurement (output, Result.BadValue); + } + + return new Measurement (output, targetUnit); + } + + #endregion + #region "Parsing routines" + + // Parses a number string with operators. + ConversionResult ParseNumberString(string input) + { + if (string.IsNullOrEmpty(input)) { + throw new ArgumentException("input must have a value"); + } + + //Default value + double value = 0; + value = 0; + + //Split the numbers on the ^ operator + string[] numbers = null; + numbers = input.Split(new char[] { '^' }); + + if (numbers.Length == 1) { + //Only one value, so there was no ^ operator present, so just return the one number. + try { + value = Convert.ToDouble(numbers[0]); + } catch { + return new ConversionResult(0, Result.BadValue); + } + } else { + //There is a ^ operator, so try to use it. + try { + value = Convert.ToDouble(numbers[0]); + value = Convert.ToDouble(System.Math.Pow(value, Convert.ToDouble(numbers[1]))); + } catch { + return new ConversionResult(0, Result.BadValue); + + } + } + + return new ConversionResult(value); + } + + // Given a string in the format "[value] [unit]", splits and returns the parts. + public Measurement ParseUnitString (string input) + { + //Defaults + double value = 0; + string symbol = null; + value = 0; + symbol = ""; + + if (string.IsNullOrEmpty (input)) { + return new Measurement (0, Result.BadValue); + } + + int i = 0; + + string s1 = ""; + string s2 = ""; + + //Look for the first letter or punctuation character. + i = 0; + while (i < input.Length) { + if (Char.IsLetter (input, i) || char.IsPunctuation (input, i) || char.IsSymbol (input, i)) { + if (input [i] != Convert.ToChar (".") && input [i] != Convert.ToChar ("-")) { + break; // TODO: might not be correct. Was : Exit While + } + } + System.Math.Max (System.Threading.Interlocked.Increment(ref i), i - 1); + } + + s1 = input.Substring (0, i); + s1 = s1.Trim (); + s2 = input.Substring (i); + s2 = s2.Trim (); + + //No value? default to 0 + if (string.IsNullOrEmpty (s1)) { + s1 = "0"; + } + + try { + value = Convert.ToDouble (s1); + } catch { + return new Measurement (0, Result.BadValue); + } + + try { + this.GetUnitBySymbol (s2); + } catch (Exception) { + return new Measurement (0, Result.BadUnit); + } + + symbol = s2; + + return new Measurement (value, symbol); + } + + #endregion + } +} \ No newline at end of file diff --git a/Units/UnitData.xml b/Cubico/UnitData.xml similarity index 100% rename from Units/UnitData.xml rename to Cubico/UnitData.xml diff --git a/Cubico/UnitProvider.cs b/Cubico/UnitProvider.cs new file mode 100644 index 0000000..9e8b097 --- /dev/null +++ b/Cubico/UnitProvider.cs @@ -0,0 +1,401 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Xml; + +namespace Cubico +{ + // Facilitates the loading and caching of the unit of measure data. + public class UnitProvider + { + #region "Constructors" + + public UnitProvider () + { + if (_dataFile == null) { + this.LoadDataFile (); + } + } + + #endregion + #region "Properties" + + static XmlDocument _dataFile; + + protected XmlDocument DataFile { + get{ return _dataFile;} + set{ _dataFile = value;} + } + + //Singleton + static Dictionary _unitTypes; + + public Dictionary UnitTypes { + get { + if (_unitTypes == null) { + GetAllUnitTypes (); + } + return _unitTypes; + } + } + + Dictionary _units; + + public Dictionary Units { + get { + if (_units == null) { + _units = GetAllUnits (); + } + return _units; + } + } + + static Dictionary> _individualModifiers; + static Dictionary _symbols; + static Dictionary _individualSymbols; + static Dictionary> _symbolLookUp; + + public Dictionary Symbols { + get { + if (_symbols == null) { + _symbols = GetAllSymbols (); + } + return _symbols; + } + } + + #endregion + #region "Methods" + #region "File Load Methods" + + void LoadDataFile () + { + const string fileName = "Cubico.UnitData.xml"; + var assembly = Assembly.GetExecutingAssembly (); + var stream = assembly.GetManifestResourceStream (fileName); + + if (stream == null) { + throw new FileNotFoundException ("Cannot find unit data file", fileName); + } + + _dataFile = new XmlDocument (); + _dataFile.Load (stream); + + this.ProcessUnitConverterData (); + } + + void ProcessUnitConverterData () + { + foreach (XmlNode node in this.DataFile.ChildNodes) { + if (node.Name == "UnitConverterData") { + ProcessDataTypes (node); + } + } + } + + void ProcessDataTypes (XmlNode parentNode) + { + foreach (XmlNode node in parentNode.ChildNodes) { + switch (node.Name) { + case "UnitTypes": + ProcessUnitTypes (node); + break; + case "Units": + ProcessUnits (node); + break; + case "Symbols": + ProcessUnitSymbols (node); + break; + case "UnitModifiers": + ProcessUnitModifiers (node); + break; + } + } + } + + void ProcessUnitModifiers (XmlNode parentNode) + { + _individualModifiers = new Dictionary> (); + + foreach (XmlNode node in parentNode.ChildNodes) { + if (node.Name == "UnitModifier") { + var mod = new Modifier (); + + foreach (XmlAttribute attrib in node.Attributes) { + switch (attrib.Name) { + case "ID": + mod.ID = Convert.ToInt32 (attrib.Value); + break; + case "Value": + mod.Value = Convert.ToDecimal (attrib.Value); + break; + case "Order": + mod.Order = Convert.ToInt32 (attrib.Value); + break; + case "ModifierID": + mod.ModifierType = (ModifierType)Convert.ToInt32 (attrib.Value); + break; + case "UnitSourceID": + mod.UnitSourceID = Convert.ToInt32 (attrib.Value); + break; + case "UnitTargetID": + mod.UnitTargetID = Convert.ToInt32 (attrib.Value); + break; + case "Precision": + mod.Precision = Convert.ToInt32 (attrib.Value); + break; + } + + } + + if (_individualModifiers.ContainsKey (mod.UnitTargetID)) { + var data = _individualModifiers [mod.UnitTargetID]; + data.Add (mod); + } else { + var data = new List { mod }; + _individualModifiers.Add (mod.UnitTargetID, data); + } + + } + } + } + + void ProcessUnitSymbols (XmlNode parentNode) + { + _symbolLookUp = new Dictionary> (); + foreach (XmlNode node in parentNode.ChildNodes) { + if (node.Name == "UnitSymbol") { + var sym = new Cubico.Symbol (); + + foreach (XmlAttribute attrib in node.Attributes) { + switch (attrib.Name) { + case "ID": + sym.Id = Convert.ToInt32 (attrib.Value); + break; + case "Symbol": + sym.Value = attrib.Value; + break; + case "UnitID": + sym.UnitId = Convert.ToInt32 (attrib.Value); + break; + case "IsDefault": + int value = Convert.ToInt32 (attrib.Value); + if (value == 1) + sym.IsDefault = true; + else + sym.IsDefault = false; + + break; + } + + } + + if (_symbolLookUp.ContainsKey (sym.UnitId)) { + var data = _symbolLookUp [sym.UnitId]; + data.Add (sym); + } else { + var data = new List { sym }; + _symbolLookUp.Add (sym.UnitId, data); + } + } + } + } + + void ProcessUnits (XmlNode parentNode) + { + _units = new Dictionary (); + foreach (XmlNode node in parentNode.ChildNodes) { + + if (node.Name == "Unit") { + var unit = new Unit (); + + foreach (XmlAttribute attrib in node.Attributes) { + switch (attrib.Name) { + case "ID": + unit.ID = Convert.ToInt32 (attrib.Value); + break; + case "Name": + unit.Name = attrib.Value; + break; + case "UnitTypeID": + unit.UnitTypeID = Convert.ToInt32 (attrib.Value); + break; + } + + } + + if (_symbolLookUp.ContainsKey (unit.ID)) { + unit.Symbols = _symbolLookUp [unit.ID]; + + foreach (Symbol sym in unit.Symbols) { + sym.Unit = unit; + } + } + if (_individualModifiers.ContainsKey (unit.ID)) { + unit.Modifiers = _individualModifiers [unit.ID]; + + foreach (Modifier mod in unit.Modifiers) { + mod.ParentUnit = unit; + } + } + _units.Add (unit.Name, unit); + + } + } + } + + void ProcessUnitTypes (XmlNode parentNode) + { + _unitTypes = new Dictionary (); + foreach (XmlNode node in parentNode.ChildNodes) { + if (node.Name == "UnitType") { + var ut = new UnitType (); + + foreach (XmlAttribute attrib in node.Attributes) { + switch (attrib.Name) { + case "ID": + ut.ID = Convert.ToInt32 (attrib.Value); + break; + case "Name": + ut.Name = attrib.Value; + break; + case "Description": + ut.Description = attrib.Value; + break; + } + + } + + // Make this a for loop for speed reasons or use a multikey dictionary. + var unitData = (from unit in _units.Values + where unit.UnitTypeID == ut.ID + select unit).ToList (); + ut.Units = unitData; + + foreach (Unit unitItem in ut.Units) { + unitItem.UnitType = ut; + } + + _unitTypes.Add (ut.Name, ut); + + } + } + } + + #endregion + #region "UnitTypes" + + //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available + void GetAllUnitTypes () + { + } + + #endregion + #region "Units" + + //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available + Dictionary GetAllUnits () + { + var unitDict = new Dictionary (); + var unitPro = new UnitProvider (); + var query = from s in unitPro.UnitTypes select s; + + + foreach (var itm in query) { + UnitType ut = itm.Value; + + foreach (var un in ut.Units) { + if (!unitDict.ContainsKey (un.Name)) { + unitDict.Add (un.Name, un); + } + } + //Units "Celsius" + } + //UnitTypes "Temperature" + + return unitDict; + } + + #endregion + #region "Symbols" + + + public Dictionary IndividualSymbols { + get { + if (_individualSymbols == null) { + _individualSymbols = GetAllIndividualSymbols (); + } + return _individualSymbols; + } + } + + //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available + Dictionary GetAllSymbols () + { + var unitDict = new Dictionary (); + var query = from s in this.UnitTypes select s; + + foreach (var itm in query) { + UnitType ut = itm.Value; + + foreach (var un in ut.Units) { + Unit unit = un; + + if (unit.Symbols == null || unit.Symbols.Count == 0) { + //No symbols. Add name of unit as symbol. + if (!unitDict.ContainsKey (unit.Name)) { + unitDict.Add (unit.Name, unit); + } + } else { + foreach (var sy in unit.Symbols) { + if (!unitDict.ContainsKey (sy.Value)) { + unitDict.Add (sy.Value, unit); + } + } + //Symbols "C" + + if (!unitDict.ContainsKey (unit.Name)) { + unitDict.Add (unit.Name, unit); + //Add name as symbol just in case + } + } + } + //Units "Celsius" + } + //UnitTypes "Temperature" + + return unitDict; + } + + //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available + Dictionary GetAllIndividualSymbols () + { + var unitDict = new Dictionary (); + var unitPro = new UnitProvider (); + var query = from s in unitPro.UnitTypes select s; + + + foreach (var itm in query) { + UnitType ut = itm.Value; + + + foreach (var un in ut.Units) { + Unit unit = un; + + foreach (var us in unit.Symbols) { + if (!unitDict.ContainsKey (us.Value)) { + unitDict.Add (us.Value, us); + } + } + } + } + + return unitDict; + } + + #endregion + #endregion + } +} \ No newline at end of file diff --git a/Units/UnitType.cs b/Cubico/UnitType.cs similarity index 55% rename from Units/UnitType.cs rename to Cubico/UnitType.cs index db9c284..ccfb07c 100644 --- a/Units/UnitType.cs +++ b/Cubico/UnitType.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Specialized; -using System.ComponentModel; using System.Runtime.Serialization; using System.Collections.Generic; -namespace Units +namespace Cubico { [DataContract(IsReference = true)] [KnownType(typeof(Unit))] @@ -12,134 +10,136 @@ namespace Units public partial class UnitType : IEquatable { #region "Constructors" - public UnitType() : base() - { + public UnitType () : base() + { } - #endregion + #endregion #region "Primitive Properties" - private int _iD; + int _iD; + [DataMember()] public int ID { get { return _iD; } set { - if (!Equals(_iD, value)) { + if (!Equals (_iD, value)) { _iD = value; } } } - private string _name; + string _name; + [DataMember()] public string Name { get { return _name; } set { - if (!Equals(_name, value)) { + if (!Equals (_name, value)) { _name = value; } } } - private string _description; + string _description; + [DataMember()] public string Description { get { return _description; } set { - if (!Equals(_description, value)) { + if (!Equals (_description, value)) { _description = value; } } } - #endregion - #region "Navigation Properties" [DataMember()] public List Units { get { if (_units == null && IsSerializing == false) { - _units = new List(); - } + _units = new List (); + } return _units; } set { - if (!object.ReferenceEquals(_units, value)) { + if (!object.ReferenceEquals (_units, value)) { _units = value; } } } + List _units; - private List _units; #endregion - #region "ChangeTracking" - - private bool _isDeserializing; + + bool _isDeserializing; + protected bool IsDeserializing { get { return _isDeserializing; } - private set { _isDeserializing = value; } + set { _isDeserializing = value; } } [OnDeserializing()] - public void OnDeserializingMethod(StreamingContext context) + public void OnDeserializingMethod (StreamingContext context) { IsDeserializing = true; } [OnDeserialized()] - public void OnDeserializedMethod(StreamingContext context) + public void OnDeserializedMethod (StreamingContext context) { IsDeserializing = false; } - private bool _isSerializing = false; + bool _isSerializing = false; + protected bool IsSerializing { get { return _isSerializing; } - private set { _isSerializing = value; } + set { _isSerializing = value; } } [OnSerializing()] - public void OnSerializingMethod(StreamingContext context) + public void OnSerializingMethod (StreamingContext context) { IsSerializing = true; } [OnSerialized()] - public void OnSerializedMethod(StreamingContext context) + public void OnSerializedMethod (StreamingContext context) { IsSerializing = false; } - protected virtual void ClearNavigationProperties() + protected virtual void ClearNavigationProperties () { - Units.Clear(); + Units.Clear (); } #endregion - #region "IEquatable(Of UnitType)" - public override int GetHashCode() + + public override int GetHashCode () { - return (this.Name).GetHashCode(); + return (this.Name).GetHashCode (); } - public override bool Equals(object obj) + public override bool Equals (object obj) { - if (obj == null || !object.ReferenceEquals(obj.GetType(), typeof(UnitType))) { + if (obj == null || !object.ReferenceEquals (obj.GetType(), typeof(UnitType))) { return false; } UnitType unitTypeObj = (UnitType)obj; - return this.Equals(unitTypeObj); + return this.Equals (unitTypeObj); } - public bool Equals(UnitType other) + public bool Equals (UnitType other) { if ((object)other == null) { return false; @@ -152,22 +152,22 @@ public bool Equals(UnitType other) } } - public static bool operator !=(UnitType left, UnitType right) + public static bool operator != (UnitType left, UnitType right) { - return !(left == right); + return !(left == right); } - public static bool operator ==(UnitType left, UnitType right) + public static bool operator == (UnitType left, UnitType right) { - if (object.ReferenceEquals(left, right)) { + if (object.ReferenceEquals (left, right)) { return true; } else if ((object)left == null || (object)right == null) { return false; } else { - return left.Equals(right); + return left.Equals (right); } } + #endregion } - } \ No newline at end of file diff --git a/Readme.txt b/Readme.txt deleted file mode 100644 index da9046d..0000000 --- a/Readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -README - -Version 0.1 -A .Net based Unit Conversion API that is web service friendly and comprehensive, yet easy to program against. \ No newline at end of file diff --git a/Units.Test/ConversionResultTest.cs b/Units.Test/ConversionResultTest.cs deleted file mode 100644 index 361850e..0000000 --- a/Units.Test/ConversionResultTest.cs +++ /dev/null @@ -1,284 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - -[TestClass()] -public class ConversionResultTest -{ - - - private TestContext testContextInstance; - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ - //Public Sub MyTestCleanup() - //End Sub - // - #endregion - - #region "ConversionResult.ConversionResult()" - [TestMethod()] - public void ConversionResultConstructorTest() - { - ConversionResult res = new ConversionResult(); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - #endregion - - #region "ConversionResult.ConversionResult(Double)" - [TestMethod()] - public void ConversionResultConstructorDoubleTest() - { - ConversionResult res = new ConversionResult(10.5); - - Assert.IsNotNull(res); - Assert.AreEqual(10.5, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorDoubleZeroTest() - { - ConversionResult res = new ConversionResult((double)0); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - #endregion - - #region "ConversionResult.ConversionResult(Double, String)" - [TestMethod()] - public void ConversionResultConstructorDoubleStringTest() - { - ConversionResult res = new ConversionResult(10.5, "lb"); - - Assert.IsNotNull(res); - Assert.AreEqual(10.5, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual("lb", res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorDoubleStringNullTest() - { - ConversionResult res = new ConversionResult(0, Convert.ToString(null)); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorDoubleStringNullTest2() - { - ConversionResult res = new ConversionResult(10.5, Convert.ToString(null)); - - Assert.IsNotNull(res); - Assert.AreEqual(10.5, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorDoubleStringZeroTest3() - { - ConversionResult res = new ConversionResult(0, "lb"); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual("lb", res.Symbol); - } - #endregion - - #region "ConversionResult.ConversionResult(Double, Result)" - [TestMethod()] - public void ConversionResultConstructorDoubleResultTest() - { - ConversionResult res = new ConversionResult(10.5, Result.GenericError); - - Assert.IsNotNull(res); - Assert.AreEqual(10.5, res.Value); - Assert.AreEqual(Result.GenericError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorDoubleResultNullTest() - { - ConversionResult res = new ConversionResult(0, (Result)0); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorDoubleResultNullTest2() - { - ConversionResult res = new ConversionResult(10.5, (Result)0); - - Assert.IsNotNull(res); - Assert.AreEqual(10.5, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorDoubleResultNullTest3() - { - ConversionResult res = new ConversionResult(0, Result.GenericError); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.GenericError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - #endregion - - #region "ConversionResult.ConversionResult(Result)" - [TestMethod()] - public void ConversionResultConstructorResultTest() - { - ConversionResult res = new ConversionResult(Result.GenericError); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.GenericError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - - [TestMethod()] - public void ConversionResultConstructorResultNullTest() - { - ConversionResult res = new ConversionResult(0.0); - - Assert.IsNotNull(res); - Assert.AreEqual(0, res.Value); - Assert.AreEqual(Result.NoError, res.Result); - Assert.AreEqual(null, res.Symbol); - } - #endregion - - #region "ConversionResult.Result" - [TestMethod()] - public void ConversionResultResultTest() - { - ConversionResult res = new ConversionResult(Result.GenericError); - - Assert.IsNotNull(res); - Assert.AreEqual(Result.GenericError, res.Result); - - res.Result = Result.UnitNotFound; - - Assert.AreEqual(Result.UnitNotFound, res.Result); - } - - [TestMethod()] - public void ConversionResultResultNullTest() - { - ConversionResult res = new ConversionResult(Result.GenericError); - - Assert.IsNotNull(res); - Assert.AreEqual(Result.GenericError, res.Result); - - res.Result = Result.NoError; - - Assert.AreEqual(Result.NoError, res.Result); - } - #endregion - - #region "ConversionResult.Value" - [TestMethod()] - public void ConversionResultValueTest() - { - ConversionResult res = new ConversionResult(12.1); - - Assert.IsNotNull(res); - Assert.AreEqual(12.1, res.Value); - - res.Value = 0.33; - - Assert.AreEqual(0.33, res.Value); - } - - [TestMethod()] - public void ConversionResultValueNullTest() - { - ConversionResult res = new ConversionResult(12.1); - - Assert.IsNotNull(res); - Assert.AreEqual(12.1, res.Value); - - res.Value = 0.0; - - Assert.AreEqual(0, res.Value); - } - #endregion - - #region "ConversionResult.Symbol" - [TestMethod()] - public void ConversionResultSymbolTest() - { - ConversionResult res = new ConversionResult(12.1, "ft"); - - Assert.IsNotNull(res); - Assert.AreEqual("ft", res.Symbol); - - res.Symbol = "C"; - - Assert.AreEqual("C", res.Symbol); - } - - [TestMethod()] - public void ConversionResultSymbolNullTest() - { - ConversionResult res = new ConversionResult(12.1, "ft"); - - Assert.IsNotNull(res); - Assert.AreEqual("ft", res.Symbol); - - res.Symbol = null; - - Assert.AreEqual(null, res.Symbol); - } - #endregion -} - diff --git a/Units.Test/Cubico.Test.csproj b/Units.Test/Cubico.Test.csproj deleted file mode 100644 index 491fd69..0000000 --- a/Units.Test/Cubico.Test.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - - Debug - AnyCPU - {720BF499-D91E-4A86-82C0-D072C8EE00E1} - Library - Properties - Cubico.Test - Cubico.Test - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {5c21f8e4-02c4-4614-97c7-1899f4e6e634} - Cubico - - - - - - - False - - - False - - - False - - - False - - - - - - - - \ No newline at end of file diff --git a/Units.Test/MeasurementTests.cs b/Units.Test/MeasurementTests.cs deleted file mode 100644 index b134eb1..0000000 --- a/Units.Test/MeasurementTests.cs +++ /dev/null @@ -1,1518 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - -/// -///This is a test class for MeasurementTest and is intended -///to contain all MeasurementTest Unit Tests -/// -[TestClass()] -public class MeasurementTests -{ - - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ - //Public Sub MyTestCleanup() - //End Sub - // - #endregion - - #region "Measurement.Value" - /// - ///A test for Value - /// - [TestMethod()] - public void MeasurementValueTest() - { - double expected = 10; - Measurement target = new Measurement(expected, "ft"); - double actual = 0; - actual = target.Value; - - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Unit" - /// - ///A test for Unit - /// - [TestMethod()] - public void MeasurementUnitTest() - { - Unit expected = unitPro.Units["Feet"]; - Measurement target = new Measurement(10, "ft"); - Unit actual = default(Unit); - actual = target.Unit; - - Assert.AreEqual(expected.Name, actual.Name); - } - #endregion - - #region "Measurement.Symbol" - /// - ///A test for Symbol - /// - [TestMethod()] - public void MeasurementSymbolTest() - { - string expected = "ft"; - Measurement target = new Measurement(10, expected); - string actual = null; - actual = target.Symbol; - - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementSymbolNullTest() - { - string expected = null; - Measurement target = new Measurement(10, expected); - string actual = null; - actual = target.Symbol; - - } - #endregion - - #region "Measurement.IsValid" - /// - ///A test for IsValid - /// - [TestMethod()] - public void MeasurementIsValidTest() - { - bool expected = true; - Measurement target = new Measurement(10, "ft"); - bool actual = false; - actual = target.IsValid; - - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementIsValidNullTest() - { - bool expected = false; - Measurement target = new Measurement(null); - bool actual = false; - actual = target.IsValid; - - Assert.AreEqual(expected, actual); - } - - //[TestMethod()] - //public void MeasurementIsValidNullTest2() - //{ - // bool expected = false; - // Measurement target = null; - // bool actual = false; - // actual = target.IsValid; - - // Assert.AreEqual(expected, actual); - // Assert.IsTrue(target == null); - // Assert.IsFalse(target != null); - //} - - [TestMethod()] - public void MeasurementIsValidBadUnitTest() - { - bool expected = false; - Measurement target = new Measurement(10, "ft", Result.BadUnit); - bool actual = false; - actual = target.IsValid; - - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.FullValue" - /// - ///A test for FullValue - /// - [TestMethod()] - public void MeasurementFullValueTest() - { - string expected = "10ft"; - Measurement target = new Measurement(10, "ft"); - string actual = null; - actual = target.FullValue; - - Assert.AreEqual(expected, actual); - } - - // _ - //Public Sub MeasurementFullValueNullTest() - // Dim expected As String = "10" - // Dim target As Measurement = New Measurement(10, DirectCast(Nothing, String)) - // Dim actual As String - // actual = target.FullValue - - // Assert.AreEqual(Of String)(expected, actual) - //End Sub - #endregion - - #region "Measurement.Flags" - /// - ///A test for Flags - /// - [TestMethod()] - public void MeasurementFlagsTest() - { - Measurement target = new Measurement(10, "ft"); - MeasurementFlags expected = MeasurementFlags.UseMaxBound; - MeasurementFlags actual = default(MeasurementFlags); - target.Flags = expected; - actual = target.Flags; - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Converter" - /// - ///A test for Converter - /// - [TestMethod()] - public void MeasurementConverterTest() - { - Measurement target = new Measurement(10, "ft"); - UnitConverter actual = default(UnitConverter); - actual = target.Converter; - - Assert.IsNotNull(actual); - } - #endregion - - #region "Measurement.ConversionResult" - /// - ///A test for ConversionResult - /// - [TestMethod()] - public void MeasurementConversionResultTest() - { - Measurement target = new Measurement(10, "ft"); - Result expected = Result.GroupNotFound; - Result actual = default(Result); - target.ConversionResult = expected; - actual = target.ConversionResult; - - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementConversionResultNullTest() - { - Measurement target = new Measurement(10, "ft"); - Result expected = Result.NoError; - Result actual = default(Result); - target.ConversionResult = Result.NoError; - actual = target.ConversionResult; - - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.ValidateEntry(Value,Symbol)" - /// - ///A test for ValidateEntry - /// - [TestMethod()] - public void MeasurementValidateEntryValueSymbolTest() - { - Measurement target = new Measurement(10, "ft"); - double value = 100; - string symbol = "in"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.ValidateEntry(value, symbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementValidateEntryValueSymbolIncompatibleTest() - { - Measurement target = new Measurement(10, "ft"); - double value = 100; - string symbol = "hr"; - Result expected = Result.UnitMismatch; - Result actual = default(Result); - actual = target.ValidateEntry(value, symbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementValidateEntryValueSymbolMaxTest() - { - Measurement target = new Measurement(10, "ft"); - target.SetMaxBound(100, "ft"); - target.Flags = MeasurementFlags.UseMaxBound; - double value = 200; - string symbol = "ft"; - Result expected = Result.ValueTooHigh; - Result actual = default(Result); - actual = target.ValidateEntry(value, symbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementValidateEntryValueSymbolMinTest() - { - Measurement target = new Measurement(10, "ft"); - target.SetMinBound(5, "ft"); - target.Flags = MeasurementFlags.UseMinBound; - double value = 1; - string symbol = "ft"; - Result expected = Result.ValueTooLow; - Result actual = default(Result); - actual = target.ValidateEntry(value, symbol); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.ValidateEntry(entry)" - /// - ///A test for ValidateEntry - /// - [TestMethod()] - public void MeasurementValidateEntrySymbolTest() - { - Measurement target = new Measurement(10, "ft"); - string entry = "100in"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.ValidateEntry(entry); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementValidateEntrySymbolIncompatibleTest() - { - Measurement target = new Measurement(10, "ft"); - string entry = "100hr"; - Result expected = Result.UnitMismatch; - Result actual = default(Result); - actual = target.ValidateEntry(entry); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementValidateEntrySymbolMaxTest() - { - Measurement target = new Measurement(10, "ft"); - target.SetMaxBound(100, "ft"); - target.Flags = MeasurementFlags.UseMaxBound; - string entry = "200ft"; - Result expected = Result.ValueTooHigh; - Result actual = default(Result); - actual = target.ValidateEntry(entry); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementValidateEntrySymbolMinTest() - { - Measurement target = new Measurement(10, "ft"); - target.SetMinBound(5, "ft"); - target.Flags = MeasurementFlags.UseMinBound; - string entry = "1ft"; - Result expected = Result.ValueTooLow; - Result actual = default(Result); - actual = target.ValidateEntry(entry); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.ToString" - /// - ///A test for ToString - /// - [TestMethod()] - public void MeasurementToStringTest() - { - Measurement target = new Measurement(10, "ft"); - string expected = "10ft"; - string actual = null; - actual = target.ToString(); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.SetValue(measurementString)" - /// - ///A test for SetValue - /// - [TestMethod()] - public void MeasurementSetValueStringTest() - { - Measurement target = new Measurement("ft"); - string measurement = "10ft"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetValue(measurement); - Assert.AreEqual(expected, actual); - Assert.AreEqual(10, target.Value); - } - - [TestMethod()] - public void MeasurementSetValueStringTest2() - { - Measurement target = new Measurement("ft"); - string measurement = "12in"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetValue(measurement); - Assert.AreEqual(expected, actual); - Assert.AreEqual(12, target.Value); - } - - [TestMethod()] - public void MeasurementSetValueStringTest3() - { - Measurement target = new Measurement("ft"); - target.Flags = MeasurementFlags.ForceUnit; - string measurement = "12in"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetValue(measurement); - Assert.AreEqual(expected, actual); - Assert.AreEqual(1, target.Value); - } - - [TestMethod()] - public void MeasurementSetValueStringInvalidTest() - { - Measurement target = new Measurement("ft"); - string measurement = "12hr"; - Result expected = Result.UnitMismatch; - Result actual = default(Result); - actual = target.SetValue(measurement); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetValueStringNullTest() - { - Measurement target = new Measurement("ft"); - Result actual = default(Result); - actual = target.SetValue((string)null); - Assert.Fail(); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetValueStringEmptyTest() - { - Measurement target = new Measurement("ft"); - Result actual = default(Result); - actual = target.SetValue(string.Empty); - Assert.Fail(); - } - #endregion - - #region "Measurement.SetValue(value)" - /// - ///A test for SetValue - /// - [TestMethod()] - public void MeasurementSetValueTest() - { - Measurement target = new Measurement("ft"); - double value = 15; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetValue(value); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.SetUnit(symbol)" - /// - ///A test for SetUnit - /// - [TestMethod()] - public void MeasurementSetUnitTest() - { - Measurement target = new Measurement("ft"); - string unitSymbol = "s"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetUnit(unitSymbol); - Assert.AreEqual(expected, actual); - Assert.AreEqual("Second", target.Unit.Name); - } - - [TestMethod()] - public void MeasurementSetUnitTest2() - { - Measurement target = new Measurement("ft"); - string unitSymbol = "ft"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetUnit(unitSymbol); - Assert.AreEqual(expected, actual); - Assert.AreEqual("Feet", target.Unit.Name); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetUnitNullTest() - { - Measurement target = new Measurement("ft"); - Result expected = Result.BadUnit; - Result actual = default(Result); - actual = target.SetUnit(null); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetUnitEmptyTest() - { - Measurement target = new Measurement("ft"); - Result expected = Result.BadUnit; - Result actual = default(Result); - actual = target.SetUnit(string.Empty); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.SetMinBound" - /// - ///A test for SetMinBound - /// - [TestMethod()] - public void MeasurementSetMinBoundTest() - { - Measurement target = new Measurement(10, "ft"); - double minbound = 0; - string unitSymbol = "ft"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetMinBound(minbound, unitSymbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementSetMinBoundTest2() - { - Measurement target = new Measurement(10, "ft"); - double minbound = 12; - string unitSymbol = "in"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetMinBound(minbound, unitSymbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetMinBoundNullTest() - { - Measurement target = new Measurement(10, "ft"); - Result actual; - actual = target.SetMinBound(0, null); - Assert.Fail(); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetMinBoundEmptyTest() - { - Measurement target = new Measurement(10, "ft"); - Result actual = default(Result); - actual = target.SetMinBound(1, string.Empty); - Assert.Fail(); - } - #endregion - - #region "Measurement.SetMaxBound" - /// - ///A test for SetMinBound - /// - [TestMethod()] - public void MeasurementSetMaxBoundTest() - { - Measurement target = new Measurement(10, "ft"); - double maxbound = 100; - string unitSymbol = "ft"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetMaxBound(maxbound, unitSymbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementSetMaxBoundTest2() - { - Measurement target = new Measurement(10, "ft"); - double maxbound = 8; - string unitSymbol = "in"; - Result expected = Result.NoError; - Result actual = default(Result); - actual = target.SetMaxBound(maxbound, unitSymbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetMaxBoundNullTest() - { - Measurement target = new Measurement(10, "ft"); - Result actual = default(Result); - actual = target.SetMinBound(0, null); - Assert.Fail(); - } - - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void MeasurementSetMaxBoundEmptyTest() - { - Measurement target = new Measurement(10, "ft"); - Result actual = default(Result); - actual = target.SetMinBound(1, string.Empty); - Assert.Fail(); - } - #endregion - - #region "Measurement.Operator -" - /// - ///A test for op_Subtraction - /// - [TestMethod()] - public void Measurementop_SubtractionTest() - { - Measurement d1 = new Measurement(5, "ft"); - Measurement d2 = new Measurement(5, "ft"); - Measurement expected = new Measurement(0, "ft"); - Measurement actual = default(Measurement); - actual = (d1 - d2); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_SubtractionDiffUnitTest() - { - Measurement d1 = new Measurement(5, "ft"); - Measurement d2 = new Measurement(60, "in"); - Measurement expected = new Measurement(0, "ft"); - Measurement actual = default(Measurement); - actual = (d1 - d2); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator *" - /// - ///A test for op_Multiply - /// - [TestMethod()] - public void Measurementop_MultiplyTest() - { - Measurement d1 = new Measurement(5, "ft"); - Measurement d2 = new Measurement(5, "ft"); - Measurement expected = new Measurement(25, "ft"); - Measurement actual = default(Measurement); - actual = (d1 * d2); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_MultiplyDiffUnitTest() - { - Measurement d1 = new Measurement(5, "ft"); - Measurement d2 = new Measurement(60, "in"); - Measurement expected = new Measurement(25, "ft"); - Measurement actual = default(Measurement); - actual = (d1 * d2); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator <=" - /// - ///A test for op_LessThanOrEqual - /// - [TestMethod()] - public void Measurementop_LessThanOrEqualTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(6, "ft"); - bool expected = true; - bool actual = false; - actual = (left <= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanOrEqualTest2() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(5, "ft"); - bool expected = true; - bool actual = false; - actual = (left <= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanOrEqualFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "ft"); - bool expected = false; - bool actual = false; - actual = (left <= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanOrEqualDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(600, "in"); - bool expected = true; - bool actual = false; - actual = (left <= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanOrEqualDiffUnitTest2() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(60, "in"); - bool expected = true; - bool actual = false; - actual = (left <= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanOrEqualFalseDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "in"); - bool expected = false; - bool actual = false; - actual = (left <= right); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator <" - /// - ///A test for op_LessThan - /// - [TestMethod()] - public void Measurementop_LessThanTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(6, "ft"); - bool expected = true; - bool actual = false; - actual = (left < right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(5, "ft"); - bool expected = false; - bool actual = false; - actual = (left < right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(400, "in"); - bool expected = true; - bool actual = false; - actual = (left < right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_LessThanFalseDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(60, "in"); - bool expected = false; - bool actual = false; - actual = (left < right); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator <>" - /// - ///A test for op_Inequality - /// - [TestMethod()] - public void Measurementop_InequalityTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "ft"); - bool expected = true; - bool actual = false; - actual = (left != right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_InequalityFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(5, "ft"); - bool expected = false; - bool actual = false; - actual = (left != right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_InequalityDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "in"); - bool expected = true; - bool actual = false; - actual = (left != right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_InequalityDiffUnitFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(60, "in"); - bool expected = false; - bool actual = false; - actual = (left != right); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator >=" - /// - ///A test for op_GreaterThanOrEqual - /// - [TestMethod()] - public void Measurementop_GreaterThanOrEqualTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "ft"); - bool expected = true; - bool actual = false; - actual = (left >= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanOrEqualTest2() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(5, "ft"); - bool expected = true; - bool actual = false; - actual = (left >= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanOrEqualFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(6, "ft"); - bool expected = false; - bool actual = false; - actual = (left >= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanOrEqualDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "in"); - bool expected = true; - bool actual = false; - actual = (left >= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanOrEqualDiffUnitTest2() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(60, "in"); - bool expected = true; - bool actual = false; - actual = (left >= right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanOrEqualDiffUnitFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(600, "in"); - bool expected = false; - bool actual = false; - actual = (left >= right); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator >" - /// - ///A test for op_GreaterThan - /// - [TestMethod()] - public void Measurementop_GreaterThanTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "ft"); - bool expected = true; - bool actual = false; - actual = (left > right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(5, "ft"); - bool expected = false; - bool actual = false; - actual = (left > right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "in"); - bool expected = true; - bool actual = false; - actual = (left > right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_GreaterThanDiffUnitFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(60, "in"); - bool expected = false; - bool actual = false; - actual = (left > right); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator =" - /// - ///A test for op_Equality - /// - [TestMethod()] - public void Measurementop_EqualityTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(5, "ft"); - bool expected = true; - bool actual = false; - actual = (left == right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_EqualityDiffUnitTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(60, "in"); - bool expected = true; - bool actual = false; - actual = (left == right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_EqualityFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(4, "ft"); - bool expected = false; - bool actual = false; - actual = (left == right); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_EqualityDiffUnitFalseTest() - { - Measurement left = new Measurement(5, "ft"); - Measurement right = new Measurement(61, "in"); - bool expected = false; - bool actual = false; - actual = (left == right); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator /" - /// - ///A test for op_Division - /// - [TestMethod()] - public void Measurementop_DivisionTest() - { - Measurement d1 = new Measurement(25, "ft"); - Measurement d2 = new Measurement(5, "ft"); - Measurement expected = new Measurement(5, "ft"); - Measurement actual = default(Measurement); - actual = (d1 / d2); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_DivisionDiffUnitTest() - { - Measurement d1 = new Measurement(25, "ft"); - Measurement d2 = new Measurement(60, "in"); - Measurement expected = new Measurement(5, "ft"); - Measurement actual = default(Measurement); - actual = (d1 / d2); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Operator +" - /// - ///A test for op_Addition - /// - [TestMethod()] - public void Measurementop_AdditionTest() - { - Measurement d1 = new Measurement(5, "ft"); - Measurement d2 = new Measurement(5, "ft"); - Measurement expected = new Measurement(10, "ft"); - Measurement actual = default(Measurement); - actual = (d1 + d2); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void Measurementop_AdditionDiffUnitTest() - { - Measurement d1 = new Measurement(5, "ft"); - Measurement d2 = new Measurement(60, "in"); - Measurement expected = new Measurement(10, "ft"); - Measurement actual = default(Measurement); - actual = (d1 + d2); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.GetValueAs(unitSymbol)" - /// - ///A test for GetValueAs - /// - //[TestMethod()] - //public void MeasurementGetValueAsTest() - //{ - // Measurement target = new Measurement(5, "ft"); - // string unitSymbol = "in"; - // Measurement expected = new Measurement(Convert.ToDecimal("60.0000"), "in"); - // Measurement actual = default(Measurement); - // actual = target.GetValueAs(unitSymbol); - // Assert.AreEqual(expected.Value, actual.Value); - // Assert.AreEqual(expected.ToString, actual.ToString); - //} - - [TestMethod()] - public void MeasurementGetValueAsInvalidUnitSymbolTest() - { - Measurement target = new Measurement(5, "ft"); - string unitSymbol = "F"; - Measurement actual = default(Measurement); - actual = target.GetValueAs(unitSymbol); - - Assert.IsTrue(actual.ConversionResult == Result.UnitMismatch); - Assert.IsTrue(actual.Value == 0); - Assert.IsTrue(actual.Value == 0); - } - #endregion - - #region "Measurement.GetStringValueAs(unitSymbol)" - /// - ///A test for GetStringValueAs - /// - [TestMethod()] - public void MeasurementGetStringValueAsTest() - { - Measurement target = new Measurement(5, "ft"); - string unitSymbol = "in"; - string expected = "60in"; - string actual = null; - actual = target.GetStringValueAs(unitSymbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementGetStringValueAsInvalidUnitSymbolTest() - { - Measurement target = new Measurement(10, "ft"); - string unitSymbol = "F"; - string expected = "Conversion Error"; - string actual = null; - actual = target.GetStringValueAs(unitSymbol); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.GetHashCode" - /// - ///A test for GetHashCode - /// - [TestMethod()] - public void MeasurementGetHashCodeTest() - { - Measurement target = new Measurement(10, "ft"); - - Measurement Mes = target.Converter.ConvertUnits(target.Value, target.Unit.DefaultSymbol, "m"); - - string expectedStr = null; - - if (Mes.ConversionResult != Result.NoError) - { - expectedStr = target.Value.ToString() + "|" + target.ConversionResult.ToString(); - } - else - { - expectedStr = Mes.Value.ToString() + "|" + Mes.Symbol; - } - - int expected = (expectedStr).GetHashCode(); - int actual = 0; - actual = target.GetHashCode(); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Equals(Of Measurement)" - /// - ///A test for Equals - /// - [TestMethod()] - public void MeasurementEqualsOfTest() - { - IEquatable target = new Measurement(5, "ft"); - Measurement other = new Measurement(60, "in"); - bool expected = true; - bool actual = false; - actual = target.Equals(other); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementEqualsOfTest2() - { - IEquatable target = new Measurement(5, "ft"); - Measurement other = new Measurement(5, "ft"); - bool expected = true; - bool actual = false; - actual = target.Equals(other); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementEqualsOfFalseTest() - { - IEquatable target = new Measurement(5, "ft"); - Measurement other = new Measurement(5, "in"); - bool expected = false; - bool actual = false; - actual = target.Equals(other); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementEqualsOfInvalidUnitTest() - { - IEquatable target = new Measurement(5, "ft"); - Measurement other = new Measurement(5, "F"); - bool expected = false; - bool actual = false; - actual = target.Equals(other); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Equals(obj)" - /// - ///A test for Equals - /// - [TestMethod()] - public void MeasurementEqualsTest() - { - Measurement target = new Measurement(5, "ft"); - object obj = new Measurement(5, "ft"); - bool expected = true; - bool actual = false; - actual = target.Equals(obj); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementEqualsTest2() - { - Measurement target = new Measurement(5, "ft"); - object obj = new Measurement(60, "in"); - bool expected = true; - bool actual = false; - actual = target.Equals(obj); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementEqualsFalseTest() - { - Measurement target = new Measurement(5, "ft"); - object obj = new Measurement(5, "in"); - bool expected = false; - bool actual = false; - actual = target.Equals(obj); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementEqualsInvalidTest() - { - Measurement target = new Measurement(5, "ft"); - object obj = new Measurement(5, "F"); - bool expected = false; - bool actual = false; - actual = target.Equals(obj); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementEqualsInvalidTypeTest() - { - Measurement target = new Measurement(5, "ft"); - object obj = 5; - bool expected = false; - bool actual = false; - actual = target.Equals(obj); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.CompareTo" - /// - ///A test for CompareTo - /// - [TestMethod()] - public void MeasurementCompareToTest() - { - IComparable target = new Measurement(5, "ft"); - Measurement other = new Measurement(5, "ft"); - int expected = 0; - int actual = 0; - actual = target.CompareTo(other); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementCompareToGreaterTest() - { - IComparable target = new Measurement(5, "ft"); - Measurement other = new Measurement(4, "ft"); - int expected = 1; - int actual = 0; - actual = target.CompareTo(other); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementCompareToGreaterDifferentUnitTest() - { - IComparable target = new Measurement(5, "ft"); - Measurement other = new Measurement(41, "in"); - int expected = 1; - int actual; - actual = target.CompareTo(other); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementCompareToLessTest() - { - IComparable target = new Measurement(5, "ft"); - Measurement other = new Measurement(6, "ft"); - int expected = -1; - int actual = 0; - actual = target.CompareTo(other); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void MeasurementCompareToGreaterLessUnitTest() - { - IComparable target = new Measurement(5, "ft"); - Measurement other = new Measurement(61, "in"); - int expected = -1; - int actual = 0; - actual = target.CompareTo(other); - Assert.AreEqual(expected, actual); - } - #endregion - - #region "Measurement.Measurement(Value, UnitSymbol)" - /// - ///A test for Measurement Constructor - /// - [TestMethod()] - public void MeasurementConstructorValueUnitSymbolTest() - { - double value = 10; - string unitSymbol = "ft"; - Measurement target = new Measurement(value, unitSymbol); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.AreEqual("Feet", target.Unit.Name); - Assert.AreEqual(10, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorValueUnitSymbolNullNullTest() - { - Measurement target = new Measurement(0, (string)null); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.BadUnit); - Assert.AreEqual(null, target.Unit); - Assert.AreEqual(0, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorValueUnitSymbolValueNullTest() - { - Measurement target = new Measurement(0, "ft"); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.AreEqual("Feet", target.Unit.Name); - Assert.AreEqual(0, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorValueUnitSymbolUnitSymbolNullTest() - { - Measurement target = new Measurement(10, (string)null); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.BadUnit); - Assert.AreEqual(null, target.Unit); - Assert.AreEqual(10, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorValueUnitSymbolEmptyTest() - { - Measurement target = new Measurement(10, string.Empty); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.BadUnit); - Assert.AreEqual(null, target.Unit); - Assert.AreEqual(10, target.Value); - } - #endregion - - #region "Measurement.Measurement(unitSymbol)" - /// - ///A test for Measurement Constructor - /// - [TestMethod()] - public void MeasurementConstructorUnitSymbolTest() - { - string unitSymbol = "ft"; - Measurement target = new Measurement(unitSymbol); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.AreEqual("Feet", target.Unit.Name); - Assert.AreEqual(0, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorUnitSymbolNullTest() - { - Measurement target = new Measurement(null); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.BadUnit); - Assert.AreEqual(null, target.Unit); - Assert.AreEqual(0, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorUnitSymbolEmptyTest() - { - Measurement target = new Measurement(null); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.BadUnit); - Assert.AreEqual(null, target.Unit); - Assert.AreEqual(0, target.Value); - } - #endregion - - #region "Measurement.Measurement(Value, UnitSymbol, ConversionResult)" - /// - ///A test for Measurement Constructor - /// - [TestMethod()] - public void MeasurementConstructorValueUnitSymbolResultTest() - { - double value = 10; - string unitSymbol = "ft"; - Result ConversionResult = Result.NoError; - Measurement target = new Measurement(value, unitSymbol, ConversionResult); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.AreEqual("Feet", target.Unit.Name); - Assert.AreEqual(10, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorValueUnitSymbolResultTest2() - { - double value = 10; - string unitSymbol = "ft"; - Result ConversionResult = Result.GenericError; - Measurement target = new Measurement(value, unitSymbol, ConversionResult); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.GenericError); - Assert.AreEqual("Feet", target.Unit.Name); - Assert.AreEqual(10, target.Value); - } - #endregion - - #region "Measurement.Measurement(Value,Unit,ConversionResult)" - /// - ///A test for Measurement Constructor - /// - [TestMethod()] - public void MeasurementConstructorValueUnitConversionResultTest() - { - double value = 10; - Unit unit = unitPro.Units["Feet"]; - Result ConversionResult = Result.NoError; - Measurement target = new Measurement(value, unit, ConversionResult); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.AreEqual("Feet", target.Unit.Name); - Assert.AreEqual(10, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorValueUnitConversionResultNullTest() - { - Measurement target = new Measurement(0, (Unit)null, Result.NoError); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.IsNull(target.Unit); - Assert.AreEqual(0, target.Value); - } - #endregion - - #region "Measurement.Measurement(Value,Result)" - /// - ///A test for Measurement Constructor - /// - [TestMethod()] - public void MeasurementConstructorValueResultTest() - { - double value = 10; - Result ConversionResult = Result.NoError; - Measurement target = new Measurement(value, ConversionResult); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.IsNull(target.Unit); - Assert.AreEqual(10, target.Value); - } - - [TestMethod()] - public void MeasurementConstructorValueResultNullTest() - { - Measurement target = new Measurement(0, Result.NoError); - - Assert.IsNotNull(target); - Assert.IsTrue(target.Flags == MeasurementFlags.None); - Assert.IsTrue(target.ConversionResult == Result.NoError); - Assert.IsNull(target.Unit); - Assert.AreEqual(0, target.Value); - } - #endregion -} - diff --git a/Units.Test/ModifierTest.cs b/Units.Test/ModifierTest.cs deleted file mode 100644 index eaa75c2..0000000 --- a/Units.Test/ModifierTest.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using Units; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -/// -///This is a test class for UnitTest and is intended -///to contain all UnitTest Unit Tests -/// -[TestClass()] -public class ModifierTest -{ - - - private TestContext testContextInstance; - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ - //Public Sub MyTestCleanup() - //End Sub - // - #endregion - - #region "Modifier.Modifier()" - [TestMethod()] - public void ModifierNewTest() - { - Modifier testObj = new Modifier(); - - Assert.IsNotNull(testObj); - Assert.IsTrue(testObj.ID == 0); - Assert.IsTrue(testObj.Value == 0); - Assert.IsNull(testObj.ParentUnit); - } - #endregion - - #region "Modifier.ID" - [TestMethod()] - public void ModifierIDTest() - { - Modifier testObj = new Modifier(); - - testObj.ID = 99; - - Assert.AreEqual(99, testObj.ID); - } - #endregion - - #region "Modifier.ParentUnit" - [TestMethod()] - public void ModifierParentUnitTest() - { - Unit testUnitObj = new Unit - { - ID = 99, - Name = "Name" - }; - Modifier testObj = new Modifier(); - - testObj.ParentUnit = testUnitObj; - - Assert.IsNotNull(testObj.ParentUnit); - Assert.AreEqual(testUnitObj.ID, testObj.ParentUnit.ID); - Assert.AreEqual(testUnitObj.Name, testObj.ParentUnit.Name); - } - - [TestMethod()] - public void ModifierParentUnitNullTest() - { - Modifier testObj = new Modifier(); - - testObj.ParentUnit = null; - - Assert.IsNull(testObj.ParentUnit); - } - #endregion - - #region "Modifier.Value" - [TestMethod()] - public void ModifierValueTest() - { - Modifier testObj = new Modifier(); - - testObj.Value = Convert.ToDecimal(0.001); - - Assert.AreEqual(Convert.ToDecimal(0.001), testObj.Value); - } - #endregion - - #region "Modifier.Order" - [TestMethod()] - public void ModifierOrderTest() - { - Modifier testObj = new Modifier(); - - testObj.Order = 10; - - Assert.AreEqual(10, testObj.Order); - } - - - #endregion - - #region "Modifier.ModifierType" - [TestMethod()] - public void ModifierTypeTest() - { - Modifier testObj = new Modifier(); - - testObj.ModifierType = ModifierType.Multiply; - - Assert.AreEqual(ModifierType.Multiply, testObj.ModifierType); - } - #endregion - - //Private Function InitEfObjects() As EFUnit - //Dim efUnitTypeObj As New EFUnitType - //efUnitTypeObj.ID = 10 - //efUnitTypeObj.Name = "Test Type" - //efUnitTypeObj.Description = "Test Desc" - - //Dim efUnitObj As New EFUnit - //efUnitObj.ID = 2 - //efUnitObj.Name = "Test Unit" - //efUnitObj.UnitType = efUnitTypeObj - - //Dim efUnitModifierObj As New EFUnitModifier - //efUnitModifierObj.ID = 2 - //efUnitModifierObj.ModifierID = 2 - //efUnitModifierObj.Order = 1 - //efUnitModifierObj.Value = 0.5 - - //Dim efUnitSymbolObj As New EFUnitSymbol - //efUnitSymbolObj.ID = 3 - //efUnitSymbolObj.IsDefault = True - //efUnitSymbolObj.Symbol = "Tst" - - //efUnitModifierObj.Unit = efUnitObj - //efUnitSymbolObj.Unit = efUnitObj - - //efUnitTypeObj.Unit.Add(efUnitObj) - //efUnitObj.UnitModifiers.Add(efUnitModifierObj) - //efUnitObj.UnitSymbol.Add(efUnitSymbolObj) - - //Return efUnitObj - //End Function - -} - diff --git a/Units.Test/Properties/AssemblyInfo.cs b/Units.Test/Properties/AssemblyInfo.cs deleted file mode 100644 index 55857f6..0000000 --- a/Units.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Units.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Units.Test")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("08a4b0dc-fee4-4882-9540-ae320526435a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Units.Test/SymbolTest.cs b/Units.Test/SymbolTest.cs deleted file mode 100644 index e7fb7d0..0000000 --- a/Units.Test/SymbolTest.cs +++ /dev/null @@ -1,422 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using Units; -using Microsoft.VisualStudio.TestTools.UnitTesting; - - -/// -///This is a test class for UnitTest and is intended -///to contain all UnitTest Unit Tests -/// -[TestClass()] -public class SymbolTest -{ - - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ - //Public Sub MyTestCleanup() - //End Sub - // - #endregion - - #region "Symbol.Symbol()" - [TestMethod()] - public void SymbolNewTest() - { - Symbol testObj = new Symbol(); - - Assert.IsNotNull(testObj); - Assert.IsTrue(testObj.Id == 0); - Assert.IsTrue(testObj.Value == null); - Assert.IsNull(testObj.Unit); - } - #endregion - - #region "Symbol.Symbol(Unit)" - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void SymbolNewEfUnitSymbolUnitNullTest() - { - Symbol testObj = new Symbol(null); - - Assert.Fail("Null values are not allowed for this constructor."); - } - - [TestMethod()] - public void SymbolNewEfUnitSymbolUnitTest() - { - Unit unitObj = new Unit - { - ID = 99, - Name = "Name" - }; - Symbol testObj = new Symbol(unitObj); - - Assert.IsNotNull(testObj); - - Assert.IsTrue(string.IsNullOrEmpty(testObj.Value)); - - Assert.IsNotNull(testObj.Unit); - Assert.IsTrue(testObj.Unit.ID == unitObj.ID); - } - #endregion - - #region "Symbol.ID" - //[TestMethod()] - //public void SymbolIDNullTest() - //{ - // Symbol testObj = new Symbol(); - - // testObj.Id = null; - - // Assert.AreEqual(null, testObj.Id); - //} - - //[TestMethod()] - //public void SymbolIDNegativeTest() - //{ - // Symbol testObj = new Symbol(); - - // testObj.Id = -1; - - // Assert.IsTrue(testObj.Id == -1); - - // List data = Validation.DataAnnotationValidator.GetErrors(testObj).ToList; - - // Assert.IsNotNull(data); - // Assert.IsTrue(data.Count > 0); - // Assert.IsTrue(data[0].PropertyName == "ID"); - //} - - [TestMethod()] - public void SymbolIDTest() - { - Symbol testObj = new Symbol(); - - testObj.Id = 99; - - Assert.AreEqual(99, testObj.Id); - } - #endregion - - #region "Symbol.ParentUnit" - [TestMethod()] - public void SymbolParentUnitTest() - { - Unit testUnitObj = new Unit(); - Symbol testObj = new Symbol(testUnitObj); - - - - testObj.Unit = testUnitObj; - - Assert.IsNotNull(testObj.Unit); - Assert.AreEqual(testUnitObj.ID, testObj.Unit.ID); - Assert.AreEqual(testUnitObj.Name, testObj.Unit.Name); - } - - [TestMethod()] - public void SymbolParentUnitNullTest() - { - Symbol testObj = new Symbol(); - - testObj.Unit = null; - - Assert.IsNull(testObj.Unit); - } - #endregion - - #region "Symbol.Value" - [TestMethod()] - public void SymbolValueTest() - { - Symbol testObj = new Symbol(); - - testObj.Value = "Test Name"; - - Assert.AreEqual("Test Name", testObj.Value); - } - - //[TestMethod()] - //public void SymbolValueNullTest() - //{ - // Symbol testObj = new Symbol(); - - // testObj.Value = null; - - // Assert.IsTrue(string.IsNullOrWhiteSpace(testObj.Value)); - - // List data = Validation.DataAnnotationValidator.GetErrors(testObj).ToList; - - // Assert.IsNotNull(data); - // Assert.IsTrue(data.Count > 0); - // Assert.IsTrue(data[0].PropertyName == "Value"); - //} - #endregion - - #region "Symbol.IsDefault" - [TestMethod()] - public void SymbolIsDefaultTest() - { - Symbol testObj = new Symbol(); - - testObj.IsDefault = true; - - Assert.AreEqual(true, testObj.IsDefault); - } - #endregion - - #region "IEquatable" - [TestMethod()] - public void Symbol_EqualityTest() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = unitPro.Symbols["ft"].Symbols[0]; - - Assert.IsTrue(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest2() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = unitPro.Symbols["in"].Symbols[0]; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest3() - { - Symbol expected = null; - Symbol target = unitPro.Symbols["in"].Symbols[0]; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest4() - { - Symbol expected = unitPro.Symbols["in"].Symbols[0]; - Symbol target = null; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest5() - { - Symbol expected = null; - Symbol target = null; - - Assert.IsTrue(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest6() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = unitPro.Symbols["in"].Symbols[0]; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest7() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = null; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest8() - { - Symbol expected = null; - Symbol target = unitPro.Symbols["ft"].Symbols[0]; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest8_1() - { - Symbol expected = null; - Symbol target = null; - - Assert.IsFalse(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest9() - { - Symbol expected = unitPro.Symbols["in"].Symbols[0]; - Symbol target = unitPro.Symbols["ft"].Symbols[0]; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest10() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = unitPro.Symbols["ft"].Symbols[0]; - - Assert.IsTrue(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest11() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = unitPro.Symbols["in"].Symbols[0]; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest12() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = null; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest13() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = unitPro.Symbols["ft"].Symbols[0]; - - Assert.IsTrue(expected.Equals((object)target)); - } - - [TestMethod()] - public void Unit_EqualityTest14() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = unitPro.Symbols["in"].Symbols[0]; - - Assert.IsFalse(expected.Equals((object)target)); - } - - [TestMethod()] - public void Unit_EqualityTest154() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - Symbol target = null; - - Assert.IsFalse(expected.Equals((object)target)); - } - - [TestMethod()] - public void Unit_EqualityTest15() - { - Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - - Assert.IsTrue(expected.GetHashCode() == expected.Value.GetHashCode()); - } - #endregion - - #region "Serialization" - //[TestMethod()] - //public void Unit_BinarySerializationTest() - //{ - // Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - // Symbol actual = default(Symbol); - - // byte[] data = Utility.BinarySerialize(expected); - // actual = (Symbol)Utility.BinaryDeserialize(data); - - // Assert.IsNotNull(actual); - // Assert.AreEqual(expected.Id, actual.Id); - // Assert.AreEqual(expected.Value, actual.Value); - // Assert.AreEqual(expected.IsDefault, actual.IsDefault); - // Assert.AreEqual(expected.UnitId, actual.UnitId); - //} - - //[TestMethod()] - //public void Unit_DataContractSerializationTest() - //{ - // Symbol expected = unitPro.Symbols["ft"].Symbols[0]; - // Symbol actual = default(Symbol); - - // string data = Utility.DataContractSerialize(expected); - // actual = (Symbol)Utility.DataContractDeserialize(data, typeof(Symbol)); - - // Assert.IsNotNull(actual); - // Assert.AreEqual(expected.Id, actual.Id); - // Assert.AreEqual(expected.Value, actual.Value); - // Assert.AreEqual(expected.IsDefault, actual.IsDefault); - // Assert.AreEqual(expected.UnitId, actual.UnitId); - //} - #endregion - - //Private Function InitEfObjects() As EFUnit - //Dim efUnitTypeObj As New EFUnitType - //efUnitTypeObj.ID = 10 - //efUnitTypeObj.Name = "Test Type" - //efUnitTypeObj.Description = "Test Desc" - - //Dim efUnitObj As New EFUnit - //efUnitObj.ID = 2 - //efUnitObj.Name = "Test Unit" - //efUnitObj.UnitType = efUnitTypeObj - - //Dim efUnitModifierObj As New EFUnitModifier - //efUnitModifierObj.ID = 2 - //efUnitModifierObj.ModifierID = 2 - //efUnitModifierObj.Order = 1 - //efUnitModifierObj.Value = 0.5 - - //Dim efSymbolsymbolObj As New EFUnitSymbol - //efUnitSymbolObj.ID = 3 - //efUnitSymbolObj.IsDefault = True - //efUnitSymbolObj.Symbol = "Tst" - - //efUnitModifierObj.Unit = efUnitObj - //efUnitSymbolObj.Unit = efUnitObj - - //efUnitTypeObj.Unit.Add(efUnitObj) - //efUnitObj.UnitModifiers.Add(efUnitModifierObj) - //efUnitObj.UnitSymbol.Add(efUnitSymbolObj) - - //Return efUnitObj - //End Function - -} - diff --git a/Units.Test/UnitConverterTest.cs b/Units.Test/UnitConverterTest.cs deleted file mode 100644 index 09df7ba..0000000 --- a/Units.Test/UnitConverterTest.cs +++ /dev/null @@ -1,9119 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - -/// -///This is a test class for UnitConverterTest and is intended -///to contain all UnitConverterTest Unit Tests -/// -[TestClass()] -public class UnitConverterTest -{ - - - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ _ - //Public Sub MyTestCleanup() - //End Sub - // - - #endregion - - #region "UnitConverter.ParseUnitString" - /// - ///A test for ParseUnitString - /// - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest() - { - UnitConverter target = new UnitConverter(); - string input = "10ft"; - Measurement expected = new Measurement(10, "ft"); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(input); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest2() - { - UnitConverter target = new UnitConverter(); - string input = "10 ft"; - Measurement expected = new Measurement(10, "ft"); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(input); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest3() - { - UnitConverter target = new UnitConverter(); - string input = "10 m/s"; - Measurement expected = new Measurement(10, "m/s"); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(input); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest4() - { - UnitConverter target = new UnitConverter(); - string input = "10'"; - Measurement expected = new Measurement(10, "'"); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(input); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest5() - { - UnitConverter target = new UnitConverter(); - string input = "10ft²"; - Measurement expected = new Measurement(10, "ft²"); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(input); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest6() - { - UnitConverter target = new UnitConverter(); - string input = "10˚"; - Measurement expected = new Measurement(10, "˚"); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(input); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest7() - { - UnitConverter target = new UnitConverter(); - string input = "10 ˚F"; - Measurement expected = new Measurement(10, "˚F"); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(input); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringTest8() - { - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringNoSymbolTest() - { - UnitConverter target = new UnitConverter(); - string input = "10"; - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ParseUnitStringEmptyTest() - { - UnitConverter target = new UnitConverter(); - Measurement expected = new Measurement(0, Result.BadValue); - Measurement actual = default(Measurement); - actual = target.ParseUnitString(string.Empty); - Assert.AreNotEqual(expected, actual); - Assert.AreEqual(expected.ConversionResult, actual.ConversionResult); - } - #endregion - - #region "UnitConverter.IsCompatible" - /// - ///A test for IsCompatible - /// - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - public void UnitConverter_IsCompatibleTest() - { - UnitConverter target = new UnitConverter(); - string leftSymbol = "C"; - string rightSymbol = "F"; - bool actual = false; - actual = target.IsCompatible(leftSymbol, rightSymbol); - Assert.IsTrue(actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - public void UnitConverter_IsCompatibleFalseTest() - { - UnitConverter target = new UnitConverter(); - string leftSymbol = "C"; - string rightSymbol = "in"; - bool actual = false; - actual = target.IsCompatible(leftSymbol, rightSymbol); - Assert.IsFalse(actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_IsCompatibleNullTest() - { - UnitConverter target = new UnitConverter(); - bool actual = false; - actual = target.IsCompatible(null, null); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_IsCompatibleLeftNullTest() - { - UnitConverter target = new UnitConverter(); - string rightSymbol = "in"; - bool actual = false; - actual = target.IsCompatible(null, rightSymbol); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_IsCompatibleRightNullTest() - { - UnitConverter target = new UnitConverter(); - string leftSymbol = "C"; - bool actual = false; - actual = target.IsCompatible(leftSymbol, null); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_IsCompatibleEmptyTest() - { - UnitConverter target = new UnitConverter(); - bool actual = false; - actual = target.IsCompatible(string.Empty, string.Empty); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_IsCompatibleLeftEmptyTest() - { - UnitConverter target = new UnitConverter(); - string rightSymbol = "in"; - bool actual = false; - actual = target.IsCompatible(string.Empty, rightSymbol); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_IsCompatibleRightEmptyTest() - { - UnitConverter target = new UnitConverter(); - string leftSymbol = "C"; - bool actual = false; - actual = target.IsCompatible(leftSymbol, string.Empty); - - Assert.Fail(); - } - #endregion - - #region "UnitProvider.GetUnitBySymbol" - /// - ///A test for GetUnitBySymbol - /// - [TestMethod()] - [TestCategory(UnitTestCategory.CRUD)] - public void UnitConverter_GetUnitBySymbol_Test() - { - UnitConverter target = new UnitConverter(); - string unitSymbol = "C"; - Unit expected = unitPro.Symbols["C"]; - Unit actual = default(Unit); - actual = target.GetUnitBySymbol(unitSymbol); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.ExceptionTest)] - [ExpectedException(typeof(ArgumentNullException))] - public void UnitConverter_GetUnitBySymbolNull_Test() - { - UnitConverter target = new UnitConverter(); - Unit actual = default(Unit); - actual = target.GetUnitBySymbol(null); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.ExceptionTest)] - [ExpectedException(typeof(ArgumentNullException))] - public void UnitConverter_GetUnitBySymbolEmpty_Test() - { - UnitConverter target = new UnitConverter(); - Unit actual = default(Unit); - actual = target.GetUnitBySymbol(string.Empty); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.ExceptionTest)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_GetUnitBySymbol_UnrecognizedSymbol_Test() - { - UnitConverter target = new UnitConverter(); - string unitName = "BogusUnitSymbol"; - Unit actual = default(Unit); - actual = target.GetUnitByName(unitName); - Assert.Fail(); - } - #endregion - - #region "UnitConverter.GetUnitByName" - /// - ///A test for GetUnitByName - /// - [TestMethod()] - [TestCategory(UnitTestCategory.CRUD)] - public void UnitConverter_GetUnitByName_Test() - { - UnitConverter target = new UnitConverter(); - string unitName = "Celsius"; - Unit expected = unitPro.Units["Celsius"]; - Unit actual = default(Unit); - actual = target.GetUnitByName(unitName); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.ExceptionTest)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_GetUnitByNameNull_Test() - { - UnitConverter target = new UnitConverter(); - - Unit actual = default(Unit); - actual = target.GetUnitByName(null); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.ExceptionTest)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_GetUnitByNameEmpty_Test() - { - UnitConverter target = new UnitConverter(); - - Unit actual = default(Unit); - actual = target.GetUnitByName(string.Empty); - - Assert.Fail(); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.ExceptionTest)] - [ExpectedException(typeof(ArgumentException))] - public void UnitConverter_GetUnitByName_UnrecognizedName_Test() - { - UnitConverter target = new UnitConverter(); - string unitName = "BogusUnitName"; - Unit actual = default(Unit); - actual = target.GetUnitByName(unitName); - Assert.Fail(); - } - #endregion - - #region "UnitConverter.ConvertUnits" - #region "Temperature Tests" - #region "Source as Kelvin" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Celcius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-173.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Celcius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-272.65), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Celcius_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "K"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-279.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-458.77), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Fahrenheit_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "K"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(500), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(500000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(500000000), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.0005), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(5E-07), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-138.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.12), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Reaumur_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "K"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "K"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(180), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "K"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(0.9), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kelvin_to_Rankine_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "K"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(0), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Celsius" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celcius_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(373.15), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celcius_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(273.65), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(212), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(32.9), "F"); - Measurement actual; - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Fahrenheit_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "C"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(32), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(373150), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(273650), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(373150000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(273650000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(373150000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(273650000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.37315), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.27365), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.00037315), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.00027365), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(80), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(0.4), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Reaumur_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "C"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(0), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "C"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(671.67), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "C"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(492.57), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Celsius_to_Rankine_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "C"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(491.67), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Fahrenheit" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(310.93), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(255.65), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Kelvin_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "F"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(255.37), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(37.78), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-17.5), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Celsius_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "F"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-17.78), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(310927.78), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(255650), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(310927777.78), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(255650000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(310927777777.78), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(255650000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.310927777777778), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.25565), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.000310927777778), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.00025565), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(30.22), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-14), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Reaumur_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "F"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-14.22), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "F"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(559.67), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "F"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(460.17), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Fahrenheit_to_Rankine_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "F"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(459.67), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Millikelvin" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(0.0005), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.05), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.49), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(500), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(500000), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(5E-07), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(5E-10), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.44), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(0.18), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Millikelvin_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "mK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(0.0009), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Millikelvin" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(5E-07), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(0.0005), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(500), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(5E-10), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(5E-13), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(0.00018), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microkelvin_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "µK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(9E-07), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Millikelvin" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(5E-10), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(5E-07), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(0.0005), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(5E-13), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0), "MK"); - //should be 0.0000000000000005; can only round to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(1.8E-07), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nK_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "nK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(9E-10), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Kilokelvin" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(500), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(99726.85), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(226.85), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(179540.33), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(440.33), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(500000), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(500000000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(500000000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.0005), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(79781.48), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(181.48), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(180000), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kK_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "kK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(900), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Megakelvin" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(500000), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(99999726.85), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(499726.85), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(179999540.33), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(899540.33), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(500000000), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(500000000000L), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(500000000000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(500), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(79999781.48), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(399781.48), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(180000000), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megakelvin_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "MK"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(900000), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Reaumur" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(398.15), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(273.77), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Kelvin_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Re"; - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(257), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(33.12), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Fahrenheit_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Re"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(32), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(398150), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(273775), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(398150000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(273775000), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(398150000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(273775000000L), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.39815), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.273775), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.00039815), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(0.000273775), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(125), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(0.62), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Celsius_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Re"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(0), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Rankine_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Re"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(716.67), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Rankine_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Re"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(492.8), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Reaumur_to_Rankine_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Re"; - string targetUnitName = "Ra"; - Measurement expected = new Measurement(Convert.ToDouble(491.67), "Ra"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Rankine" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Kelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(55.56), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Kelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(0.28), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Kelvin_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Ra"; - string targetUnitName = "K"; - Measurement expected = new Measurement(Convert.ToDouble(0), "K"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Fahrenheit_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-359.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Fahrenheit_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.17), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Fahrenheit_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Ra"; - string targetUnitName = "F"; - Measurement expected = new Measurement(Convert.ToDouble(-459.67), "F"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Millikelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(55555.56), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Millikelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "mK"; - Measurement expected = new Measurement(Convert.ToDouble(277.78), "mK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Microkelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(55555555.56), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Microkelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "µK"; - Measurement expected = new Measurement(Convert.ToDouble(277777.78), "µK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_nK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(55555555555.56), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_nK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "nK"; - Measurement expected = new Measurement(Convert.ToDouble(277777777.78), "nK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_kK_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.055555555555556), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_kK_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "kK"; - Measurement expected = new Measurement(Convert.ToDouble(0.000277777777778), "kK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Megakelvin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(5.5555555556E-05), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Megakelvin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "MK"; - Measurement expected = new Measurement(Convert.ToDouble(2.77777778E-07), "MK"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Celsius_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-217.59), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Celsius_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-272.87), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Celsius_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Ra"; - string targetUnitName = "C"; - Measurement expected = new Measurement(Convert.ToDouble(-273.15), "C"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Reaumur_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Ra"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-174.08), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Reaumur_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.5); - string currentUnitName = "Ra"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.3), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Rankine_to_Reaumur_Test3() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0); - string currentUnitName = "Ra"; - string targetUnitName = "Re"; - Measurement expected = new Measurement(Convert.ToDouble(-218.52), "Re"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - #endregion - - #region "Mass Tests" - #region "Source as kg" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.110231131092439), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.001102311309822), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(15.747304441777), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(0.157473044260297), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.20462262184878), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(0.022046226196442), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(220.462262184878), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2.20462261964415), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3527.39619495804), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kg_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(35.2739619143064), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as g" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.000110231131092), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.10231131E-06), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(0.015747304441777), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(0.00015747304426), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(0.002204622621849), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.2046226196E-05), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(0.220462262184878), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(0.002204622619644), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3.5273961949580408), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_g_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(0.035273961914306), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as mg" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Mg"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "Gg"); - //value 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "t"); - // value should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.10231131E-07), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.102311E-09), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(1.5747304442E-05), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(1.57473044E-07), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.204622622E-06), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.2046226E-08), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(0.000220462262185), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2.20462262E-06), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(0.003527396194958), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mg_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3.5273961914E-05), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as µg" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "Mg"); - //should be 0.000000000000099999999, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "Gg"); - //should be 0.00000000000000099999999, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "t"); - //value should be 0.000000000000999999999, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.10231E-10), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.102E-12), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(1.5747304E-08), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(1.57473E-10), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.204623E-09), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.2046E-11), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2.20462262E-07), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2.204623E-09), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3.527396195E-06), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µg_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3.5273962E-08), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as ng" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "kg"); - //value should be 0.000000000000999999999, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "g"); - //value should be 0.000000000999999999, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "Mg"); - //should be 0.000000000000000999999999, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0), "Gg"); - //value should be 0.0000000000000001, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.0), "Gg"); - //value should be 9.99999999E-19, .net rounds at 15 total digits - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.1E-13), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(1.5747E-11), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(1.57E-13), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.205E-12), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2.2E-14), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2.20462E-10), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2.205E-12), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ng"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3.527396E-09), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ng_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ng"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3.5274E-11), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Megagram" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagrams_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(100), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagrams_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.999999999), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(110.231131092439), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.10231130982208), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(15747.304441777), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(157.473044260297), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2204.62262184878), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(22.0462261964415), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(220462.262184878), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2204.62261964415), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3527396.194958), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megagram_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(35273.961914306), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Gigagram" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000.0), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(1E+20), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(110231.131092439), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1102.31130982208), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(15747304.441777), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(157473.044260297), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2204622.62184878), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(22046.2261964415), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(220462262.184878), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2204622.61964415), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3527396194.95804), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gg_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gg"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(35273961.9143064), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Tonnes" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_Megagrams_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(100), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_Megagrams_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.999999999), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(110.231131092439), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(1.10231130982208), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(2204.62262184878), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(22.0462261964415), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(15747.304441777), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(157.473044260297), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(220462.262184878), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(2204.62261964415), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "t"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3527396.194958), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonne_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "t"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(35273.961914306), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Tons" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(90718.474), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(907.184739092815), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(90718474000L), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(907184739.092815), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(90718474), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(907184.739092815), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(90718474000000.0), "µg"); - //should be 90718474000000, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(907184739092.815), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(90718474000000016L), "ng"); - //should be 90718474000000000, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(907184739092815.0), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_Megagrams_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(90.718474), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_Megagrams_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.907184739092815), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.090718474), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000907184739093), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(90.718474), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.907184739092815), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(200000), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(1999.999998), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ton"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(3200000), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ton_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ton"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(31999.999968), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Stone" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(635.029318), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(6.35029317364971), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(635029.318), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(6350.29317364971), "g"); - //actual value 6350.29318, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(635029318.0), "mg"); - //actual value 635029318, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(6350293.17364971), "mg"); - //actual value 6350293.1736, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(635029318000L), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(6350293173.64971), "µg"); - //actual value 6350293173.6, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(635029318000000L), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(6350293173649.71), "ng"); - //actual value 6350293173600, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.635029318), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.00635029317365), "Mg"); - //actual value .006350293173600, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000635029318), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(6.350293174E-06), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.635029318), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.00635029317365), "t"); - //actual value 0.006350293, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.7), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.006999999993), "ton"); - //should be 0.007, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(14), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(0.13999999986), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(1400), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(13.999999986), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "st"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(22400), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_stone_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "st"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(223.999999776), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as CWT" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(4535.9237), "kg"); - // actual value 4535.9237, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(45.3592369546408), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(4535923700L), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(45359236.9546408), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(4535923.7), "g"); - //should be 4535923.7, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(45359.2369546408), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - - //var d = Math.(expected.Value); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(4535923700000.0), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(45359236954.640762), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(4.5359237E+15), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(45359236954640.8), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(4.5359237), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.045359236954641), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(0.0045359237), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(4.5359236955E-05), "Gg"); - //actual value 0.000045359, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(4.5359237), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.045359236954641), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(5), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.04999999995), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(714.285714285714), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(7.14285713571429), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(10000), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(99.9999999), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cwt"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(160000), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cwt_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cwt"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(1599.9999984), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Pound" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(45.359237), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(0.453592369546408), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(45359.237), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(453.592369546408), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(45359237), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(453592.369546408), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(45359237000.0), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(453592369.546408), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(45359237000000.0), "ng"); - //should be 45359237000000, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(453592369546.41), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.045359237), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.000453592369546), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(4.5359237E-05), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(4.5359237E-07), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.045359237), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.000453592369546), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.05), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.0004999999995), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(7.14285714285714), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(0.071428571357143), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(1), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(0.00999999999), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_oz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(1600), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lb_to_oz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb"; - string targetUnitName = "oz"; - Measurement expected = new Measurement(Convert.ToDouble(15.999999984), "oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Ounce" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_kg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(2.8349523125), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_kg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "kg"; - Measurement expected = new Measurement(Convert.ToDouble(0.02834952309665), "kg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_g_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(2834.9523125), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_g_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "g"; - Measurement expected = new Measurement(Convert.ToDouble(28.3495230966505), "g"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_mg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(2834952.3125), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_mg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "mg"; - Measurement expected = new Measurement(Convert.ToDouble(28349.5230966505), "mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_µg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(2834952312.5), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_µg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "µg"; - Measurement expected = new Measurement(Convert.ToDouble(28349523.0966505), "µg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(2834952312500.0), "ng"); - //should be 2834952312500, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_ng_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "ng"; - Measurement expected = new Measurement(Convert.ToDouble(28349523096.6505), "ng"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_Megagram_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(0.0028349523125), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_Megagram_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "Mg"; - Measurement expected = new Measurement(Convert.ToDouble(2.8349523097E-05), "Mg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_Gg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(2.834952313E-06), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_Gg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "Gg"; - Measurement expected = new Measurement(Convert.ToDouble(2.8349523E-08), "Gg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_tonne_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(0.0028349523125), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_tonne_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "t"; - Measurement expected = new Measurement(Convert.ToDouble(2.8349523097E-05), "t"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_ton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(0.003125), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_ton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "ton"; - Measurement expected = new Measurement(Convert.ToDouble(3.1249999969E-05), "ton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_stone_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(0.446428571428571), "st"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_stone_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "st"; - Measurement expected = new Measurement(Convert.ToDouble(0.004464285709821), "st"); - //UK stone; US stone 0.005 - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_cwt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(0.0625), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_cwt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "cwt"; - Measurement expected = new Measurement(Convert.ToDouble(0.000624999999375), "cwt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_lb_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "oz"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(6.25), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_oz_to_lb_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "oz"; - string targetUnitName = "lb"; - Measurement expected = new Measurement(Convert.ToDouble(0.0624999999375), "lb"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - #region "Time Tests" - #region "Source as Seconds" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_min_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "s"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(1.66666666666667), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_min_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "s"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(0.01666666665), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_hr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "s"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(0.027777777777778), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_hr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "s"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(0.0002777777775), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_ms_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "s"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_ms_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "s"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_day_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "s"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(0.001157407407407), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_day_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "s"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(1.1574074062E-05), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_wk_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "s"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(0.000165343915344), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_sec_to_wk_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "s"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(1.653439152E-06), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Minutes" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_sec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "min"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(6000), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_sec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "min"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(59.99999994), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_hr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "min"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(1.66666666666667), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_hr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "min"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(0.01666666665), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_ms_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "min"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(6000000), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_ms_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "min"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(59999.99994), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_day_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "min"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(0.069444444444444), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_day_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "min"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(0.00069444444375), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_wk_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "min"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(0.009920634920635), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_min_to_wk_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "min"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(9.9206349107E-05), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Hours" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_sec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hr"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(360000), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_sec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hr"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(3599.9999964), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_min_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hr"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(6000), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_min_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hr"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(59.99999994), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_ms_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hr"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(360000000), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_ms_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hr"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(3599999.9964), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_day_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hr"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(4.16666666666667), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_day_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hr"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(0.041666666625), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_wk_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hr"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(0.595238095238095), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_hr_to_wk_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hr"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(0.005952380946429), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Milliseconds" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_sec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ms"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_sec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ms"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_min_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ms"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(0.001666666666667), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_min_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ms"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(1.666666665E-05), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_hr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ms"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(2.7777777778E-05), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_hr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ms"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(2.77777778E-07), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_day_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ms"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(1.157407407E-06), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_day_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ms"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(1.1574074E-08), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_wk_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ms"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(1.65343915E-07), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ms_to_wk_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ms"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(1.653439E-09), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Days" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_sec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "d"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(8640000), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_sec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "d"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(86399.9999136), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_min_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "d"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(144000), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_min_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "d"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(1439.99999856), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_hr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "d"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(2400), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_hr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "d"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(23.999999976), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_ms_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "d"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(8640000000L), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_ms_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "d"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(86399999.9136), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_wk_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "d"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(14.2857142857143), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_day_to_wk_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "d"; - string targetUnitName = "wk"; - Measurement expected = new Measurement(Convert.ToDouble(0.142857142714286), "wk"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Weeks" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_sec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "wk"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(60480000), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_sec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "wk"; - string targetUnitName = "s"; - Measurement expected = new Measurement(Convert.ToDouble(604799.9993952), "s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_min_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "wk"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(1008000), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_min_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "wk"; - string targetUnitName = "min"; - Measurement expected = new Measurement(Convert.ToDouble(10079.99998992), "min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_hr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "wk"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(16800), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_hr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "wk"; - string targetUnitName = "hr"; - Measurement expected = new Measurement(Convert.ToDouble(167.999999832), "hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_ms_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "wk"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(60480000000L), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_ms_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "wk"; - string targetUnitName = "ms"; - Measurement expected = new Measurement(Convert.ToDouble(604799999.3952), "ms"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_day_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "wk"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(700), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_wk_to_day_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "wk"; - string targetUnitName = "d"; - Measurement expected = new Measurement(Convert.ToDouble(6.999999993), "d"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - - #endregion -} - - diff --git a/Units.Test/UnitConverterTest2.cs b/Units.Test/UnitConverterTest2.cs deleted file mode 100644 index 8bfa331..0000000 --- a/Units.Test/UnitConverterTest2.cs +++ /dev/null @@ -1,10202 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - -namespace Units.Test -{ - [TestClass()] - public class UnitConverterTest2 - { - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ _ - //Public Sub MyTestCleanup() - //End Sub - // - - #endregion - #region "UnitConverter.ConvertUnits" - - #region "Force Tests" - #region "Source as Newton (N)" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(10000000.0), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(99999.9999), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(22.4808943099999), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(0.22480894287519), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(0.011240447154986), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(0.000112404471437), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(0.010197162129779), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(0.000101971621196), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(9.99999999E-07), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "GN"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "N"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000.0), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_N_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "N"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Dyne (dyn)" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(0.001), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-06), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(0.0002248089431), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(2.248089429E-06), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.12404472E-07), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.124045E-09), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(1.019716E-09), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-11), "Meganewton"); - //should be 0.00000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-14), "GN"); - //should be 0.00000000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-06), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(1), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(0.00999999999), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(1000), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "dyn"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_dyn_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "dyn"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(1000000), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - #endregion - - #region "Source as Pound-force (lbf)" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(444.82216152548), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(4.44822161080658), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(44482216.152548), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(444822.161080658), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(0.05), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(0.0004999999995), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(0.045359236999934), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(0.000453592369546), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.000444822161525), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(4.448221611E-06), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(4.44822162E-07), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(4.448222E-09), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(0.44482216152548), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(0.004448221610807), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(444822.16152548), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(4448.22161080658), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(444822161.52548), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(4448221.61080658), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lbf"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(444822161525.48), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbf_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lbf"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(4448221610.80658), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Ton-force(short) (tonf)" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(889644.3230521), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(8896.44322162456), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(88964432305.21), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(889644322.162456), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(200000), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(1999.999998), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(90.718474), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(0.907184739092815), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.8896443230521), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.008896443221625), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(0.000889644323052), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(8.896443222E-06), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(889.6443230521), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(8.89644322162456), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(889644323.0521), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(8896443221.62456), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonf"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(889644323052100L), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonf_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonf"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(8896443221624.56), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Tonnes force(metric) (tonnef,tf)" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(980665), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(98066500000.0), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonnef"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(980664999.019335), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(220462.2621852), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonnef"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.10231130982208), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.980665), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonnef"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.009806649990193), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(0.000980665), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonnef"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(9.80664999E-06), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(980.665), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonnef"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(9.80664999019335), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(980665000), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonnef"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(9806649.99019335), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "tonnef"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(980665000000.0), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(9806649990.19335), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_tonnef_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "tonnef"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(9806649990193.35), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Meganewton (MN)" - - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(10000000000000.0), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(99999999900.0), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(22480894.3099999), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(224808.94287519), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(11240.4471549855), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(112.404471437451), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(10197.1621297793), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(101.971621195821), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999.0), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000.0), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000.0), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Meganewton"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(1E+17), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Meganewton_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Meganewton"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000.0), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Giganewton (GN)" - - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000.0), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(1E+16), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(99999999900000.0), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(22480894309.9999), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(224808942.87519), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(11240447.154986), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(112404.471437456), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_ng_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(10197162.1297793), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(101971.621195821), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000.0), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000.0), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(1E+17), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000.0), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(1E+20), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GN_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E+17), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Kilonewton (kN)" - - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(10000000000L), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(99999999.9), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(22480.8943099999), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(224.80894287519), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(11.2404471549855), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(0.112404471437451), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(10.1971621297793), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(0.101971621195821), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000.0), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000.0), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kN_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000.0), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Milinewton (mN)" - - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(10000), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(99.9999999), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(0.02248089431), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(0.000224808942875), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.1240447155E-05), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.12404471E-07), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(1.019716213E-05), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Meganewton"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "GN"); - //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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mN_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Micronewton (µN)" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(10), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(0.0999999999), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(2.24808943E-07), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.1240447E-08), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(1.0197162E-08), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(1.01972E-10), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "GN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "GN"); - //should be 0.000000000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "kN"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_nN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µN_to_nN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µN"; - string targetUnitName = "nN"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "nN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Nananewton (nN)" - - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_N_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "N"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_N_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "N"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "N"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_dyn_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(0.01), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_dyn_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "dyn"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-05), "dyn"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_lbf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(2.2480894E-08), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_lbf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "lbf"; - Measurement expected = new Measurement(Convert.ToDouble(2.24809E-10), "lbf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_tonf_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.124E-11), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_tonf_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "tonf"; - Measurement expected = new Measurement(Convert.ToDouble(1.12E-13), "tonf"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_tonnef_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(1.0197E-11), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_tonnef_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "tonnef"; - Measurement expected = new Measurement(Convert.ToDouble(1.02E-13), "tonnef"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_Meganewton_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "Meganewton"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_Meganewton_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "Meganewton"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "Meganewton"); - //should be 0.000000000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_GN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(0), "GN"); - //should be .0000000000000001, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_GN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "GN"; - Measurement expected = new Measurement(Convert.ToDouble(0), "GN"); - //should be 9.99999999E-19, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_kN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "kN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_kN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "kN"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "kN"); - //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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_mN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_mN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "mN"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "mN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_µN_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nN_to_µN_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nN"; - string targetUnitName = "µN"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "µN"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - #region "Momentum Tests" - #region "Source as kg m/s" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMetersPerSec_to_lbFtPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg m/s"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(2603884.98643556), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMetersPerSec_to_lbFtPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg m/s"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(26038.8498383168), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMeterPerSec_to_GramCentimeterPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg m/s"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(10000000), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMeterPerSec_to_GramCentimeterPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg m/s"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(99999.9999), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg m/s"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(43398.0831072594), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg m/s"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(433.980830638613), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kg m/s"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(723.301385120989), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kgMeterPerSec_to_lbFtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kg m/s"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(7.23301384397688), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as lb ft/hr" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_kgMetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.003840415399333), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_kgMetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(3.8404153955E-05), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_GramCentimeterPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(384.041539933333), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_GramCentimeterPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(3.84041539549292), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(1.66666666666667), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.01666666665), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.027777777777778), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerHr_to_lbFtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/hr"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.0002777777775), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as g cm/s" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_kgMetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g cm/s"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.001), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_kgMetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g cm/s"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-06), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g cm/s"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(26.0388498643556), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g cm/s"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(0.260388498383168), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g cm/s"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.4339808310726), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g cm/s"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.004339808306386), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "g cm/s"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.0072330138512), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GramCentimeterPerSec_to_lbFtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "g cm/s"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(7.233013844E-05), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as lb ft/min" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_kgMetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/min"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.23042492396), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_kgMetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/min"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.002304249237296), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/min"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(6000), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/min"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(59.99999994), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_GramCentimeterPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/min"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(23042.4923959997), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_GramCentimeterPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/min"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(230.424923729572), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/min"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(1.66666666666667), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerMin_to_lbFtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/min"; - string targetUnitName = "lb ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.01666666665), "lb ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as lb ft/sec" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_kgMetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/s"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(13.8254954376), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_kgMetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/s"; - string targetUnitName = "kg m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.138254954237745), "kg m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/s"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(360000), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/s"; - string targetUnitName = "lb ft/hr"; - Measurement expected = new Measurement(Convert.ToDouble(3599.9999964), "lb ft/hr"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_GramCentimeterPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/s"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(1382549.54376189), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_GramCentimeterPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/s"; - string targetUnitName = "g cm/s"; - Measurement expected = new Measurement(Convert.ToDouble(13825.4954237934), "g cm/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "lb ft/s"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(6000), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_lbFtPerSec_to_lbFtPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "lb ft/s"; - string targetUnitName = "lb ft/min"; - Measurement expected = new Measurement(Convert.ToDouble(59.99999994), "lb ft/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - #region "Speed Tests" - #region "Source as Meters/Second" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_KmPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/s"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(360), "km/h"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_KmPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/s"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(3.5999999964), "km/h"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_MilesPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/s"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(223.69362920544), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_MilesPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/s"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(2.23693628981747), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_MetersPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/s"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(6000), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_MetersPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/s"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(59.99999994), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_FtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/s"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(328.083989501312), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerSec_to_FtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/s"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(3.28083989173228), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Kilometers/Hour" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km/h"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(27.7777777777778), "m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km/h"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.2777777775), "m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_MilesPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km/h"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(62.1371192237334), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_MilesPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km/h"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(0.621371191615963), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km/h"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(1666.66666666667), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_MetersPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km/h"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(16.66666665), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_FtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km/h"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(91.1344415281423), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_KmPerHr_to_FtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km/h"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.911344414370079), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Miles/Hour" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mph"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(44.704), "m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mph"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.44703999955296), "m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_KmPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mph"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(160.9344), "km/h"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_KmPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mph"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(1.60934399839066), "km/h"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mph"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(2682.24), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_MetersPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mph"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(26.8223999731776), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_FtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mph"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(146.666666666667), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MilesPerHr_to_FtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mph"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(1.4666666652), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Meters/Minute" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_MetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/min"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(1.66666666666667), "m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_MetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/min"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.01666666665), "m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_KmPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/min"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(6), "km/h"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_KmPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/min"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(0.05999999994), "km/h"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_MilesPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/min"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(3.728227153424), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_MilesPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/min"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(0.037282271496958), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_FtPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m/min"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(5.46806649168854), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_MetersPerMin_to_FtPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m/min"; - string targetUnitName = "ft/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.054680664862205), "ft/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Feet/Second" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerSec_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft/s"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(30.48), "m/s"); - //should be 30.48, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerSec_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft/s"; - string targetUnitName = "m/s"; - Measurement expected = new Measurement(Convert.ToDouble(0.3047999996952), "m/s"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_KmPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft/s"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(109.728), "km/h"); - //should be 109.728, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_KmPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft/s"; - string targetUnitName = "km/h"; - Measurement expected = new Measurement(Convert.ToDouble(1.09727999890272), "km/h"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_MilesPerHr_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft/s"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(68.1818181818182), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_MilesPerHr_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft/s"; - string targetUnitName = "mph"; - Measurement expected = new Measurement(Convert.ToDouble(0.681818181136364), "mph"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft/s"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(1828.8), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtPerSec_to_MetersPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft/s"; - string targetUnitName = "m/min"; - Measurement expected = new Measurement(Convert.ToDouble(18.287999981712), "m/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - #region "Length Tests" - #region "Source as Metres" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(109.361329833771), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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.0936132972441), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(328.083989501312), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - Assert.AreEqual(Result.NoError, actual.ConversionResult); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(3.28083989173228), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4.97096953789867), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.049709695329277), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(0.062137119223733), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.000621371191616), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(0.497096953789867), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.004970969532928), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(3937007.87401575), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(39370.0787007874), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(3937.00787401575), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(39.3700787007874), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(10000), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(99.9999999), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Yards" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.9143999990856), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(300), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(2.999999997), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4.54545454545455), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.045454545409091), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.056818181818182), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.000568181817614), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.09144), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.000914399999086), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(9.14399999E-07), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(9.144E-08), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(9.144E-10), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.454545454545454), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(3600000), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(35999.999964), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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(91440000), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(914399.9990856), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(3600), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(35.999999964), "in"); - //expected altered to meet .net conversion bug (35.999999964) - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(9144), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(91.43999990856), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(91440), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - #endregion - - #region "Source as Feet" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(30.48), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.3047999996952), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_m_negative_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(-0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(-0.3047999996952), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(33.3333333333333), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(0.333333333), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(1.51515151515151), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.015151515136364), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.018939393939394), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.000189393939205), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.03048), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.000304799999695), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(3.048E-05), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(3.048E-07), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(3.048E-08), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(3.048E-10), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.151515151515152), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.001515151513636), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(1200000), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(11999.999988), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(30480000), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(304799.9996952), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(1200), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(11.999999988), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(3048), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(30.47999996952), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(30480), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(304.7999996952), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Chain" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(2011.68), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(20.1167999798832), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(2200), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(21.999999978), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(1.25), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.0124999999875), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(2.01168), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.020116799979883), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.00201168), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(2.011679998E-05), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.01168E-06), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.01168E-08), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(10), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.0999999999), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(79200000), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(791999.999208), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(2011680000), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(20116799.979883), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(79200), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(791.999999208), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(201168), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "chain"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(2011680), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_chain_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "chain"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(20116.7999798832), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Miles" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(160934.4), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(1609.34399839066), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(176000), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(1759.99999824), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(528000), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(5279.99999472), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(8000), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(79.99999992), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(160.9344), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(1.60934399839066), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.1609344), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.001609343998391), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001609344), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1.609343998E-06), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(800), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(7.999999992), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(6336000000L), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(63359999.93664), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(160934400000L), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(1609343998.391), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(6336000), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(63359.99993664), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(16093440), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(160934.399839066), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(160934400), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_miles_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(1609343.998391), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Kilometres" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(109361.329833771), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(1093.61329724409), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(328083.989501312), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(3280.83989173228), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4970.96953789867), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(49.709695329277), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_miles_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(62.1371192237334), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_miles_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.621371191615963), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(497.096953789867), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(4.9709695329277), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(3937007874.01575), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(39370078.7007874), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(3937007.87401575), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(39370.0787007874), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(10000000), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(99999.9999), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Megametres" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(109361329.833771), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(1093613.29724409), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(328083989.501312), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(3280839.89173228), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4970969.53789867), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(49709.695329277), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_miles_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(62137.1192237334), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_miles_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(621.371191615963), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(497096.953789867), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(4970.9695329277), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(3937007874015.75), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(39370078700.7874), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(3937007874.01575), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(39370078.7007874), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(10000000000L), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(99999999.9), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Mm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megametres_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Mm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Gigametres" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(109361329833.771), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(1093613297.24409), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(328083989501.312), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(3280839891.73228), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4970969537.89867), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(49709695.329277), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_miles_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(62137119.2237334), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_miles_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(621371.191615963), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gms_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(497096953.789867), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(4970969.5329277), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(3937007874015748L), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(39370078700787.4), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000000L), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000L), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(3937007874015.75), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(39370078700.7874), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(10000000000000L), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(99999999900L), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gm_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Furlongs" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(20116.8), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(201.167999798832), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(22000), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(219.99999978), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(66000), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(659.99999934), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(12.5), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.124999999875), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(20.1168), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.201167999798832), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.0201168), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.000201167999799), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.01168E-05), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.01168E-07), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(1000), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(792000000), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(7919999.99208), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(20116800000L), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(201167999.799), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(792000), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(7919.99999208), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(2011680), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(20116.7999798832), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "furlong"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(20116800), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_furlong_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "furlong"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(201167.999799), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Thou" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.00254), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(2.5399999975E-05), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(0.002777777777778), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(2.777777775E-05), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(0.008333333333333), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(8.333333325E-05), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(1.578282828E-06), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(1.5782828E-08), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-06), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-08), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-09), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-11), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-12), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.5E-14), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.000126262626263), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(1.262626261E-06), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(2540), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(25.3999999746), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(1.2626262626E-05), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(1.26262626E-07), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "thou"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(0.254), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(0.00253999999746), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_thou_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "thou"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.0253999999746), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Microns" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(0.000109361329834), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(3.280839892E-06), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4.970969538E-06), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4.9709695E-08), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(6.21371E-10), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(4.97097E-09), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(3.93700787401575), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(0.003937007874016), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(3.9370078701E-05), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(0.01), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-05), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µm_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Inches" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(2.54), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.0253999999746), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(2.77777777777778), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(0.02777777775), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(8.33333333333333), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(0.08333333325), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.001578282828283), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(1.5782828267E-05), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.00254), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(2.5399999975E-05), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-06), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-08), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-09), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(2.54E-11), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.126262626262626), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.001262626261364), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(2540000), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(25399.9999746), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.012626262626263), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.000126262626136), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(254), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(2.53999999746), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(2540), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(25.3999999746), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Centimetres" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(1), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.00999999999), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(1.09361329833771), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(0.010936132972441), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(3.280839895013123), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - Assert.AreEqual(Result.NoError, actual.ConversionResult); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(0.032808398917323), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.049709695378987), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.000497096953293), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(0.000621371192237), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(6.213711916E-06), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.001), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-06), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-06), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-08), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-11), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.004970969537899), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(4.9709695329E-05), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(39370.0787401575), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(393.700787007874), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(1000000), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(9999.99999), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(39.3700787401575), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(0.393700787007874), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_millimetres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(1000), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm_to_millimetres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm"; - string targetUnitName = "mm"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999), "mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Millimetres" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_m_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_m_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "m"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "m"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_yd_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(0.109361329833771), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_yd_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "yd"; - Measurement expected = new Measurement(Convert.ToDouble(0.001093613297244), "yd"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_ft_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(0.328083989501312), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - Assert.AreEqual(Result.NoError, actual.ConversionResult); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_ft_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "ft"; - Measurement expected = new Measurement(Convert.ToDouble(0.003280839891732), "ft"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_chain_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(0.004970969537899), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_chain_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "chain"; - Measurement expected = new Measurement(Convert.ToDouble(4.9709695329E-05), "chain"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_mile_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(6.2137119224E-05), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_mile_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "mi"; - Measurement expected = new Measurement(Convert.ToDouble(6.21371192E-07), "mi"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_km_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_km_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "km"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "km"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_Megametres_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_Megametres_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "Mm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Mm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_Gm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_Gm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "Gm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "Gm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_furlong_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(0.00049709695379), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_furlong_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "furlong"; - Measurement expected = new Measurement(Convert.ToDouble(4.970969533E-06), "furlong"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_thou_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(3937.00787401575), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_thou_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "thou"; - Measurement expected = new Measurement(Convert.ToDouble(39.3700787007874), "thou"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_µm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_µm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "µm"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "µm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_in_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(3.93700787401575), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_in_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "in"; - Measurement expected = new Measurement(Convert.ToDouble(0.039370078700787), "in"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_cm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(10), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_millimetres_to_cm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mm"; - string targetUnitName = "cm"; - Measurement expected = new Measurement(Convert.ToDouble(0.0999999999), "cm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - #endregion - } -} diff --git a/Units.Test/UnitConverterTest3.cs b/Units.Test/UnitConverterTest3.cs deleted file mode 100644 index 758cf50..0000000 --- a/Units.Test/UnitConverterTest3.cs +++ /dev/null @@ -1,8725 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - -namespace Units.Test -{ - [TestClass()] - public class UnitConverterTest3 - { - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ _ - //Public Sub MyTestCleanup() - //End Sub - // - - #endregion - - #region "UnitConverter.ConvertUnits" - - #region "Power Tests" - #region "Source as Watts" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Horsepower_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(0.134102208959503), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Horsepower_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(0.001341022088254), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Kilowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_MilliWatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_MilliWatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5.68690192748063), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.056869019217937), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "W"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(4425.37289566359), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Watts_to_FtLbPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "W"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(44.2537289123822), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Horsepower" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(74569.987158227), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(745.69987083657), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(0.074569987158227), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(0.000745699870837), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Kilowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(74.569987158227), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(0.74569987083657), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(74569987158.227), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(745699870.83657), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(74569987158227.0), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(745699870836.57), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_MilliWatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(74569987.158227), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_MilliWatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(745699.870836571), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(4240.72203702327), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(42.4072203278255), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "hp"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(3300000), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Horsepower_to_FtLbPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "hp"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(32999.999967), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Megawatts" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Horsepower_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(134102.208959503), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Horsepower_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(1341.02208825401), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Kilowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000000L), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000L), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_MilliWatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_MilliWatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5686901.92748063), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(56869.0192179373), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "MW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(4425372895.66359), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megawatts_to_FtLbPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "MW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(44253728.9123822), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Kilowatts" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Horsepower_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(134.102208959503), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Horsepower_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(1.34102208825401), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000L), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000L), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_MilliWatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_MilliWatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5686.90192748063), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(56.8690192179373), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(4425372.89566359), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Kilowatts_to_FtLbPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(44253.7289123822), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Microwatts" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Horsepower_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(1.34102209E-07), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Horsepower_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(1.341022E-09), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "MW"); - //should be 0.000000000000999999999, can only round to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_kikowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "kW"); - //should be 0.000000000999999999, can only round to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Milliwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_Milliwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5.686901927E-06), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5.6869019E-08), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.004425372895664), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Microwatts_to_FtLbPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(4.4253728912E-05), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Nanowatts" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "W"); - //should be 0.000000000999999999, can only round to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Horsepower_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(1.34102E-10), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Horsepower_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(1.341E-12), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "MW"); - //should be 0.000000000000000999999999, can only round to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Kilowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "kW"); - //should be 0.000000000000999999999, can only round to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Milliwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_Milliwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5.686902E-09), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5.6869E-11), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(4.425372896E-06), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Nanowatts_to_FtLbPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(4.4253729E-08), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Milliwatts" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Horsepower_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(0.00013410220896), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Horsepower_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(1.341022088E-06), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "MW"); - //should be 0.000000000999999999, can only round to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Kilowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.005686901927481), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(5.6869019218E-05), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(4.42537289566359), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Milliwatts_to_FtLbPerMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mW"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.044253728912382), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as BTU/min" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "BTU/min"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(1758.42666666667), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "BTU/min"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(17.5842666490824), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "BTU/min"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(0.001758426666667), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "BTU/min"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(1.7584266649E-05), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Kilowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "BTU/min"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(1.75842666666667), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "BTU/min"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(0.017584266649082), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "BTU/min"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(1758426666.66667), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "BTU/min"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(17584266.6490824), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "BTU/min"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(1758426666666.67), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "BTU/min"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(17584266649.0824), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Milliwatts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "BTU/min"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(1758426.66666667), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_Milliwatts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "BTU/min"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(17584.2666490824), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_BTUperMin_to_FtLbPerMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "BTU/min"; - string targetUnitName = "ft lb/min"; - Measurement expected = new Measurement(Convert.ToDouble(77816.9370967875), "ft lb/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - 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); - } - - #endregion - - #region "Source as ft lb/min" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Watts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(2.25969658055233), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Watts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "W"; - Measurement expected = new Measurement(Convert.ToDouble(0.022596965782926), "W"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Horsepower_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(0.003030303030303), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Horsepower_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "hp"; - Measurement expected = new Measurement(Convert.ToDouble(3.0303030273E-05), "hp"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Megawatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(2.259696581E-06), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Megawatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "MW"; - Measurement expected = new Measurement(Convert.ToDouble(2.2596966E-08), "MW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Kilowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(0.002259696580552), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Kilowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "kW"; - Measurement expected = new Measurement(Convert.ToDouble(2.2596965783E-05), "kW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Microwatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(2259696.58055233), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Microwatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "µW"; - Measurement expected = new Measurement(Convert.ToDouble(22596.9657829264), "µW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Nanowatt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(2259696580.55233), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Nanowatt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "nW"; - Measurement expected = new Measurement(Convert.ToDouble(22596965.7829264), "nW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Milliwatts_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(2259.69658055233), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_Milliwatts_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "mW"; - Measurement expected = new Measurement(Convert.ToDouble(22.5969657829264), "mW"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_BTUperMin_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft lb/min"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.128506728394644), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_FtLbPerMin_to_BTUperMin_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft lb/min"; - string targetUnitName = "BTU/min"; - Measurement expected = new Measurement(Convert.ToDouble(0.001285067282661), "BTU/min"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - #region "Energy Tests" - #region "Source as Joule" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1000000000), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(9999999.99), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(23.8845896627496), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(0.23884589638865), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(0.094781712031332), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(0.000947817119366), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.47816988E-07), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.47817E-09), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "GJ"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "J"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000.0), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_J_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "J"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Energy (erg)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(1E-05), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(2.388458966E-06), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(2.388459E-08), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.478171E-09), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.4782E-11), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.5E-14), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "therm"); - //should be 0.000000000000000947816987, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.01), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-05), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-11), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "Megajoule"); - //should be 0.0000000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-08), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "kJ"); - //should be 0.000000000099999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-14), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0), "GJ"); - //should be 9.99999999E-17, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(10), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.0999999999), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "erg"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(10000), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_erg_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "erg"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(99.9999999), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Calorie (cal)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(418.68), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(4.1867999958132), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(4186800000L), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(41867999.958132), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(0.396832071932955), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(0.003968320715361), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(3.968320165E-06), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(3.9683202E-08), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(418680), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(4186.7999958132), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(0.00041868), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(4.186799996E-06), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.41868), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.004186799995813), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(4.1868E-07), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(4.1868E-09), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(418680000), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(4186799.9958132), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cal"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(418680000000.0), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cal_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cal"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(4186799995.8132), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as British thermal unit (Btu)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(105505.585262), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(1055.05585156494), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1055055852620.0), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(10550558515.6494), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(25199.5761111), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(251.995760859004), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(0.001), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-06), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(105505585.262), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(1055055.85156494), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(0.105505585262), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(0.001055055851565), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(105.505585262), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(1.05505585156494), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.000105505585262), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1.055055852E-06), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(105505585262.0), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(1055055851.56494), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Btu"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(105505585262000.0), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Btu_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Btu"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(1055055851564.94), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Therm (therm)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(10550560000.0), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(105505599.894494), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1.055056E+17), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1055055998944944L), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(2519957963.1222), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(25199579.6060224), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(10000000), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(99999.9999), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(10550560000000.0), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(105505599894.494), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(10550.56), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(105.505599894494), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(10550560), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(105505.599894494), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(10.55056), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.105505599894494), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(1.055056E+16), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(105505599894494.0), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "therm"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(1.055056E+19), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_therm_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "therm"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(1.05505599894494E+17), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Millijoules (mJ)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "J"); - //actual value 0.001, .net bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1000000), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(9999.99999), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(0.02388458966275), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(0.000238845896389), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.4781712031E-05), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.47817119E-07), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.47817E-10), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.478E-12), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "Megajoule"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "GJ"); - //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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mJ_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Megajoules (MJ)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1E+15), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(9999999990000.0), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(23884589.6627496), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(238845.89638865), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(94781.7120313317), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(947.8171193655), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(0.947816987913438), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(0.009478169869656), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000.0), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000.0), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000.0), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Megajoule"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E+17), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Megajoule_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Megajoule"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000.0), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Kilojoules (kJ)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1000000000000.0), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(9999999990L), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(23884.5896627496), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(238.84589638865), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(94.7817120313317), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(0.9478171193655), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(0.000947816987913), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.47816987E-06), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000.0), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000.0), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kJ_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000.0), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Gigajoules (GJ)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000.0), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1E+18), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E+15), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(23884589662.75), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(238845896.388654), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(94781712.031332), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(947817.119365503), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(947.816987913438), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.47816986965621), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000000.0), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000.0), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E+17), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(999999999000000.0), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "GJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E+20), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_GJ_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "GJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E+17), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Microjoules (µJ)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1000), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(2.3884589663E-05), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(2.38845896E-07), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.4781712E-08), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.47817E-10), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9.48E-13), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(9E-15), "therm"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "Megajoule"); - //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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "kJ"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "GJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "GJ"); - //should be 0.000000000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_nJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µJ_to_nJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µJ"; - string targetUnitName = "nJ"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "nJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - - #region "Source as Nanojoules (nJ)" - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_J_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "J"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_J_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "J"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "J"); - //should be 0.000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_erg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(1), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_erg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "erg"; - Measurement expected = new Measurement(Convert.ToDouble(0.00999999999), "erg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_cal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(2.388459E-08), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_cal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "cal"; - Measurement expected = new Measurement(Convert.ToDouble(2.38846E-10), "cal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_Btu_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.4782E-11), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_Btu_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "Btu"; - Measurement expected = new Measurement(Convert.ToDouble(9.48E-13), "Btu"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_therm_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "therm"); - //should be 0.0000000000000009478169879, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_therm_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "therm"; - Measurement expected = new Measurement(Convert.ToDouble(0), "therm"); - //should be 9.47816987E-18, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_mJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_mJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "mJ"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "mJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_Megajoule_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-13), "Megajoule"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_Megajoule_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "Megajoule"; - Measurement expected = new Measurement(Convert.ToDouble(1E-15), "Megajoule"); - //should be 0.000000000000000999999999, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_kJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "kJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_kJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "kJ"; - Measurement expected = new Measurement(Convert.ToDouble(1E-12), "kJ"); - //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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_GJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0), "GJ"); - //should be 0.0000000000000001, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_GJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "GJ"; - Measurement expected = new Measurement(Convert.ToDouble(0), "GJ"); - //should be 9.99999999E-19, .net rounds to 15 places - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_µJ_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "nJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_nJ_to_µJ_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "nJ"; - string targetUnitName = "µJ"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "µJ"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - #endregion - #endregion - - #region "Plane Angle Tests" - - #region "Source as Radians" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rad_to_deg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "rad"; - string targetUnitName = "deg"; - Measurement expected = new Measurement(Convert.ToDouble(5729.57795130823), "deg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rad_to_deg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "rad"; - string targetUnitName = "deg"; - Measurement expected = new Measurement(Convert.ToDouble(57.2957794557866), "deg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rad_to_grad_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "rad"; - string targetUnitName = "grad"; - Measurement expected = new Measurement(Convert.ToDouble(6366.19772367581), "grad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rad_to_grad_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "rad"; - string targetUnitName = "grad"; - Measurement expected = new Measurement(Convert.ToDouble(63.6619771730962), "grad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rad_to_rev_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "rad"; - string targetUnitName = "rev"; - Measurement expected = new Measurement(Convert.ToDouble(15.915494309), "rev"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rad_to_rev_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "rad"; - string targetUnitName = "rev"; - Measurement expected = new Measurement(Convert.ToDouble(0.159154942930845), "rev"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Degrees" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_deg_to_rad_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "deg"; - string targetUnitName = "rad"; - Measurement expected = new Measurement(Convert.ToDouble(1.74532925199433), "rad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_deg_to_rad_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "deg"; - string targetUnitName = "rad"; - Measurement expected = new Measurement(Convert.ToDouble(0.01745329250249), "rad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_deg_to_grad_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "deg"; - string targetUnitName = "grad"; - Measurement expected = new Measurement(Convert.ToDouble(111.111111111111), "grad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_deg_to_grad_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "deg"; - string targetUnitName = "grad"; - Measurement expected = new Measurement(Convert.ToDouble(1.11111111), "grad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_deg_to_rev_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "deg"; - string targetUnitName = "rev"; - Measurement expected = new Measurement(Convert.ToDouble(0.277777777777778), "rev"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_deg_to_rev_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "deg"; - string targetUnitName = "rev"; - Measurement expected = new Measurement(Convert.ToDouble(0.002777777775), "rev"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Gradians" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_grad_to_rad_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "grad"; - string targetUnitName = "rad"; - Measurement expected = new Measurement(Convert.ToDouble(1.5707963267949), "rad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_grad_to_rad_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "grad"; - string targetUnitName = "rad"; - Measurement expected = new Measurement(Convert.ToDouble(0.015707963252241), "rad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_grad_to_deg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "grad"; - string targetUnitName = "deg"; - Measurement expected = new Measurement(Convert.ToDouble(90), "deg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_grad_to_deg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "grad"; - string targetUnitName = "deg"; - Measurement expected = new Measurement(Convert.ToDouble(0.8999999991), "deg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_grad_to_rev_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "grad"; - string targetUnitName = "rev"; - Measurement expected = new Measurement(Convert.ToDouble(0.25), "rev"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_grad_to_rev_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "grad"; - string targetUnitName = "rev"; - Measurement expected = new Measurement(Convert.ToDouble(0.0024999999975), "rev"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Revolutions" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rev_to_rad_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "rev"; - string targetUnitName = "rad"; - Measurement expected = new Measurement(Convert.ToDouble(628.318530725441), "rad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rev_to_rad_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "rev"; - string targetUnitName = "rad"; - Measurement expected = new Measurement(Convert.ToDouble(6.28318530097123), "rad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rev_to_deg_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "rev"; - string targetUnitName = "deg"; - Measurement expected = new Measurement(Convert.ToDouble(36000), "deg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rev_to_deg_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "rev"; - string targetUnitName = "deg"; - Measurement expected = new Measurement(Convert.ToDouble(359.99999964), "deg"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rev_to_grad_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "rev"; - string targetUnitName = "grad"; - Measurement expected = new Measurement(Convert.ToDouble(40000), "grad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_rev_to_grad_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "rev"; - string targetUnitName = "grad"; - Measurement expected = new Measurement(Convert.ToDouble(399.9999996), "grad"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #endregion - - #region "Volume Tests" - #region "Source as Cubic Inches" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.05787037037037), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.000578703703125), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.002143347050754), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(2.1433470486E-05), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.0016387064), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(1.6387063984E-05), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(1638.7064), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(16.387063983613), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(1.6387064), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(0.016387063983613), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(55.4112554112554), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(0.554112553558442), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.432900432900433), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.004329004324675), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(3.46320346320346), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(0.034632034597403), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(1.73160173160173), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in3_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(0.017316017298701), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Cubic Feet" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(172800), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(1727.999998272), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(3.7037037037037), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.037037037), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(2.8316846592), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.028316846563683), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(2831684.6592), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(28316.8465636832), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(2831.6846592), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(28.3168465636832), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(95750.6493506493), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(957.506492548987), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(748.051948051948), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(7.48051947303896), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(5984.41558441558), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(59.8441557843117), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(2992.20779220779), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft3_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(29.9220778921558), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Cubic Yards" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(4665600), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(46655.999953344), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(2700), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(26.999999973), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(76.4554857984), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.764554857219445), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(76455485.7984), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(764554.857219445), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(76455.4857984), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(764.554857219445), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(2585267.53246753), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(25852.6752988226), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(20197.4025974026), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(201.974025772052), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(161579.220779221), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(1615.79220617642), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(80789.6103896104), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd3_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(807.896103088208), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Cubic Meters" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(6102374.40947323), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(61023.7440337085), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(3531.46667214886), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(35.3146666861739), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(130.795061931439), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(1.30795061800644), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(3381402.2701843), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(33814.022668029), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(26417.2052358148), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(264.172052093976), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(211337.641886519), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(2113.37641675181), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(105668.820943259), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m3_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m3"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(1056.68820837591), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Cubic Centimeters" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(6.10237440947323), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(0.061023744033709), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.003531466672149), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(3.5314666686E-05), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.000130795061931), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(1.307950618E-06), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(3.3814022701843), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(0.033814022668029), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.026417205235815), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.000264172052094), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(0.211337641886519), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(0.002113376416752), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cc"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(0.105668820943259), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cc_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cc"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(0.001056688208376), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Liters" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(6102.37440947323), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(61.0237440337085), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(3.53146667214886), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.035314666686174), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.130795061931439), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.001307950618006), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(3381.4022701843), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(33.814022668029), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(26.4172052358148), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.264172052093976), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(211.337641886519), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(2.11337641675181), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "L"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(105.668820943259), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_L_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "L"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(1.05668820837591), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Fluid Ounces" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(180.46875), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(1.80468749819531), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.104437934027778), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.001044379339233), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.003868071630658), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(3.8680716268E-05), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.00295735295625), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(2.9573529533E-05), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(2957.35295625), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(29.5735295329265), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(2.95735295625), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(0.029573529532926), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.78125), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.007812499992188), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(6.25), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(0.0624999999375), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "fl oz"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(3.125), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_floz_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "fl oz"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(0.03124999996875), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Gallons" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(23100), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(230.999999769), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(13.3680555555556), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.133680555421875), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.49511316872428), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.004951131682292), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.3785411784), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.003785411780215), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(378541.1784), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(3785.41178021459), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(378.5411784), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(3.78541178021459), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(12800), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(127.999999872), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(800), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(7.999999992), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "gal"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(400), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_gal_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "gal"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(3.999999996), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Pints" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(2887.5), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(28.874999971125), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(1.67100694444444), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.016710069427734), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.061889146090535), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.000618891460286), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.0473176473), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.000473176472527), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(47317.6473), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(473.176472526824), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(47.3176473), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(0.473176472526824), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(1600), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(15.999999984), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(12.5), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.124999999875), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_qt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "pt"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(50), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_pt_to_qt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "pt"; - string targetUnitName = "qt"; - Measurement expected = new Measurement(Convert.ToDouble(0.4999999995), "qt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Quarts" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_in3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(5775), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_in3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "in3"; - Measurement expected = new Measurement(Convert.ToDouble(57.74999994225), "in3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_ft3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(3.34201388888889), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_ft3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "ft3"; - Measurement expected = new Measurement(Convert.ToDouble(0.033420138855469), "ft3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_yd3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.12377829218107), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_yd3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "yd3"; - Measurement expected = new Measurement(Convert.ToDouble(0.001237782920573), "yd3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_m3_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.0946352946), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_m3_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "m3"; - Measurement expected = new Measurement(Convert.ToDouble(0.000946352945054), "m3"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_cc_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(94635.2946), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_cc_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "cc"; - Measurement expected = new Measurement(Convert.ToDouble(946.352945053647), "cc"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_L_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(94.6352946), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_L_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "L"; - Measurement expected = new Measurement(Convert.ToDouble(0.946352945053647), "L"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_floz_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(3200), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_floz_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "fl oz"; - Measurement expected = new Measurement(Convert.ToDouble(31.999999968), "fl oz"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_gal_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(25), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_gal_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "gal"; - Measurement expected = new Measurement(Convert.ToDouble(0.24999999975), "gal"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_pt_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "qt"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(200), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_qt_to_pt_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "qt"; - string targetUnitName = "pt"; - Measurement expected = new Measurement(Convert.ToDouble(1.999999998), "pt"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - #endregion - } -} diff --git a/Units.Test/UnitConverterTest4.cs b/Units.Test/UnitConverterTest4.cs deleted file mode 100644 index 5e18554..0000000 --- a/Units.Test/UnitConverterTest4.cs +++ /dev/null @@ -1,2967 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - -namespace Units.Test -{ - [TestClass()] - public class UnitConverterTest4 - { - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ _ - //Public Sub MyTestCleanup() - //End Sub - // - - #endregion - - #region "UnitConverter.ConvertUnits" - - #region "Area Tests" - #region "Source as Square Meters" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(1076.39104167097), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(10.7639104059458), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.8610215854E-05), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.86102158E-07), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(0.024710538146717), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(0.00024710538122), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(155000.31000062), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(1550.0030984562), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(1000000), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(9999.99999), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(119.599004630108), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(1.19599004510509), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "m2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(0.01), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_m2_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "m2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-05), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Square Feet" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(9.290304), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(0.092903039907097), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.587006428E-06), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.5870064E-08), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(0.002295684113866), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(2.2956841116E-05), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(14400), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(143.999999856), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(92903.04), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(929.03039907097), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(11.1111111111111), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(0.111111111), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(9.290304E-06), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(9.290304E-08), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ft2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(0.0009290304), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ft2_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ft2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(9.290303991E-06), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Square Miles" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(258998811.0336), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(2589988.10774601), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(2787840000L), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(27878399.9721216), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(64000), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(639.99999936), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(401448960000L), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(4014489595.98551), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(2589988110336L), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(25899881077.46), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(309760000), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(3097599.9969024), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(258.9988110336), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(2.589988107746), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mi2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(25899.88110336), "ha"); - //should be 25899.88110336, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mi2_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mi2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(258.998810774601), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Acres" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(404685.64224), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(4046.85641835314), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(4356000), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(43559.99995644), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(0.15625), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(0.001562499998438), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(627264000), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(6272639.99372736), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(4046856422.4), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(40468564.1835314), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(484000), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(4839.99999516), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(0.40468564224), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(0.004046856418353), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "acre"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(40.468564224), "ha"); - //should be 40.468564224, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_acre_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "acre"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(0.404685641835314), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Square Inches" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(0.064516), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(0.000645159999355), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(0.694444444444444), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(0.0069444444375), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(2.4909767E-08), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(2.49098E-10), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(1.5942250791E-05), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(1.59422508E-07), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(645.16), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(6.4515999935484), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(0.07716049382716), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(0.0007716049375), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(6.4516E-08), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(6.4516E-10), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "in2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(6.4516E-06), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_in2_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "in2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(6.4516E-08), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Square Centimeters" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(0.107639104167097), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(0.001076391040595), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.861022E-09), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.861E-11), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(2.471053815E-06), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(2.4710538E-08), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(15.500031000062), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(0.15500030984562), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(0.01), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-05), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(0.011959900463011), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(0.000119599004511), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(1E-08), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(1E-10), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cm2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(1E-06), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cm2_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cm2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(1E-08), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Square Yards" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(83.612736), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(0.836127359163873), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(900), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(8.999999991), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.2283057851E-05), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(3.22830578E-07), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(0.020661157024793), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(0.000206611570041), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(129600), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(1295.999998704), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(836127.36), "cm2"); - //should be 836127.36, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(8361.27359163873), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(8.3612736E-05), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(8.36127359E-07), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "yd2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(0.0083612736), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_yd2_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "yd2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(8.3612735916E-05), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Square Kilometers" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(1076391041.67097), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(10763910.4059458), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(38.6102158542446), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(0.386102158156344), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(24710.5381467165), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(247.10538122006), "acre"); - //should be 247.10538122006, .net conversion bug - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(155000310000.62), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(1550003098.4562), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(1000000000000L), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(9999999990L), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(119599004.630108), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(1195990.04510509), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_ha_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "km2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(10000), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_km2_to_ha_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "km2"; - string targetUnitName = "ha"; - Measurement expected = new Measurement(Convert.ToDouble(99.9999999), "ha"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Hectares" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_m2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(1000000.0), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_m2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "m2"; - Measurement expected = new Measurement(Convert.ToDouble(9999.99999), "m2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_ft2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(10763910.4167097), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_ft2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "ft2"; - Measurement expected = new Measurement(Convert.ToDouble(107639.104059458), "ft2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_mi2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(0.386102158542446), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_mi2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "mi2"; - Measurement expected = new Measurement(Convert.ToDouble(0.003861021581563), "mi2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_acre_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(247.105381467165), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_acre_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "acre"; - Measurement expected = new Measurement(Convert.ToDouble(2.4710538122006), "acre"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_in2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(1550003100.0062), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_in2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "in2"; - Measurement expected = new Measurement(Convert.ToDouble(15500030.984562), "in2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_cm2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(10000000000L), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_cm2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "cm2"; - Measurement expected = new Measurement(Convert.ToDouble(99999999.9), "cm2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_yd2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(1195990.04630108), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_yd2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "yd2"; - Measurement expected = new Measurement(Convert.ToDouble(11959.9004510509), "yd2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_km2_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "ha"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(1), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_ha_to_km2_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "ha"; - string targetUnitName = "km2"; - Measurement expected = new Measurement(Convert.ToDouble(0.00999999999), "km2"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - #region "Absorbed Radiation Dose Tests" - #region "Source as Gray" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_cGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(10000), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_cGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(99.9999999), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_mGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_mGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_µGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_µGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_kGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "Gy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_Gy_to_kGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "Gy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Centigray" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_Gy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(1), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_Gy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(0.00999999999), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_mGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cGy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(1000), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_mGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cGy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_µGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cGy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(1000000), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_µGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cGy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(9999.99999), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_kGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "cGy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.001), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_cGy_to_kGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "cGy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-06), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Milligray" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_Gy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_Gy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_cGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mGy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(10), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_cGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mGy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.0999999999), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_µGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mGy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_µGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mGy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_kGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "mGy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_mGy_to_kGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "mGy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Microgray" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_Gy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(0.0001), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_Gy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-07), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_cGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µGy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.01), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_cGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µGy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(9.99999999E-05), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_mGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µGy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.1), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_mGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µGy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(0.000999999999), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_kGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "µGy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(1E-07), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_µGy_to_kGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "µGy"; - string targetUnitName = "kGy"; - Measurement expected = new Measurement(Convert.ToDouble(1E-09), "kGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - - #region "Source as Kilogray" - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_Gy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(100000), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_Gy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kGy"; - string targetUnitName = "Gy"; - Measurement expected = new Measurement(Convert.ToDouble(999.999999), "Gy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_cGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kGy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(10000000), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_cGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kGy"; - string targetUnitName = "cGy"; - Measurement expected = new Measurement(Convert.ToDouble(99999.9999), "cGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_mGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kGy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(100000000), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_mGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kGy"; - string targetUnitName = "mGy"; - Measurement expected = new Measurement(Convert.ToDouble(999999.999), "mGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_µGy_Test() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(100); - string currentUnitName = "kGy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(100000000000L), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Integration)] - [TestCategory(UnitTestCategory.UnitConversion)] - public void UnitConverter_ConvertUnits_kGy_to_µGy_Test2() - { - UnitConverter target = new UnitConverter(); - double value = Convert.ToDouble(0.999999999); - string currentUnitName = "kGy"; - string targetUnitName = "µGy"; - Measurement expected = new Measurement(Convert.ToDouble(999999999), "µGy"); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(value, currentUnitName, targetUnitName); - Assert.AreEqual(expected.Value, actual.Value); - } - - #endregion - #endregion - - #endregion - - #region "UnitConverter.UnitConverter()" - /// - ///A test for UnitConverter Constructor - /// - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverterConstructorTest() - { - UnitConverter target = new UnitConverter(); - Assert.IsNotNull(target); - } - #endregion - - #region "Empty and Null Tests" - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - 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); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ConvertUnitsNullTest2() - { - UnitConverter target = new UnitConverter(); - Measurement expected = new Measurement(0, Result.BadUnit); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(0, "ft", null); - Assert.AreNotEqual(expected, actual); - Assert.AreEqual(expected.ConversionResult, actual.ConversionResult); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ConvertUnitsNullTest3() - { - UnitConverter target = new UnitConverter(); - Measurement expected = new Measurement(0, Result.BadUnit); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(0, null, "m"); - Assert.AreNotEqual(expected, actual); - Assert.AreEqual(expected.ConversionResult, actual.ConversionResult); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ConvertUnitsEmptyTest() - { - UnitConverter target = new UnitConverter(); - Measurement expected = new Measurement(0, Result.BadUnit); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(0, string.Empty, string.Empty); - Assert.AreNotEqual(expected, actual); - Assert.AreEqual(expected.ConversionResult, actual.ConversionResult); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - public void UnitConverter_ConvertUnitsEmptyTest2() - { - UnitConverter target = new UnitConverter(); - Measurement expected = new Measurement(0, Result.BadUnit); - Measurement actual = default(Measurement); - actual = target.ConvertUnits(0, "ft", string.Empty); - Assert.AreNotEqual(expected, actual); - Assert.AreEqual(expected.ConversionResult, actual.ConversionResult); - } - - [TestMethod()] - [TestCategory(UnitTestCategory.Unit)] - 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); - } - - #endregion - } -} diff --git a/Units.Test/UnitProviderTest.cs b/Units.Test/UnitProviderTest.cs deleted file mode 100644 index f423086..0000000 --- a/Units.Test/UnitProviderTest.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - - - -/// -///This is a test class for UnitProvider and is intended -///to contain all UnitProvider Unit Tests -/// -[TestClass()] -public class UnitProviderTest -{ - - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ - //Public Sub MyTestCleanup() - //End Sub - // - #endregion - - - /// - ///A test for UnitTypes - /// - [TestMethod()] - public void UnitTypesTest() - { - Dictionary actual = default(Dictionary); - actual = unitPro.UnitTypes; - - Assert.IsNotNull(actual); - Assert.IsTrue(actual.Count > 0); - } - - /// - ///A test for Units - /// - [TestMethod()] - public void UnitsTest() - { - Dictionary actual = default(Dictionary); - actual = unitPro.Units; - - Assert.IsNotNull(actual); - Assert.IsTrue(actual.Count > 0); - } - - /// - ///A test for Symbols - /// - [TestMethod()] - public void SymbolsTest() - { - Dictionary actual = default(Dictionary); - actual = unitPro.Symbols; - - Assert.IsNotNull(actual); - Assert.IsTrue(actual.Count > 0); - } -} - diff --git a/Units.Test/UnitTest.cs b/Units.Test/UnitTest.cs deleted file mode 100644 index c937c5f..0000000 --- a/Units.Test/UnitTest.cs +++ /dev/null @@ -1,427 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using Units; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections.ObjectModel; - -/// -///This is a test class for UnitTest and is intended -///to contain all UnitTest Unit Tests -/// -[TestClass()] -public class UnitTest -{ - - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ - //Public Sub MyTestCleanup() - //End Sub - // - #endregion - - #region "Unit.Unit()" - [TestMethod()] - public void UnitNewTest() - { - Unit testObj = new Unit(); - - Assert.IsNotNull(testObj); - Assert.IsTrue(testObj.ID == 0); - Assert.IsTrue(string.IsNullOrEmpty(testObj.DefaultSymbol)); - Assert.IsNull(testObj.UnitType); - Assert.IsNotNull(testObj.Symbols); - Assert.IsTrue(testObj.Symbols.Count == 0); - Assert.IsNotNull(testObj.Modifiers); - Assert.IsTrue(testObj.Modifiers.Count == 0); - Assert.IsTrue(string.IsNullOrEmpty(testObj.Name)); - } - #endregion - - #region "Unit.Unit(UnitType)" - [TestMethod()] - [ExpectedException(typeof(ArgumentNullException))] - public void UnitNewEfUnitUnitTypeNullTest() - { - Unit testObj = new Unit(null); - - Assert.Fail("Constructor should cause a ContractException. Nulls are not allowed"); - } - - [TestMethod()] - public void UnitNewEfUnitUnitTypeTest() - { - UnitType testunittype = new UnitType - { - ID = 99, - Name = "Name" - }; - Unit testObj = new Unit(testunittype); - - Assert.IsNotNull(testObj); - Assert.IsNotNull(testObj.UnitType); - Assert.IsTrue(testObj.UnitTypeID == 99); - Assert.AreEqual(testunittype.Name, testObj.UnitType.Name); - - Assert.IsNotNull(testObj.Symbols); - Assert.IsTrue(testObj.Symbols.Count == 0); - - Assert.IsNotNull(testObj.Modifiers); - Assert.IsTrue(testObj.Modifiers.Count == 0); - // Assert.IsTrue(testUnit.UnitModifiers(0).Value = testObj.Modifiers(0).Value) - } - #endregion - - #region "Unit.ParentType" - [TestMethod()] - public void UnitParentTypeTest() - { - UnitType testUnitType = new UnitType - { - ID = 99, - Name = "Name" - }; - - Unit testObj = new Unit(); - - testObj.UnitType = testUnitType; - - Assert.IsNotNull(testObj.UnitType); - Assert.AreEqual(testUnitType.ID, testObj.UnitType.ID); - Assert.AreEqual(testUnitType.Name, testObj.UnitType.Name); - } - - [TestMethod()] - public void UnitParentTypeNullTest() - { - Unit testObj = new Unit(); - - testObj.UnitType = null; - - Assert.IsNull(testObj.UnitType); - } - #endregion - - #region "Unit.ID" - [TestMethod()] - public void UnitIDTest() - { - Unit testObj = new Unit(); - - testObj.ID = 99; - - Assert.AreEqual(99, testObj.ID); - } - - //[TestMethod()] - //public void UnitIDNullTest() - //{ - // Unit testObj = new Unit(); - - // testObj.ID = null; - - // Assert.AreEqual(null, testObj.ID); - //} - - //[TestMethod()] - //public void UnitIDNegativeTest() - //{ - // Unit testObj = new Unit(); - - // testObj.ID = -1; - - // Assert.IsTrue(testObj.ID == -1); - - // List data = Validation.DataAnnotationValidator.GetErrors(testObj).ToList; - - // Assert.IsNotNull(data); - // Assert.IsTrue(data.Count > 0); - // Assert.IsTrue(data(0).PropertyName == "ID"); - //} - #endregion - - #region "Unit.Name" - [TestMethod()] - public void UnitNameTest() - { - Unit testObj = new Unit(); - - testObj.Name = "Test Name"; - - Assert.AreEqual("Test Name", testObj.Name); - } - - //[TestMethod()] - //public void UnitNameNullTest() - //{ - // Unit testObj = new Unit(); - - // testObj.Name = null; - - // Assert.IsTrue(string.IsNullOrWhiteSpace(testObj.Name)); - - // List data = Validation.DataAnnotationValidator.GetErrors(testObj).ToList; - - // Assert.IsNotNull(data); - // Assert.IsTrue(data.Count > 0); - // Assert.IsTrue(data(0).PropertyName == "Name"); - //} - #endregion - - #region "IEquatable" - [TestMethod()] - public void Unit_EqualityTest() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = unitPro.Units["Feet"]; - - Assert.IsTrue(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest2() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = unitPro.Units["Inch"]; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest3() - { - Unit expected = null; - Unit target = unitPro.Units["Inch"]; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest4() - { - Unit expected = unitPro.Units["Inch"]; - Unit target = null; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest5() - { - Unit expected = null; - Unit target = null; - - Assert.IsTrue(expected == target); - } - - [TestMethod()] - public void Unit_EqualityTest6() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = unitPro.Units["Inch"]; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest7() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = null; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest8() - { - Unit expected = null; - Unit target = unitPro.Units["Feet"]; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest8_1() - { - Unit expected = null; - Unit target = null; - - Assert.IsFalse(expected != target); - } - - [TestMethod()] - public void Unit_EqualityTest9() - { - Unit expected = unitPro.Units["Inch"]; - Unit target = unitPro.Units["Feet"]; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest10() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = unitPro.Units["Feet"]; - - Assert.IsTrue(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest11() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = unitPro.Units["Inch"]; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest12() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = null; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void Unit_EqualityTest13() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = unitPro.Units["Feet"]; - - Assert.IsTrue(expected.Equals((object)target)); - } - - [TestMethod()] - public void Unit_EqualityTest14() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = unitPro.Units["Inch"]; - - Assert.IsFalse(expected.Equals((object)target)); - } - - [TestMethod()] - public void Unit_EqualityTest154() - { - Unit expected = unitPro.Units["Feet"]; - Unit target = null; - - Assert.IsFalse(expected.Equals((object)target)); - } - - [TestMethod()] - public void Unit_EqualityTest15() - { - Unit expected = unitPro.Units["Feet"]; - - Assert.IsTrue(expected.GetHashCode() == expected.Name.GetHashCode()); - } - #endregion - - //#region "Serialization" - //[TestMethod()] - //public void Unit_BinarySerializationTest() - //{ - // Unit expected = unitPro.Units["Feet"]; - // Unit actual = default(Unit); - - // byte[] data = Utility.BinarySerialize(expected); - // actual = (Unit)Utility.BinaryDeserialize(data); - - // Assert.IsNotNull(actual); - // Assert.AreEqual(expected.ID, actual.ID); - // Assert.AreEqual(expected.Name, actual.Name); - // Assert.AreEqual(expected.DefaultSymbol, actual.DefaultSymbol); - // Assert.AreEqual(expected.IsDefault, actual.IsDefault); - // Assert.AreEqual(expected.Modifiers.Count, actual.Modifiers.Count); - // Assert.AreEqual(expected.Symbols.Count, actual.Symbols.Count); - // Assert.AreEqual(expected.UnitTypeID, actual.UnitTypeID); - //} - - //[TestMethod()] - //public void Unit_DataContractSerializationTest() - //{ - // Unit expected = unitPro.Units["Feet"]; - // Unit actual = default(Unit); - - // string data = Utility.DataContractSerialize(expected); - // actual = (Unit)Utility.DataContractDeserialize(data, typeof(Unit)); - - // Assert.IsNotNull(actual); - // Assert.AreEqual(expected.ID, actual.ID); - // Assert.AreEqual(expected.Name, actual.Name); - // Assert.AreEqual(expected.DefaultSymbol, actual.DefaultSymbol); - // Assert.AreEqual(expected.IsDefault, actual.IsDefault); - // Assert.AreEqual(expected.Modifiers.Count, actual.Modifiers.Count); - // Assert.AreEqual(expected.Symbols.Count, actual.Symbols.Count); - // Assert.AreEqual(expected.UnitTypeID, actual.UnitTypeID); - //} - //#endregion - - //Private Function InitEfObjects() As EFUnitType - //Dim efUnitTypeObj As New EFUnitType - //efUnitTypeObj.ID = 10 - //efUnitTypeObj.Name = "Test Type" - //efUnitTypeObj.Description = "Test Desc" - - //Dim efUnitObj As New EFUnit - //efUnitObj.ID = 2 - //efUnitObj.Name = "Test Unit" - //efUnitObj.UnitType = efUnitTypeObj - - //Dim efUnitModifierObj As New EFUnitModifier - //efUnitModifierObj.ID = 2 - //efUnitModifierObj.ModifierID = 2 - //efUnitModifierObj.Order = 1 - //efUnitModifierObj.Value = 0.5 - - //Dim efUnitSymbolObj As New EFUnitSymbol - //efUnitSymbolObj.ID = 3 - //efUnitSymbolObj.IsDefault = True - //efUnitSymbolObj.Symbol = "Tst" - - //efUnitModifierObj.Unit = efUnitObj - //efUnitSymbolObj.Unit = efUnitObj - - //efUnitTypeObj.Unit.Add(efUnitObj) - //efUnitObj.UnitModifiers.Add(efUnitModifierObj) - //efUnitObj.UnitSymbol.Add(efUnitSymbolObj) - - //Return efUnitTypeObj - //End Function -} diff --git a/Units.Test/UnitTest1.cs b/Units.Test/UnitTest1.cs deleted file mode 100644 index 2e8b274..0000000 --- a/Units.Test/UnitTest1.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Units; - -namespace Units.Test -{ - [TestClass] - public class UnitTest1 - { - //[TestMethod] - //public void TestMethod1() - //{ - // UnitProvider up = new UnitProvider(); - // //int i = 0; - - // var fiveft = new Measurement(5, "ft"); - // var twoinch = new Measurement(2, "inch"); - - // fiveft.GetValueAs("inch"); - - // var result = fiveft + twoinch; - //} - } - - - //public class Observer : IObserver - //{ - - // public void OnNext(int i) - // { - - // } - - // public void OnCompleted() - // { - - // } - - // public void OnError(Exception ex) - // { - - // } - - //} - - //public class Observable : IObservable - //{ - - // public IDisposable Subscribe(IObserver obj) - // { - // return null; - // } - - //} -} diff --git a/Units.Test/UnitTypeTest.cs b/Units.Test/UnitTypeTest.cs deleted file mode 100644 index 2bf4332..0000000 --- a/Units.Test/UnitTypeTest.cs +++ /dev/null @@ -1,321 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using Units; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -/// -///This is a test class for UnitTest and is intended -///to contain all UnitTest Unit Tests -/// -[TestClass()] -public class UnitTypeTest -{ - - private TestContext testContextInstance; - - private UnitProvider unitPro = new UnitProvider(); - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { return testContextInstance; } - set { testContextInstance = value; } - } - - #region "Additional test attributes" - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - // _ - //Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) - //End Sub - // - //Use ClassCleanup to run code after all tests in a class have run - // _ - //Public Shared Sub MyClassCleanup() - //End Sub - // - //Use TestInitialize to run code before running each test - // _ - //Public Sub MyTestInitialize() - //End Sub - // - //Use TestCleanup to run code after each test has run - // _ - //Public Sub MyTestCleanup() - //End Sub - // - #endregion - - #region "UnitType.UnitType()" - [TestMethod()] - public void UnitTypeNewTest() - { - UnitType testObj = new UnitType(); - - Assert.IsNotNull(testObj); - Assert.IsTrue(testObj.ID == 0); - Assert.IsNotNull(testObj.Units); - Assert.IsTrue(testObj.Units.Count == 0); - Assert.IsTrue(string.IsNullOrEmpty(testObj.Name)); - } - #endregion - - #region "UnitType.ID" - [TestMethod()] - public void UnitTypeIDTest() - { - UnitType testObj = new UnitType(); - - testObj.ID = 99; - - Assert.AreEqual(99, testObj.ID); - } - - //[TestMethod()] - //public void UnitTypeIDNullTest() - //{ - // UnitType testObj = new UnitType(); - - // testObj.ID = null; - - // Assert.AreEqual(null, testObj.ID); - //} - - //[TestMethod()] - //public void UnitTypeIDNegativeTest() - //{ - // UnitType testObj = new UnitType(); - - // testObj.ID = -1; - - // Assert.IsTrue(testObj.ID == -1); - - // List data = Validation.DataAnnotationValidator.GetErrors(testObj).ToList; - - // Assert.IsNotNull(data); - // Assert.IsTrue(data.Count > 0); - // Assert.IsTrue(data(0).PropertyName == "ID"); - //} - #endregion - - #region "UnitType.Name" - [TestMethod()] - public void UnitTypeNameTest() - { - UnitType testObj = new UnitType(); - - testObj.Name = "Test Name"; - - Assert.AreEqual("Test Name", testObj.Name); - } - - //[TestMethod()] - //public void UnitTypeNameNullTest() - //{ - // UnitType testObj = new UnitType(); - - // testObj.Name = null; - - // Assert.IsTrue(string.IsNullOrWhiteSpace(testObj.Name)); - - // List data = Validation.DataAnnotationValidator.GetErrors(testObj).ToList; - - // Assert.IsNotNull(data); - // Assert.IsTrue(data.Count > 0); - // Assert.IsTrue(data(0).PropertyName == "Name"); - //} - #endregion - - #region "IEquatable" - [TestMethod()] - public void UnitType_EqualityTest() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = unitPro.UnitTypes["Length"]; - - Assert.IsTrue(expected == target); - } - - [TestMethod()] - public void UnitType_EqualityTest2() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = unitPro.UnitTypes["Mass"]; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void UnitType_EqualityTest3() - { - UnitType expected = null; - UnitType target = unitPro.UnitTypes["Mass"]; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void UnitType_EqualityTest4() - { - UnitType expected = unitPro.UnitTypes["Mass"]; - UnitType target = null; - - Assert.IsFalse(expected == target); - } - - [TestMethod()] - public void UnitType_EqualityTest5() - { - UnitType expected = null; - UnitType target = null; - - Assert.IsTrue(expected == target); - } - - [TestMethod()] - public void UnitType_EqualityTest6() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = unitPro.UnitTypes["Mass"]; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void UnitType_EqualityTest7() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = null; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void UnitType_EqualityTest8() - { - UnitType expected = null; - UnitType target = unitPro.UnitTypes["Length"]; - - Assert.IsTrue(expected != target); - } - - [TestMethod()] - public void UnitType_EqualityTest8_1() - { - UnitType expected = null; - UnitType target = null; - - Assert.IsFalse(expected != target); - } - - [TestMethod()] - public void UnitType_EqualityTest9() - { - UnitType expected = unitPro.UnitTypes["Mass"]; - UnitType target = unitPro.UnitTypes["Length"]; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void UnitType_EqualityTest10() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = unitPro.UnitTypes["Length"]; - - Assert.IsTrue(expected.Equals(target)); - } - - [TestMethod()] - public void UnitType_EqualityTest11() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = unitPro.UnitTypes["Mass"]; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void UnitType_EqualityTest12() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = null; - - Assert.IsFalse(expected.Equals(target)); - } - - [TestMethod()] - public void UnitType_EqualityTest13() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = unitPro.UnitTypes["Length"]; - - Assert.IsTrue(expected.Equals((object)target)); - } - - [TestMethod()] - public void UnitType_EqualityTest14() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = unitPro.UnitTypes["Mass"]; - - Assert.IsFalse(expected.Equals((object)target)); - } - - [TestMethod()] - public void UnitType_EqualityTest154() - { - UnitType expected = unitPro.UnitTypes["Length"]; - UnitType target = null; - - Assert.IsFalse(expected.Equals((object)target)); - } - - [TestMethod()] - public void UnitType_EqualityTest15() - { - UnitType expected = unitPro.UnitTypes["Length"]; - - Assert.IsTrue(expected.GetHashCode() == expected.Name.GetHashCode()); - } - #endregion - - #region "Serialization" - //[TestMethod()] - //public void UnitType_BinarySerializationTest() - //{ - // UnitType expected = unitPro.UnitTypes["Length"]; - // UnitType actual = default(UnitType); - - // byte[] data = Utility.BinarySerialize(expected); - // actual = (UnitType)Utility.BinaryDeserialize(data); - - // Assert.IsNotNull(actual); - // Assert.AreEqual(expected.ID, actual.ID); - // Assert.AreEqual(expected.Name, actual.Name); - // Assert.AreEqual(expected.Description, actual.Description); - // Assert.AreEqual(expected.Units.Count, actual.Units.Count); - //} - - //[TestMethod()] - //public void UnitType_DataContractSerializationTest() - //{ - // UnitType expected = unitPro.UnitTypes["Length"]; - // UnitType actual = default(UnitType); - - // string data = Utility.DataContractSerialize(expected); - // actual = (UnitType)Utility.DataContractDeserialize(data, typeof(UnitType)); - - // Assert.IsNotNull(actual); - // Assert.AreEqual(expected.ID, actual.ID); - // Assert.AreEqual(expected.Name, actual.Name); - // Assert.AreEqual(expected.Description, actual.Description); - // Assert.AreEqual(expected.Units.Count, actual.Units.Count); - //} - #endregion -} - diff --git a/Units.sln b/Units.sln deleted file mode 100644 index 2575708..0000000 --- a/Units.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cubico", "Units\Cubico.csproj", "{5C21F8E4-02C4-4614-97C7-1899F4E6E634}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cubico.Test", "Units.Test\Cubico.Test.csproj", "{720BF499-D91E-4A86-82C0-D072C8EE00E1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5C21F8E4-02C4-4614-97C7-1899F4E6E634}.Release|Any CPU.Build.0 = Release|Any CPU - {720BF499-D91E-4A86-82C0-D072C8EE00E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {720BF499-D91E-4A86-82C0-D072C8EE00E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {720BF499-D91E-4A86-82C0-D072C8EE00E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {720BF499-D91E-4A86-82C0-D072C8EE00E1}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Units/ConversionResult.cs b/Units/ConversionResult.cs deleted file mode 100644 index 25c0502..0000000 --- a/Units/ConversionResult.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Runtime.Serialization; -using System.Diagnostics.Contracts; - -namespace Units -{ - - [Serializable()] - [DataContract()] - public class ConversionResult : IEquatable - { - - #region "Constructors" - public ConversionResult() - { - _result = Units.Result.NoError; - _value = 0; - } - - public ConversionResult(double value) - { - _result = Units.Result.NoError; - _value = value; - } - - public ConversionResult(double value, string symbol) - { - _result = Units.Result.NoError; - _value = value; - _symbol = symbol; - } - - public ConversionResult(double value, Result result) - { - _result = result; - _value = value; - } - - public ConversionResult(Result result) - { - _result = result; - } - #endregion - - #region "Properties" - - private Result _result; - [DataMember()] - public Result Result - { - get { return _result; } - set { _result = value; } - } - - - private double _value; - [DataMember()] - public double Value - { - get { return _value; } - set { _value = value; } - } - - private string _symbol; - [DataMember()] - public string Symbol - { - get { return _symbol; } - set { _symbol = value; } - } - #endregion - - #region "IEquatable" - public override int GetHashCode() - { - return (this.Value.ToString() + this.Symbol.ToString() + this.Result.ToString()).GetHashCode(); - } - - public override bool Equals(object obj) - { - if (obj == null) - { - return false; - } - else if (!object.ReferenceEquals(obj.GetType(), typeof(ConversionResult))) - { - return false; - } - - ConversionResult CrObj = (ConversionResult)obj; - - return this.Equals(CrObj); - } - - public bool Equals(ConversionResult other) - { - if (other == null) - { - return false; - } - - if (other.Value != this.Value) - { - return false; - } - else if (other.Symbol != this.Symbol) - { - return false; - } - else if (other.Result != this.Result) - { - return false; - } - else - { - return true; - } - } - - - public static bool operator !=(ConversionResult left, ConversionResult right) - { - return !left.Equals(right); - } - - public static bool operator ==(ConversionResult left, ConversionResult right) - { - return left.Equals(right); - } - - #endregion - } -} - diff --git a/Units/Measurement.cs b/Units/Measurement.cs deleted file mode 100644 index 4bab9c5..0000000 --- a/Units/Measurement.cs +++ /dev/null @@ -1,746 +0,0 @@ -using System; -using System.Runtime.Serialization; -using System.Diagnostics.Contracts; -using System.Linq; - -namespace Units -{ - /// - /// A structure that defines a measurement with a numeric value and a unit of measure. - /// - [Serializable()] - [DataContract()] - [KnownType(typeof(Unit))] - [KnownType(typeof(UnitType))] - [KnownType(typeof(Symbol))] - [KnownType(typeof(Modifier))] - [KnownType(typeof(ConversionResult))] - public struct Measurement : IEquatable, IComparable - { - - #region "Private Fields" - private MeasurementFlags _flags; - - private UnitConverter _uc; - private double _maxbound; - - private double _minbound; - private double _standardValue; - //private Unit _standardUnit; - private double _value; - private Unit _unit; - - private string _symbol; - - private Result _conversionResult; - public event EventHandler OnValueChanged; - public event EventHandler OnUnitChanged; - #endregion - - #region "Constructors" - internal Measurement(string unitSymbol) - { - //Reference the unit converter that created us. - _uc = new UnitConverter(); - - _flags = MeasurementFlags.None; - _maxbound = 0; - _minbound = 0; - _standardValue = 0; - //_standardUnit = null; - _symbol = null; - OnValueChanged = null; - OnUnitChanged = null; - - if (string.IsNullOrWhiteSpace(unitSymbol)) - { - //System.Diagnostics.Debug.Print("First IF Statement") - _unit = null; - _conversionResult = Result.BadUnit; - } - else - { - //System.Diagnostics.Debug.Print("First ELSE Statement") - _unit = _uc.GetUnitBySymbol(unitSymbol); - _conversionResult = Result.NoError; - - if (_unit.Symbols.Contains(new Symbol { Value = unitSymbol })) - { - _symbol = unitSymbol; - } - else - { - _symbol = _unit.DefaultSymbol; - } - } - - _value = 0; - } - - public Measurement(double value, string unitSymbol) - : this(unitSymbol) - { - - if (!string.IsNullOrWhiteSpace(unitSymbol)) - { - _unit = _uc.GetUnitBySymbol(unitSymbol); - } - - _value = value; - } - - internal Measurement(double value, string unitSymbol, Result conversionResult) - : this(unitSymbol) - { - - _value = value; - - _conversionResult = conversionResult; - } - - internal Measurement(double value, Result conversionResult) - : this(null) - { - - _value = value; - - _conversionResult = conversionResult; - } - - internal Measurement(double value, Unit unit, Result conversionResult = Result.NoError) - { - //Reference the unit converter that created us. - _uc = new UnitConverter(); - _flags = MeasurementFlags.None; - _unit = unit; - _conversionResult = Result.NoError; - _value = value; - _conversionResult = conversionResult; - - _maxbound = 0; - _minbound = 0; - _standardValue = 0; - //_standardUnit = null; - _symbol = null; - OnValueChanged = null; - OnUnitChanged = null; - } - #endregion - - #region "measurement flags and properties methods" - - - /// - /// Gets a reference to the current unit of the measurement. - /// - public Unit Unit - { - get { return _unit; } - } - - /// - /// Gets or sets the flags on this measurement. - /// - public MeasurementFlags Flags - { - get { return _flags; } - set { _flags = value; } - } - - /// - /// Gets the unit converter associated with this measurement. - /// - public UnitConverter Converter - { - get { return _uc; } - } - - /// - /// Displays the result of a conversion - /// - /// - /// - /// This property will default to NoError unless after a conversion there were problems. - public Result ConversionResult - { - get { return _conversionResult; } - set { _conversionResult = value; } - } - - public double Value - { - get { return _value; } - } - - public string Symbol - { - get - { - if (_unit == null) - { - return null; - } - else - { - return _symbol; - } - } - } - - /// - /// Gets the current value of the measurement in string form. - /// - /// Unit result value. - public string FullValue - { - get - { - string str = _value.ToString(); - - if (_unit != null) - { - if (!string.IsNullOrEmpty(_unit.DefaultSymbol)) - { - str += _unit.DefaultSymbol; - } - else - { - str += _unit.Name; - } - } - - return str; - } - } - - public bool IsValid - { - get - { - if (_conversionResult != Result.NoError && _conversionResult != Result.UnitExists) - { - return false; - } - else if (_uc == null) - { - return false; - } - else if (_unit == null) - { - return false; - } - else - { - return true; - } - } - } - #endregion - - #region "Value getting and setting methods" - /// - /// Sets the unit of the measurement. - /// - /// Symbol of unit to set the measurement to. - /// Unit result value. - internal Result SetUnit(string unitSymbol) - { - Unit unit = _uc.GetUnitBySymbol(unitSymbol); - - if (unit == null) - { - return Result.BadUnit; - } - else - { - //If its the same don't touch it. - if (unit.DefaultSymbol == _unit.DefaultSymbol) - { - return Result.NoError; - } - - _unit = unit; - - //If OnUnitChanged <> Nothing Then - if (OnUnitChanged != null) - { - OnUnitChanged(this, EventArgs.Empty); - } - //End If - - return Result.NoError; - } - } - - /// - /// Given a string in the format "[value] [unit]" parses and applies the value and unit. - /// - /// Formatted string containing value and unit. - /// Unit result code. - internal Result SetValue(string measurement) - { - if (string.IsNullOrEmpty(measurement)) - { - throw new ArgumentNullException("measurement"); - } - Contract.EndContractBlock(); - - double d = 0; - string symbol = null; - Result res = default(Result); - - res = ValidateEntry(measurement); - if (res != Result.NoError) - { - return res; - } - - Measurement newRes = _uc.ParseUnitString(measurement); - - d = newRes.Value; - symbol = newRes.Symbol; - - //Can we change the unit? - if ((_flags & MeasurementFlags.ForceUnit) > 0) - { - //Cant change the unit, so turn the given units into the unit we want - Measurement convRes = _uc.ConvertUnits(d, symbol, _unit.Name); - d = convRes.Value; - } - else - { - //Change the measurement unit to the given unit. - SetUnit(symbol); - } - - SetValue(d); - return res; - } - - /// - /// Sets a value in the currently set unit format. - /// - /// Value to set the measurement to. - /// Unit result code. - internal Result SetValue(double value) - { - Measurement res = default(Measurement); - Unit standardUnit = default(Unit); - UnitType tp = _unit.UnitType; - standardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault(); - res = _uc.ConvertUnits(value, _unit.Name, standardUnit.Name); - - _value = value; - _standardValue = res.Value; - - if (res.ConversionResult != Result.NoError) { - return res.ConversionResult; - } - - if (OnValueChanged != null) { - OnValueChanged(this, EventArgs.Empty); - } - - return res.ConversionResult; - } - - /// - /// Gets the value of the measurement in the specified units. - /// - /// Symbol of the unit to retrieve the data in. - /// Unit result value. - public Measurement GetValueAs(string unitSymbol) - { - return _uc.ConvertUnits(_value, _unit.Name, unitSymbol); - } - - public string GetStringValueAs(string unitSymbol) - { - Measurement res = default(Measurement); - res = _uc.ConvertUnits(_value, _unit.Name, unitSymbol); - - if (res.ConversionResult != Result.NoError) - { - return "Conversion Error"; - } - else - { - return res.FullValue; - } - } - #endregion - - #region "Validation methods" - /// - /// Validates input to the measurement. - /// - /// String to validate (in the form "[value] [unit]"). - /// Unit result value. - public Result ValidateEntry(string entry) - { - string unit = null; - double d = 0; - Measurement res = default(Measurement); - - //Parse the entry - res = _uc.ParseUnitString(entry); - if (res.ConversionResult != Result.NoError) - { - return res.ConversionResult; - } - - unit = res.Symbol; - d = res.Value; - - return ValidateEntryUnitData(unit, d); - } - - public Result ValidateEntry(double value, string symbol) - { - return ValidateEntryUnitData(symbol, value); - } - - private Result ValidateEntryUnitData(string unit, double x) - { - - //Make sure the units are compatible - if (!_uc.IsCompatible(unit, this._unit.DefaultSymbol)) - { - return Result.UnitMismatch; - } - - Measurement newRes = _uc.ConvertUnits(x, unit, this.Unit.Name); - x = newRes.Value; - - if ((this._flags & MeasurementFlags.UseMaxBound) > 0) - { - if (x > this._maxbound) - { - return Result.ValueTooHigh; - } - } - - if ((this._flags & MeasurementFlags.UseMinBound) > 0) - { - if (x < this._minbound) - { - return Result.ValueTooLow; - } - } - - return Result.NoError; - } - - #endregion - - #region "Bounds setting methods" - /// - /// Sets the maximum bound of the measurement. - /// - /// Value of the maximum bound. - /// The units the maximum bound is given in. - /// Unit result value. - public Result SetMaxBound(double maxbound, string unitSymbol) - { - if (string.IsNullOrEmpty(unitSymbol)) - { - throw new ArgumentNullException("unitSymbol"); - } - - if (!_uc.IsCompatible(unitSymbol, this._unit.DefaultSymbol)) - { - return Result.UnitMismatch; - } - - Measurement res = _uc.ConvertUnits(maxbound, unitSymbol, _unit.Name); - - this._maxbound = res.Value; - - return Result.NoError; - } - - /// - /// Sets the minimum bound of the measurement. - /// - /// Value of the minimum bound. - /// The units the minimum bound is given in. - /// Unit result value. - public Result SetMinBound(double minbound, string unitSymbol) - { - if (string.IsNullOrEmpty(unitSymbol)) - { - throw new ArgumentNullException("unitSymbol"); - } - - if (!_uc.IsCompatible(unitSymbol, this._unit.DefaultSymbol)) - { - return Result.UnitMismatch; - } - - Measurement res = _uc.ConvertUnits(minbound, unitSymbol, _unit.Name); - - this._minbound = res.Value; - - return Result.NoError; - } - #endregion - - #region "Operator overloads" - /// - /// Gets a string representation of the measurement. - /// - /// The string representation of the measurement. - public override string ToString() - { - return this.FullValue; - } - - /// - /// Adds two measurements together. - /// - public static Measurement operator +(Measurement d1, Measurement d2) - { - double x = 0; - double y = 0; - - x = d1.Value; - - if (d2.Unit.ID == d1.Unit.ID) - { - y = d2.Value; - } - else - { - y = d2.Value; - Measurement res2 = d2.Converter.ConvertUnits(y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); - y = res2.Value; - } - - var result = new Measurement(x + y, d1.Unit); - return result; - } - - /// - /// Subtracts two measurements. - /// - public static Measurement operator -(Measurement d1, Measurement d2) - { - double x = 0; - double y = 0; - - x = d1.Value; - - if (d2.Unit.ID == d1.Unit.ID) - { - y = d2.Value; - } - else - { - y = d2.Value; - Measurement res2 = d2.Converter.ConvertUnits(y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); - y = res2.Value; - } - - var result = new Measurement(x - y, d1.Unit); - return result; - } - - /// - /// Multiplies two measurements. - /// - public static Measurement operator *(Measurement d1, Measurement d2) - { - double x = 0; - double y = 0; - - x = d1.Value; - - if (d2.Unit.ID == d1.Unit.ID) - { - y = d2.Value; - } - else - { - y = d2.Value; - Measurement res2 = d2.Converter.ConvertUnits(y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); - y = res2.Value; - } - - var result = new Measurement(x * y, d1.Unit); - return result; - } - - /// - /// Divides two measurements. - /// - public static Measurement operator /(Measurement d1, Measurement d2) - { - double x = 0; - double y = 0; - - x = d1.Value; - - if (d2.Unit.ID == d1.Unit.ID) - { - y = d2.Value; - } - else - { - y = d2.Value; - Measurement res2 = d2.Converter.ConvertUnits(y, d2.Unit.DefaultSymbol, d1.Unit.DefaultSymbol); - y = res2.Value; - } - - Measurement result = new Measurement(x / y, d1.Unit); - return result; - } - - public static bool operator !=(Measurement left, Measurement right) - { - return !left.Equals(right); - } - - public static bool operator ==(Measurement left, Measurement right) - { - return left.Equals(right); - } - - public static bool operator <(Measurement left, Measurement right) - { - return (left.CompareTo(right) < 0); - } - - public static bool operator >(Measurement left, Measurement right) - { - return (left.CompareTo(right) > 0); - } - - public static bool operator <=(Measurement left, Measurement right) - { - return (left.CompareTo(right) <= 0); - } - - public static bool operator >=(Measurement left, Measurement right) - { - return (left.CompareTo(right) >= 0); - } - #endregion - - #region "IEquatable(Of Measurement)" - public override int GetHashCode() - { - Measurement MeRes = default(Measurement); - string str = string.Empty; - if (this.ConversionResult != Result.NoError) { - str = this.Value.ToString() + "|" + this.ConversionResult.ToString(); - } else { - Unit standardUnit = default(Unit); - UnitType tp = this.Unit.UnitType; - standardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault(); - - MeRes = this.Converter.ConvertUnits(this._value, this.Unit.DefaultSymbol, standardUnit.DefaultSymbol); - str = MeRes.Value.ToString() + "|" + MeRes.Symbol; - } - - return str.GetHashCode(); - } - - public override bool Equals(object obj) - { - if (obj == null || !object.ReferenceEquals(obj.GetType(), typeof(Measurement))) - { - return false; - } - - Measurement Mobj = (Measurement)obj; - return this.Equals(Mobj); - } - - public bool Equals(Measurement other) - { - if (other.ConversionResult != Result.NoError) - { - return false; - } - - if (this.ConversionResult != Result.NoError) - { - return false; - } - - if (object.ReferenceEquals(this.Unit, null) && object.ReferenceEquals(other.Unit, null)) - { - return true; - } - - if (object.ReferenceEquals(this.Unit, null) ^ object.ReferenceEquals(other.Unit, null)) - { - return false; - } - - //Dim standardUnit As Unit - //Dim tp As UnitType = Me.Unit.UnitType - //standardUnit = (From un In tp.Units _ - // Where un.IsDefault = True).FirstOrDefault - - if (this.Unit.Name == other.Unit.Name && this.Value == other.Value) - { - return true; - } - else - { - Measurement OtherRes = other.Converter.ConvertUnits(other._value, other.Unit.Name, this.Unit.Name); - - if (OtherRes.ConversionResult != Result.NoError) - { - return false; - } - else if (this.Unit.Name != OtherRes.Unit.Name) - { - return false; - } - else if (this.Value != OtherRes.Value) - { - return false; - } - else - { - return true; - } - } - - } - #endregion - - #region "ICompareTo(Of Measurement)" - public int CompareTo(Measurement other) - { - if (other.ConversionResult != Result.NoError) { - throw new ArgumentException("other", "the 'other' parameter must have a valid value"); - } - - if (this.ConversionResult != Result.NoError) { - throw new ArgumentException("this", "object must have a valid value"); - } - - Unit standardUnit = default(Unit); - UnitType tp = this.Unit.UnitType; - standardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault(); - - Unit otherStandardUnit = default(Unit); - tp = this.Unit.UnitType; - otherStandardUnit = (from un in tp.Units where un.IsDefault == true select un).FirstOrDefault(); - - Measurement meRes = this.Converter.ConvertUnits(this._value, this.Unit.DefaultSymbol, standardUnit.DefaultSymbol); - Measurement otherRes = other.Converter.ConvertUnits(other._value, other.Unit.DefaultSymbol, otherStandardUnit.DefaultSymbol); - - if (meRes.Symbol != otherRes.Symbol) { - throw new ArgumentException("The parameter must be of the same unit type as this object. " + this.Unit.DefaultSymbol, "other"); - } - - return meRes.Value.CompareTo(otherRes.Value); - } - #endregion - } -} - diff --git a/Units/MeasurementFlags.cs b/Units/MeasurementFlags.cs deleted file mode 100644 index 326ad55..0000000 --- a/Units/MeasurementFlags.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace Units -{ - - [Flags()] - public enum MeasurementFlags : int - { - None = 0, - - /// - /// Stops the data string unit being changed by reading user input. - /// - ForceUnit = 1, - - /// - /// Enforces a maximum value on the data string. - /// - UseMaxBound = 2, - - /// - /// Enforces a minimum value on the data string. - /// - UseMinBound = 4 - } -} \ No newline at end of file diff --git a/Units/Modifier.cs b/Units/Modifier.cs deleted file mode 100644 index 4bcd2df..0000000 --- a/Units/Modifier.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Runtime.Serialization; - -namespace Units -{ - [DataContract(IsReference = true)] - [Serializable()] - public partial class Modifier - { - #region "Contructors" - public Modifier() : base() - { - - } - #endregion - - #region "Primitive Properties" - - [DataMember()] - public int ID {get;set;} - - [DataMember()] - public decimal Value {get;set;} - - [DataMember()] - public int Order {get;set;} - - [DataMember()] - public int UnitSourceID {get;set;} - - [DataMember()] - public int UnitTargetID {get;set;} - - [DataMember()] - public Nullable Precision {get;set;} - - #endregion - - #region "ChangeTracking" - - private bool _isDeserializing; - protected bool IsDeserializing { - get { return _isDeserializing; } - private set { _isDeserializing = value; } - } - - [OnDeserializing()] - public void OnDeserializingMethod(StreamingContext context) - { - IsDeserializing = true; - } - - [OnDeserialized()] - public void OnDeserializedMethod(StreamingContext context) - { - IsDeserializing = false; - } - - private bool _isSerializing = false; - protected bool IsSerializing { - get { return _isSerializing; } - private set { _isSerializing = value; } - } - - [OnSerializing()] - public void OnSerializingMethod(StreamingContext context) - { - IsSerializing = true; - } - - [OnSerialized()] - public void OnSerializedMethod(StreamingContext context) - { - IsSerializing = false; - } - - protected virtual void ClearNavigationProperties() - { - } - - #endregion - - #region "Properties" - [DataMember()] - public Unit ParentUnit {get;set;} - - public ModifierType ModifierType {get;set;} - #endregion - } - -} - - - - - - - - diff --git a/Units/ModifierType.cs b/Units/ModifierType.cs deleted file mode 100644 index 6d4a5a5..0000000 --- a/Units/ModifierType.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Units -{ - public enum ModifierType - { - None = 0, - PreAdd = 1, - Add = 2, - Multiply = 3, - Subtract = 4, - Divide = 5 - } -} \ No newline at end of file diff --git a/Units/Result.cs b/Units/Result.cs deleted file mode 100644 index f2d2c16..0000000 --- a/Units/Result.cs +++ /dev/null @@ -1,56 +0,0 @@ -namespace Units -{ - public enum Result : int - { - /// - /// No error occured. - /// - NoError = 0, - - /// - /// A general error occured. - /// - GenericError, - - /// - /// Specified unit was not found. - /// - UnitNotFound, - - /// - /// Specified unit group was not found. - /// - GroupNotFound, - - /// - /// Unit exists. - /// - UnitExists, - - /// - /// Specified unit was invalid. - /// - BadUnit, - - /// - /// Specified value was invalid. - /// - BadValue, - - /// - /// Two units were used that are not in the same group. - /// - UnitMismatch, - - /// - /// An input value was too high. - /// - ValueTooHigh, - - /// - /// An input value was too low. - /// - ValueTooLow - } -} - diff --git a/Units/Symbol.cs b/Units/Symbol.cs deleted file mode 100644 index ffa2321..0000000 --- a/Units/Symbol.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Runtime.Serialization; - - -namespace Units -{ - /// - /// Represents a unit of measure's symbol, or alternate methods to identify a unit of measure. - /// - /// Inch = ", inches, in, in. etc. - [DataContract(IsReference = true)] - [KnownType(typeof(Unit))] - [Serializable()] - public partial class Symbol - { - #region "Constructors" - public Symbol() - { - } - - public Symbol(Unit unit) - { - if (unit == null) - { - throw new ArgumentNullException("unit"); - } - //Contract.EndContractBlock() - - this.Unit = unit; - } - #endregion - - #region "Primitive Properties" - - [DataMember()] - public int Id {get;set;} - - [DataMember()] - public string Value {get;set;} - - [DataMember()] - public bool IsDefault {get;set;} - - [DataMember()] - public int UnitId {get;set;} - #endregion - - #region "Navigation Properties" - - [DataMember()] - public Unit Unit { - get { return _unit; } - set { - if (!object.ReferenceEquals(_unit, value)) { - Unit previousValue = _unit; - _unit = value; - FixupUnit(previousValue); - } - } - } - - private Unit _unit; - - - #endregion - - #region "ChangeTracking" - - private bool _isDeserializing; - protected bool IsDeserializing { - get { return _isDeserializing; } - private set { _isDeserializing = value; } - } - - - [OnDeserializing()] - public void OnDeserializingMethod(StreamingContext context) - { - IsDeserializing = true; - } - - - [OnDeserialized()] - public void OnDeserializedMethod(StreamingContext context) - { - IsDeserializing = false; - } - - private bool _isSerializing = false; - protected bool IsSerializing { - get { return _isSerializing; } - private set { _isSerializing = value; } - } - - [OnSerializing()] - public void OnSerializingMethod(StreamingContext context) - { - IsSerializing = true; - } - - [OnSerialized()] - public void OnSerializedMethod(StreamingContext context) - { - IsSerializing = false; - } - #endregion - - #region "Association Fixup" - - private void FixupUnit(Unit previousValue) - { - if (IsDeserializing) { - return; - } - - if (previousValue != null && previousValue.Symbols.Contains(this)) { - previousValue.Symbols.Remove(this); - } - - if (Unit != null) { - if (!Unit.Symbols.Contains(this)) { - Unit.Symbols.Add(this); - } - - UnitId = Unit.ID; - } - - } - - #endregion - - #region "IEquatable" - public override int GetHashCode() - { - return this.Value.GetHashCode(); - } - - public override bool Equals(object obj) - { - if ((object)obj == null) - { - return false; - } - else if (!object.ReferenceEquals(obj.GetType(), this.GetType())) - { - return false; - } - else - { - return this.Equals((Symbol)obj); - } - } - - public bool Equals(Symbol other) - { - if ((object)other == null) - { - return false; - } - else - { - if (this.Value != other.Value) - { - return false; - } - else - { - return true; - } - } - } - - - public static bool operator !=(Symbol left, Symbol right) - { - return !(left == right); - } - - public static bool operator ==(Symbol left, Symbol right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - else if ((object)left == null || (object)right == null) - { - return false; - } - else - { - return left.Equals(right); - } - } - - #endregion - - public override string ToString() - { - return this.Value; - } - } - -} - diff --git a/Units/Unit.cs b/Units/Unit.cs deleted file mode 100644 index 90faf4e..0000000 --- a/Units/Unit.cs +++ /dev/null @@ -1,288 +0,0 @@ -using System; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Runtime.Serialization; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; - -namespace Units -{ - [DataContract(IsReference = true)] - [KnownType(typeof(UnitType))] - [KnownType(typeof(Symbol))] - [KnownType(typeof(Modifier))] - [Serializable()] - public partial class Unit : IEquatable - { - #region "Constructors" - public Unit() : base() - { - } - - internal Unit(UnitType unitType) - { - if (unitType == null) { - throw new ArgumentNullException("unitType"); - } - - this.UnitType = unitType; - } - - public bool IsDefault { - get { - foreach (Modifier mod in this.Modifiers) { - if (mod.UnitSourceID == mod.UnitTargetID && mod.UnitSourceID == this.ID) { - return true; - } - } - - return false; - - //If Me.Modifiers.Count > 1 Then - // Return False - //Else - // If Me.Modifiers(0).Value = 1 AndAlso Me.Modifiers(0).ModifierType = ModifierType.Multiply 'Then - // Return True - // Else - // Return False - // End If - //End If - } - } - #endregion - - #region "Primitive Properties" - - [DataMember()] - public int ID { get; set; } - - [DataMember()] - public string Name { get; set; } - - [DataMember()] - public int UnitTypeID { get; set; } - - #endregion - - #region "Navigation Properties" - - [DataMember()] - public UnitType UnitType { get; set; } - - private List _symbols; - - [DataMember()] - public List Symbols - { - get - { - if (_symbols == null && IsSerializing == false) - { - _symbols = new List(); - } - return _symbols; - } - set - { - if (!object.ReferenceEquals(_symbols, value)) - { - _symbols = value; - } - } - } - - private List _sources; - - [DataMember()] - public List Sources - { - get - { - if (_sources == null && IsSerializing == false) - { - _sources = new List(); - } - return _sources; - } - set - { - if (!object.ReferenceEquals(_sources, value)) - { - _sources = value; - } - } - } - - private List _modifiers; - - [DataMember()] - public List Modifiers - { - get - { - if (_modifiers == null && IsSerializing == false) - { - _modifiers = new List(); - } - return _modifiers; - } - set - { - if (!object.ReferenceEquals(_modifiers, value)) - { - _modifiers = value; - } - } - } - - #endregion - - #region "ChangeTracking" - - private bool _isDeserializing; - protected bool IsDeserializing - { - get { return _isDeserializing; } - private set { _isDeserializing = value; } - } - - [OnDeserializing()] - public void OnDeserializingMethod(StreamingContext context) - { - IsDeserializing = true; - } - - [OnDeserialized()] - public void OnDeserializedMethod(StreamingContext context) - { - IsDeserializing = false; - } - - private bool _isSerializing = false; - protected bool IsSerializing - { - get { return _isSerializing; } - private set { _isSerializing = value; } - } - - [OnSerializing()] - public void OnSerializingMethod(StreamingContext context) - { - IsSerializing = true; - } - - [OnSerialized()] - public void OnSerializedMethod(StreamingContext context) - { - IsSerializing = false; - } - - protected virtual void ClearNavigationProperties() - { - UnitType = null; - Symbols.Clear(); - Sources.Clear(); - Modifiers.Clear(); - } - - #endregion - - #region "Properties" - public string DefaultSymbol { - get { - Symbol symbol = (from s in this.Symbols - where s.IsDefault = true - select s).FirstOrDefault(); - - if (symbol == null) { - return string.Empty; - } else { - return symbol.Value; - } - } - } - #endregion - - #region "IEquatable" - public override int GetHashCode() - { - return this.Name.GetHashCode(); - } - - public override bool Equals(object obj) - { - if ((object)obj == null) - { - return false; - } - else if (!object.ReferenceEquals(obj.GetType(), this.GetType())) - { - return false; - } - else - { - return this.Equals((Unit)obj); - } - } - - public bool Equals(Unit other) - { - if (object.ReferenceEquals(other, null)) - { - return false; - } - else - { - if (this.Name != other.Name) - { - return false; - } - else - { - return true; - } - } - } - - - public static bool operator !=(Unit left, Unit right) - { - return !(left == right); - } - - public static bool operator ==(Unit left, Unit right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - else if ((object)left == null || (object)right == null) - { - return false; - } - else - { - return left.Equals(right); - } - } - - #endregion - - public override string ToString() - { - return this.Name; - } - } - -} - - - - - - - - - - \ No newline at end of file diff --git a/Units/UnitConverter.cs b/Units/UnitConverter.cs deleted file mode 100644 index 30da74b..0000000 --- a/Units/UnitConverter.cs +++ /dev/null @@ -1,419 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Collections.Generic; -using System.Linq; - -namespace Units -{ - - public class UnitConverter - { - - //TODO: Fix this; was Previously NaN - private const double _failsafeValue = 0; - - private Dictionary _SymbolDictionary; - private Dictionary _IndividualSymbolDictionary; - private Dictionary _UnitDictionary; - - private Dictionary _UnitTypeDictionary; - - /// - /// Constructor, sets up the unit converter. - /// - public UnitConverter() - { - //Set up the tables we need - var unitPro = new UnitProvider(); - _SymbolDictionary = unitPro.Symbols; - _IndividualSymbolDictionary = unitPro.IndividualSymbols; - _UnitDictionary = unitPro.Units; - _UnitTypeDictionary = unitPro.UnitTypes; - - } - - #region "Unit related methods" - /// - /// Given the full name of the unit, returns the unit entry. - /// - /// Name of the unit. - /// Reference to the unit entry, or null if not found. - public Unit GetUnitByName(string unitName) - { - if (string.IsNullOrEmpty(unitName)) - { - throw new ArgumentException("unitName must have a value."); - } - - if (this._UnitDictionary.ContainsKey(unitName)) - { - return this._UnitDictionary[unitName]; - } - else - { - throw new ArgumentException("The unit '" + unitName + "' was not found in the UnitConverter. Add this unit to the database for compatability."); - } - } - - /// - /// Given a unit symbol, gets the unit entry. - /// - /// Symbol of the unit. - /// Reference to the unit entry, or null if symbol does not exist. - public Unit GetUnitBySymbol(string unitSymbol) - { - if (string.IsNullOrWhiteSpace(unitSymbol)) { - throw new ArgumentNullException("unitSymbol must have a value"); - } - - //First check to see if they used the actual name of a unit then look at the symbol table. - Unit unitFound = (from val in this._UnitDictionary.Values where val.Name.ToUpper() == unitSymbol.Trim().ToUpper() select val).FirstOrDefault(); - - if (unitFound != null) { - return unitFound; - } - - Symbol symFound = (from val in this._IndividualSymbolDictionary.Values where val.Value == unitSymbol.Trim() select val).FirstOrDefault(); - - if (symFound != null) { - return symFound.Unit; - } - - throw new ArgumentException("The unit/symbol '" + unitSymbol + "' was not found in the UnitConverter. Add this unit to the database for compatability."); - - } - #endregion - - #region "Group related methods" - /// - /// Gets a value that determines whether the given units are compatible or not. - /// - /// Symbol for the first unit. - /// Symbol for the second unit. - /// True if units are compatible, else false. - public bool IsCompatible(string leftSymbol, string rightSymbol) - { - if (string.IsNullOrEmpty(leftSymbol) || string.IsNullOrEmpty(rightSymbol)) - { - throw new ArgumentException("The left and right symbol values cannot be empty or null."); - } - Contract.EndContractBlock(); - - Unit leftUnit = this.GetUnitBySymbol(leftSymbol); - Unit rightUnit = this.GetUnitBySymbol(rightSymbol); - - if ((leftUnit == null) || (rightUnit == null)) - { - return false; - } - - return (this.GetUnitType(leftUnit.Name) == this.GetUnitType(rightUnit.Name)); - } - - /// - /// Creates a new unit group and adds it to the group table. - /// - /// Name of the new group. - /// Unit result value. - private Result CreateNewGroup(string groupName) - { - //Create the new group - var newType = new UnitType {Name = groupName}; - - //Add it to the group table - this._UnitTypeDictionary.Add(groupName, newType); - - return Result.NoError; - } - - /// - /// Adds the named unit to the specified group. - /// - /// Name of the unit. - /// Name of the group to add the unit to. - /// Unit result value. - private Result AddUnitToGroup(string unitName, string unitTypeName) - { - Unit unit = this._UnitDictionary[unitName]; - UnitType group = this._UnitTypeDictionary[unitTypeName]; - - //Make sure the unit exists. - if (unit == null) - { - return Result.UnitNotFound; - } - - //Make sure the group exists. - if (group == null) - { - return Result.GroupNotFound; - } - - //Add the unit. - group.Units.Add(unit); - - return Result.NoError; - } - - /// - /// Given the name of a unit, searches for the unit group it belongs to. - /// - /// Name of the unit. - /// The group the unit is in, or null if the unit is not valid. - private UnitType GetUnitType(string unitName) - { - if (string.IsNullOrEmpty(unitName)) { - throw new ArgumentException("unitName must have a value"); - } - Contract.EndContractBlock(); - - //Does the unit even exist? - if (this._UnitDictionary.ContainsKey(unitName) == false) { - return null; - } else { - //Iterate through every group - var unitPro = new UnitProvider(); - foreach (var ut in unitPro.UnitTypes) { - if (ut.Value.Units.Contains(new Unit { Name = unitName })) { - return ut.Value; - } - } - return null; - } - } - #endregion - - #region "Conversion methods" - - /// - /// Performs a unit conversion between two units, given a value to convert. - /// - /// The value to convert. - /// The name of the unit the value is currently in. - /// The name of the unit that the value is to be converted to. - /// Unit result value. - public Measurement ConvertUnits(double value, string currentUnitName, string targetUnitName) - { - double x = value; - - //Default to the fail safe value. - double output = 0; - output = _failsafeValue; - - if (string.IsNullOrEmpty(currentUnitName) || string.IsNullOrEmpty(targetUnitName)) - { - return new Measurement(0, Result.BadUnit); - } - - Unit currentUnit = GetUnitBySymbol(currentUnitName); - Unit targetUnit = GetUnitBySymbol(targetUnitName); - - //Make sure both units are real units. - if ((currentUnit == null) || (targetUnit == null)) - { - return new Measurement(output, Result.BadUnit); - } - - //Make sure the units are of the same group - if (!this.IsCompatible(currentUnit.Name, targetUnit.Name)) - { - return new Measurement(output, Result.UnitMismatch); - } - - return ConvertCurrentToTarget(x, currentUnit.Name, targetUnit.Name); - } - - /// - /// Performs a unit conversion from the standard value into the specified unit. - /// - /// The value to convert. - /// - /// The name of the unit that the value is to be converted to. - /// Unit result value. - public Measurement ConvertCurrentToTarget(double value, string currentUnitName, string targetUnitName) - { - double x = value; - - //Default to the fail safe value. - double output = 0; - output = _failsafeValue; - - if (string.IsNullOrEmpty(targetUnitName)) { - return new Measurement(0, Result.BadUnit); - } - - Unit currentUnit = GetUnitBySymbol(currentUnitName); - Unit targetUnit = GetUnitBySymbol(targetUnitName); - - //Make sure both units are real units. - if (targetUnit == null) { - return new Measurement(output, Result.BadUnit); - } - - try { - var moders = from m in targetUnit.Modifiers - where m.UnitSourceID == currentUnit.ID && m.UnitTargetID == targetUnit.ID - orderby m.Order - select m; - - foreach (var moder in moders) - { - int m_intPrecision = 15; - - if (moder.Precision != null) { - m_intPrecision = Convert.ToInt32(moder.Precision); - } - - switch (moder.ModifierType) { - case ModifierType.PreAdd: - x = x - (double)moder.Value; - break; - case ModifierType.Multiply: - if (moder.Value > 0) { - x = System.Math.Round(x * (double)moder.Value, m_intPrecision); - } - break; - case ModifierType.Divide: - if (moder.Value > 0) { - x = System.Math.Round(x / (double)moder.Value, m_intPrecision); - } - break; - case ModifierType.Add: - x = System.Math.Round(x + (double)moder.Value, m_intPrecision); - break; - case ModifierType.Subtract: - x = System.Math.Round(x - (double)moder.Value, m_intPrecision); - break; - } - } - - output = x; - } catch { - //Probably overflowed or something. - return new Measurement(output, Result.BadValue); - } - - return new Measurement(output, targetUnit); - } - - #endregion - - #region "Parsing routines" - - // TO DO: Implement ParseNumberString. - - // ''' - // ''' Parses a number string with operators. - // ''' - // ''' String containing numbers and operators. - // ''' Unit result code. - //Private Function ParseNumberString(ByVal input As String) As ConversionResult - // If String.IsNullOrEmpty(input) Then - // Throw New ArgumentException("input must have a value") - // End If - - // 'Default value - // Dim value As Double - // value = 0 - - // 'Split the numbers on the ^ operator - // Dim numbers As String() - // numbers = input.Split(New Char() {"^"c}) - - // If numbers.Length = 1 Then - // 'Only one value, so there was no ^ operator present - // 'so just return the one number. - // Try - // value = Convert.ToDouble(numbers(0)) - // Catch - // Return New ConversionResult(0, Result.BadValue) - // End Try - // Else - // 'There is a ^ operator, so try to use it. - // Try - // value = Convert.ToDouble(numbers(0)) - // value = CDbl(System.Math.Pow(value, Convert.ToDouble(numbers(1)))) - // Catch - // Return New ConversionResult(0, Result.BadValue) - // End Try - // End If - - // Return New ConversionResult(value) - //End Function - - - /// - /// Given a string in the format "[value] [unit]", splits and returns the parts. - /// - /// Input string in the format "[value] [unit]" to be parsed. - /// Unit result code. - public Measurement ParseUnitString(string input) - { - //Defaults - double value = 0; - string symbol = null; - value = 0; - symbol = ""; - - if (string.IsNullOrEmpty(input)) - { - return new Measurement(0, Result.BadValue); - } - - int i = 0; - - string s1 = ""; - string s2 = ""; - - //Look for the first letter or punctuation character. - i = 0; - while (i < input.Length) - { - if (Char.IsLetter(input, i) || char.IsPunctuation(input, i) || char.IsSymbol(input, i)) - { - if (input[i] != Convert.ToChar(".") && input[i] != Convert.ToChar("-")) - { - break; // TODO: might not be correct. Was : Exit While - } - } - System.Math.Max(System.Threading.Interlocked.Increment(ref i), i - 1); - } - - s1 = input.Substring(0, i); - s1 = s1.Trim(); - s2 = input.Substring(i); - s2 = s2.Trim(); - - //No value? default to 0 - if (string.IsNullOrEmpty(s1)) - { - s1 = "0"; - } - - try - { - value = Convert.ToDouble(s1); - } - catch - { - return new Measurement(0, Result.BadValue); - } - - try - { - this.GetUnitBySymbol(s2); - } - catch (Exception) - { - return new Measurement(0, Result.BadUnit); - } - - symbol = s2; - - return new Measurement(value, symbol); - } - #endregion - - } -} - diff --git a/Units/UnitProvider.cs b/Units/UnitProvider.cs deleted file mode 100644 index d2de7ee..0000000 --- a/Units/UnitProvider.cs +++ /dev/null @@ -1,466 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; - -namespace Units -{ - /// - /// Facilitates the loading and caching of the unit of measure data. - /// - public class UnitProvider - { - - #region "Constructors" - public UnitProvider() - { - if (_dataFile == null) - { - this.LoadDataFile(); - } - } - #endregion - - #region "Properties" - static private XmlDocument _dataFile; - protected XmlDocument DataFile - { - get{return _dataFile;} - set{ _dataFile = value;} - } - - //Singleton - private static Dictionary _unitTypes; - public Dictionary UnitTypes - { - get - { - if (_unitTypes == null) - { - GetAllUnitTypes(); - } - return _unitTypes; - } - } - - private Dictionary _units; - public Dictionary Units - { - get - { - if (_units == null) - { - _units = GetAllUnits(); - } - return _units; - } - } - - private static Dictionary> _individualModifiers; - private static Dictionary _symbols; - - private static Dictionary _individualSymbols; - private static Dictionary> _symbolLookUp; - public Dictionary Symbols - { - get - { - if (_symbols == null) - { - _symbols = GetAllSymbols(); - } - return _symbols; - } - } - #endregion - - #region "Methods" - #region "File Load Methods" - - private void LoadDataFile() - { - const string fileName = "Cubico.UnitData.xml"; - var assembly = Assembly.GetExecutingAssembly(); - var stream = assembly.GetManifestResourceStream(fileName); - - if (stream == null) - { - throw new FileNotFoundException("Cannot find unit data file", fileName); - } - - _dataFile = new XmlDocument(); - _dataFile.Load(stream); - - this.ProcessUnitConverterData(); - } - - private void ProcessUnitConverterData() - { - foreach (XmlNode node in this.DataFile.ChildNodes) - { - if (node.Name == "UnitConverterData") - { - ProcessDataTypes(node); - } - } - } - - private void ProcessDataTypes(XmlNode parentNode) - { - foreach (XmlNode node in parentNode.ChildNodes) - { - switch (node.Name) - { - case "UnitTypes": - ProcessUnitTypes(node); - break; - case "Units": - ProcessUnits(node); - break; - case "Symbols": - ProcessUnitSymbols(node); - break; - case "UnitModifiers": - ProcessUnitModifiers(node); - break; - } - } - } - - private void ProcessUnitModifiers(XmlNode parentNode) - { - _individualModifiers = new Dictionary>(); - - foreach (XmlNode node in parentNode.ChildNodes) - { - if (node.Name == "UnitModifier") - { - var mod = new Modifier(); - - foreach (XmlAttribute attrib in node.Attributes) - { - switch (attrib.Name) - { - case "ID": - mod.ID = Convert.ToInt32(attrib.Value); - break; - case "Value": - mod.Value = Convert.ToDecimal(attrib.Value); - break; - case "Order": - mod.Order = Convert.ToInt32(attrib.Value); - break; - case "ModifierID": - mod.ModifierType = (ModifierType)Convert.ToInt32(attrib.Value); - break; - case "UnitSourceID": - mod.UnitSourceID = Convert.ToInt32(attrib.Value); - break; - case "UnitTargetID": - mod.UnitTargetID = Convert.ToInt32(attrib.Value); - break; - case "Precision": - mod.Precision = Convert.ToInt32(attrib.Value); - break; - } - - } - - if (_individualModifiers.ContainsKey(mod.UnitTargetID)) - { - var data = _individualModifiers[mod.UnitTargetID]; - data.Add(mod); - } - else - { - var data = new List {mod}; - _individualModifiers.Add(mod.UnitTargetID, data); - } - - } - } - } - - private void ProcessUnitSymbols(XmlNode parentNode) - { - _symbolLookUp = new Dictionary>(); - foreach (XmlNode node in parentNode.ChildNodes) - { - if (node.Name == "UnitSymbol") - { - var sym = new Units.Symbol(); - - foreach (XmlAttribute attrib in node.Attributes) - { - switch (attrib.Name) - { - case "ID": - sym.Id = Convert.ToInt32(attrib.Value); - break; - case "Symbol": - sym.Value = attrib.Value; - break; - case "UnitID": - sym.UnitId = Convert.ToInt32(attrib.Value); - break; - case "IsDefault": - int value = Convert.ToInt32(attrib.Value); - if (value == 1) - sym.IsDefault = true; - else - sym.IsDefault = false; - - break; - } - - } - - if (_symbolLookUp.ContainsKey(sym.UnitId)) - { - var data = _symbolLookUp[sym.UnitId]; - data.Add(sym); - } - else - { - var data = new List {sym}; - _symbolLookUp.Add(sym.UnitId, data); - } - } - } - } - - private void ProcessUnits(XmlNode parentNode) - { - _units = new Dictionary(); - foreach (XmlNode node in parentNode.ChildNodes) - { - - if (node.Name == "Unit") - { - var unit = new Unit(); - - foreach (XmlAttribute attrib in node.Attributes) - { - switch (attrib.Name) - { - case "ID": - unit.ID = Convert.ToInt32(attrib.Value); - break; - case "Name": - unit.Name = attrib.Value; - break; - case "UnitTypeID": - unit.UnitTypeID = Convert.ToInt32(attrib.Value); - break; - } - - } - - if (_symbolLookUp.ContainsKey(unit.ID)) - { - unit.Symbols = _symbolLookUp[unit.ID]; - - foreach (Symbol sym in unit.Symbols) - { - sym.Unit = unit; - } - } - if (_individualModifiers.ContainsKey(unit.ID)) - { - unit.Modifiers = _individualModifiers[unit.ID]; - - foreach (Modifier mod in unit.Modifiers) - { - mod.ParentUnit = unit; - } - } - _units.Add(unit.Name, unit); - - } - } - } - - private void ProcessUnitTypes(XmlNode parentNode) - { - _unitTypes = new Dictionary(); - foreach (XmlNode node in parentNode.ChildNodes) - { - if(node.Name == "UnitType") - { - var ut = new UnitType(); - - foreach (XmlAttribute attrib in node.Attributes) - { - switch (attrib.Name) - { - case "ID": - ut.ID = Convert.ToInt32(attrib.Value); - break; - case "Name": - ut.Name = attrib.Value; - break; - case "Description": - ut.Description = attrib.Value; - break; - } - - } - - //Make this a for loop for speed reasons or use a multikey dictionary. - var unitData = (from unit in _units.Values - where unit.UnitTypeID == ut.ID - select unit).ToList(); - ut.Units = unitData; - - foreach (Unit unitItem in ut.Units) - { - unitItem.UnitType = ut; - } - - _unitTypes.Add(ut.Name, ut); - - } - } - } - #endregion - - #region "UnitTypes" - //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available - private void GetAllUnitTypes() - { - - - } - #endregion - - #region "Units" - //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available - private Dictionary GetAllUnits() - { - var unitDict = new Dictionary(); - var unitPro = new UnitProvider(); - var query = from s in unitPro.UnitTypes select s; - - - foreach (var itm in query) - { - UnitType ut = itm.Value; - - foreach (var un in ut.Units) - { - if (!unitDict.ContainsKey(un.Name)) - { - unitDict.Add(un.Name, un); - } - } - //Units "Celsius" - } - //UnitTypes "Temperature" - - return unitDict; - } - #endregion - - #region "Symbols" - - - public Dictionary IndividualSymbols - { - get - { - if (_individualSymbols == null) - { - _individualSymbols = GetAllIndividualSymbols(); - } - return _individualSymbols; - } - } - - //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available - private Dictionary GetAllSymbols() - { - var unitDict = new Dictionary(); - var query = from s in this.UnitTypes select s; - - foreach (var itm in query) - { - UnitType ut = itm.Value; - - foreach (var un in ut.Units) - { - Unit unit = un; - - if (unit.Symbols == null || unit.Symbols.Count == 0) - { - //No symbols. Add name of unit as symbol. - if (!unitDict.ContainsKey(unit.Name)) - { - unitDict.Add(unit.Name, unit); - } - } - else - { - foreach (var sy in unit.Symbols) - { - if (!unitDict.ContainsKey(sy.Value)) - { - unitDict.Add(sy.Value, unit); - } - } - //Symbols "C" - - if (!unitDict.ContainsKey(unit.Name)) - { - unitDict.Add(unit.Name, unit); - //Add name as symbol just in case - } - } - } - //Units "Celsius" - } - //UnitTypes "Temperature" - - return unitDict; - } - - //TODO: Change to ReadOnlyDictionary when .Net 4.0 is available - private Dictionary GetAllIndividualSymbols() - { - var unitDict = new Dictionary(); - var unitPro = new UnitProvider(); - - var query = from s in unitPro.UnitTypes select s; - - - foreach (var itm in query) - { - UnitType ut = itm.Value; - - - foreach (var un in ut.Units) - { - Unit unit = un; - - foreach (var us in unit.Symbols) - { - if (!unitDict.ContainsKey(us.Value)) - { - unitDict.Add(us.Value, us); - } - } - - } - - } - - return unitDict; - } - - #endregion - #endregion - } - -} \ No newline at end of file