Ejemplo n.º 1
0
 public void GetAmount_StandardMeasureToKmph_Factor3point6Larger()
 {
     var expected = AmountConverter.ToAmountType(90.0);
     var velocity = new StandardMeasure<Velocity>(25.0);
     var actual = velocity.GetAmount(Velocity.KiloMeterPerHour);
     AmountAssert.AreEqual(expected, actual);
 }
Ejemplo n.º 2
0
        public void GetAmount_StandardMeasureToKmph_Factor3point6Larger()
        {
            var expected = AmountConverter.ToAmountType(90.0);
            var velocity = new StandardMeasure <Velocity>(25.0);
            var actual   = velocity.GetAmount(Velocity.KiloMeterPerHour);

            AmountAssert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
 public static double ConvertSurfaceMassFrom(double value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
     {
         return(value);
     }
     else
     {
         StandardMeasure <SurfaceDensity> measure = new StandardMeasure <SurfaceDensity>(value, SurfaceMassUnitFromUnitSystem(unitSystem));
         return(measure.GetAmount(SurfaceMassUnitFromUnitSystem(CurrentUnitSystem)));
     }
 }
Ejemplo n.º 4
0
 public static double ConvertMassTo(double value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
     {
         return(value);
     }
     else
     {
         StandardMeasure <Mass> measure = new StandardMeasure <Mass>(value, MassUnitFromUnitSystem(CurrentUnitSystem));
         return(measure.GetAmount(MassUnitFromUnitSystem(unitSystem)));
     }
 }
Ejemplo n.º 5
0
 public static double ConvertLengthFrom(double value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
     {
         return(value);
     }
     else
     {
         StandardMeasure <Length> measure = new StandardMeasure <Length>(value, LengthUnitFromUnitSystem(unitSystem));
         return(measure.GetAmount(LengthUnitFromUnitSystem(CurrentUnitSystem)));
     }
 }
Ejemplo n.º 6
0
 public static double ConvertLinearMassFrom(double value, UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
     {
         return(value);
     }
     else
     {
         StandardMeasure <Mass>   measure       = new StandardMeasure <Mass>(value, MassUnitFromUnitSystem(CurrentUnitSystem));
         StandardMeasure <Length> measureLength = new StandardMeasure <Length>(value, LengthUnitFromUnitSystem(CurrentUnitSystem));
         return(measure.GetAmount(MassUnitFromUnitSystem(unitSystem)));
     }
 }
Ejemplo n.º 7
0
 public static Vector2D ConvertLengthFrom(Vector2D value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
     {
         return(value);
     }
     else
     {
         StandardMeasure <Length> measureX = new StandardMeasure <Length>(value.X, LengthUnitFromUnitSystem(unitSystem));
         StandardMeasure <Length> measureY = new StandardMeasure <Length>(value.Y, LengthUnitFromUnitSystem(unitSystem));
         return(new Vector2D(
                    measureX.GetAmount(LengthUnitFromUnitSystem(CurrentUnitSystem))
                    , measureY.GetAmount(LengthUnitFromUnitSystem(CurrentUnitSystem))
                    ));
     }
 }
Ejemplo n.º 8
0
 public static double ConvertSurfaceMassFrom(double value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
         return value;
     else
     {
         StandardMeasure<SurfaceDensity> measure = new StandardMeasure<SurfaceDensity>(value, SurfaceMassUnitFromUnitSystem(unitSystem));
         return measure.GetAmount(SurfaceMassUnitFromUnitSystem(CurrentUnitSystem));
     }
 }
Ejemplo n.º 9
0
 public static double ConvertMassTo(double value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
         return value;
     else
     {
         StandardMeasure<Mass> measure = new StandardMeasure<Mass>(value, MassUnitFromUnitSystem(CurrentUnitSystem));
         return measure.GetAmount(MassUnitFromUnitSystem(unitSystem));
     }
 }
Ejemplo n.º 10
0
 public static Vector3D ConvertLengthFrom(Vector3D value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
         return value;
     else
     {
         StandardMeasure<Length> measureX = new StandardMeasure<Length>(value.X, LengthUnitFromUnitSystem(unitSystem));
         StandardMeasure<Length> measureY = new StandardMeasure<Length>(value.Y, LengthUnitFromUnitSystem(unitSystem));
         StandardMeasure<Length> measureZ = new StandardMeasure<Length>(value.Z, LengthUnitFromUnitSystem(unitSystem));
         return new Vector3D(
             measureX.GetAmount(LengthUnitFromUnitSystem(CurrentUnitSystem))
             , measureY.GetAmount(LengthUnitFromUnitSystem(CurrentUnitSystem))
             , measureZ.GetAmount(LengthUnitFromUnitSystem(CurrentUnitSystem))
             );
     }
 }
Ejemplo n.º 11
0
 public static double ConvertLengthFrom(double value, UnitsManager.UnitSystem unitSystem)
 {
     if (unitSystem == CurrentUnitSystem)
         return value;
     else
     {
         StandardMeasure<Length> measure = new StandardMeasure<Length>(value, LengthUnitFromUnitSystem(unitSystem));
         return measure.GetAmount(LengthUnitFromUnitSystem(CurrentUnitSystem));
     }
 }
Ejemplo n.º 12
0
 public void GetAmount_UsingIUnit_ValidConversion()
 {
     var expected = AmountConverter.ToAmountType(500.0);
     var instance = new StandardMeasure<Length>(5.0);
     var actual = instance.GetAmount(Length.CentiMeter);
     Assert.AreEqual(expected, actual);
 }