public void CanConverterMeterCubedToLiter() { const decimal cubicMeters = 1m; const decimal expectedLiters = cubicMeters * 1000m; var liters = MeterConverter.FromMetersTo(cubicMeters, Volume.Liter); Assert.Equal(expectedLiters, liters); }
/// <summary> /// Handles the calculation. /// </summary> /// <param name="wallMaterial">The material that the wall is made out of.</param> /// <param name="radius">The radius of the pool.</param> /// <param name="outputUnitOfMeasure">The unit of measure that the output value should be formatted in.</param> /// <returns></returns> public static decimal CalculateMaximumWaterDepth(IWallMaterial wallMaterial, Length radius, Quantities.Length outputUnitOfMeasure = Quantities.Length.Meter) { var maximumInternalPressureWallCanWithstand = GetMaximumInternalPressureWallCanWithstand(wallMaterial); var internalPressure = GetInternalPressure(radius); var maximumWaterDepthInMeters = maximumInternalPressureWallCanWithstand / internalPressure; var convertedMaximumWaterDepth = MeterConverter.FromMetersTo(maximumWaterDepthInMeters, outputUnitOfMeasure); return(convertedMaximumWaterDepth); }
/// <summary> /// Constructs a new Water Density. The value will change based on the unit of measure selected. /// </summary> /// <param name="unitOfMeasure"></param> public WaterDensity(Density unitOfMeasure = Density.KilogramPerMeterCubed) { UnitOfMeasure = unitOfMeasure; switch (unitOfMeasure) { case Density.KilogramPerLiter: Value = MeterConverter.FromMetersTo( DensityOfWaterInKilogramsPerMeterCubedAtStandardTemperatureAndPressure, Volume.Liter ); break; case Density.KilogramPerMeterCubed: Value = DensityOfWaterInKilogramsPerMeterCubedAtStandardTemperatureAndPressure; break; default: throw new System.NotSupportedException("Density type of: " + unitOfMeasure + " is currently not supported."); } }