public void CanConvertLiterToMeterCubed()
        {
            const decimal liters = 1000m;
            const decimal expectedCubicMeters = liters / 1000m;

            var cubicMeters = MeterConverter.ToMetersFrom(liters, Volume.Liter);

            Assert.Equal(expectedCubicMeters, cubicMeters);
        }
コード例 #2
0
        /// <summary>
        ///     Multiplies the constant density of water and gravity of earth by the radius of the
        /// pool to find the total internal pressure, measured in Pascals.
        /// </summary>
        /// <param name="radius"></param>
        /// <returns></returns>
        private static decimal GetInternalPressure(Length radius)
        {
            var waterDensity   = new WaterDensity();
            var gravity        = new Gravity();
            var radiusInMeters = MeterConverter.ToMetersFrom(radius.Value, radius.UnitOfMeasure);

            var result = waterDensity.Value * gravity.Value * radiusInMeters;

            return(result);
        }
コード例 #3
0
        /// <summary>
        ///     Multiplies the wall's thickness by its tensile strength to find the maximum
        /// internal pressure that it can withstand, measured in Kilograms per second square.
        /// </summary>
        /// <param name="wallMaterial">The material that the wall is made of.</param>
        /// <returns></returns>
        private static decimal GetMaximumInternalPressureWallCanWithstand(IWallMaterial wallMaterial)
        {
            var wallMaterialThicknessInMeters = MeterConverter.ToMetersFrom(
                wallMaterial.Thickness.Value,
                wallMaterial.Thickness.UnitOfMeasure
                );

            var wallMaterialTensileStrengthInPascals = PascalConverter.ToPascalFrom(
                wallMaterial.TensileStrength.Value,
                wallMaterial.TensileStrength.UnitOfMeasure
                );

            var result = wallMaterialThicknessInMeters * wallMaterialTensileStrengthInPascals;

            return(result);
        }