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); }
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); }
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))); } }
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))); } }
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))); } }
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))); } }
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)) )); } }
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)); } }
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)); } }
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)) ); } }
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)); } }
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); }