public void BasicConversionTests()
        {
            var massOfEarth = new Kilogram(5.97219 * (Math.Pow(10, 24)));
            var grams = massOfEarth.Convert<Gram>();
            Assert.AreEqual(massOfEarth.Value, grams.Value / 1000);

            var volumeOfEarth = new CubicKilometer(1.08321 * (Math.Pow(10, 12)));
            var volumeInCubicMeters = volumeOfEarth.Convert<Meter>();
            Assert.LessOrEqual(volumeOfEarth.Value - volumeInCubicMeters.Value / 1000000000, 0.001);

            var density = new KilogramPerCubicMeter((massOfEarth / volumeOfEarth).Value);
            var densityInGramsPerCm = density.Convert<Gram, Centimeter>();
            Assert.AreEqual(densityInGramsPerCm.Value / density.Value, .001);
        }
Exemple #2
0
        public void BasicConversionTests()
        {
            var massOfEarth = new Kilogram(5.97219 * (Math.Pow(10, 24)));
            var grams       = massOfEarth.Convert <Gram>();

            Assert.AreEqual(massOfEarth.Value, grams.Value / 1000);

            var volumeOfEarth       = new CubicKilometer(1.08321 * (Math.Pow(10, 12)));
            var volumeInCubicMeters = volumeOfEarth.Convert <Meter>();

            Assert.LessOrEqual(volumeOfEarth.Value - volumeInCubicMeters.Value / 1000000000, 0.001);

            var density             = new KilogramPerCubicMeter((massOfEarth / volumeOfEarth).Value);
            var densityInGramsPerCm = density.Convert <Gram, Centimeter>();

            Assert.AreEqual(densityInGramsPerCm.Value / density.Value, .001);
        }