/// <summary>
        /// Initializes a new instance of the <see cref="MassSpecificGravity"/> class. Uses <see cref="UnitWeightOfWaterAt4DegreesC" /> as reference.
        /// </summary>
        /// <param name="totalUnitWeight">Calculation for gamma_t/gamma_0.</param>
        public MassSpecificGravity(TotalUnitWeight totalUnitWeight)
        {
            this.Symbol = "G_m";
            UnitWeightOfWaterAt4DegreesC referenceWeight = new UnitWeightOfWaterAt4DegreesC();

            this.NumericValue = totalUnitWeight.NumericValue / BaseUnitWeightScalar.ConvertToUnits(referenceWeight, totalUnitWeight.UnitOfMeasure).NumericValue;
        }
示例#2
0
        public void Constructor2ShouldStoreAndPrintValueAndSymbolWithPoundPerFootCubed()
        {
            TotalUnitWeight tuw = new TotalUnitWeight(10, UnitWeightUnits.GramPerCubicCentimeter);
            Density         d   = new Density(tuw, UnitWeightUnits.PoundPerCubicFoot);

            Assert.AreEqual(Math.Round(d.NumericValue, 2), 63.64);
            Assert.AreEqual(d.UnitOfMeasure, UnitWeightUnits.PoundPerCubicFoot);
            Assert.AreEqual(d.Symbol, "ρ");
        }
示例#3
0
        public void Constructor2ShouldStoreAndPrintValueAndSymbolWithKilogramPerMeterCubed()
        {
            TotalUnitWeight tuw = new TotalUnitWeight(10, UnitWeightUnits.GramPerCubicCentimeter);
            Density         d   = new Density(tuw, UnitWeightUnits.KilogramPerMeterCubed);

            Assert.AreEqual(Math.Round(d.NumericValue, 3), 1019.368);
            Assert.AreEqual(d.UnitOfMeasure, UnitWeightUnits.KilogramPerMeterCubed);
            Assert.AreEqual(d.Symbol, "ρ");
        }
示例#4
0
        public void Constructor1ShouldStoreAndPrintValueAndSymbol()
        {
            TotalUnitWeight d             = new TotalUnitWeight(10, UnitWeightUnits.GramPerCubicCentimeter);
            String          correctAnswer = "𝛾_t = 10 g/cc";

            Assert.AreEqual("𝛾_t", d.Symbol);
            Assert.AreEqual(d.NumericValue, 10);
            Assert.AreEqual(correctAnswer, d.ToString());
        }
        public void Constructor2ShouldStoreAndPrintValueAndSymbol()
        {
            TotalUnitWeight     tuw = new TotalUnitWeight(10, UnitWeightUnits.GramPerCubicCentimeter);
            MassSpecificGravity msg = new MassSpecificGravity(tuw);
            String correctAnswer    = "G_m = 10";

            Assert.AreEqual("G_m", msg.Symbol);
            Assert.AreEqual(msg.NumericValue, 10);
            Assert.AreEqual(correctAnswer, msg.ToString());
        }
示例#6
0
        public void Constructor2ShouldStoreAndPrintValueAndSymbolWithPoundPerFootCubed()
        {
            TotalWeight     tw  = new TotalWeight(10, WeightUnits.Grams);
            TotalVolume     tv  = new TotalVolume(10, VolumeUnits.CubicCentimeters);
            TotalUnitWeight tuw = new TotalUnitWeight(tw, tv, UnitWeightUnits.PoundPerCubicFoot);

            Assert.AreEqual(Math.Round(tuw.NumericValue, 2), 62.43);
            Assert.AreEqual(tuw.UnitOfMeasure, UnitWeightUnits.PoundPerCubicFoot);
            Assert.AreEqual(tuw.Symbol, "𝛾_t");;
        }
示例#7
0
        public void Constructor3ShouldStoreAndPrintValueAndSymbolWithPoundPerFootCubed()
        {
            SpecificGravityOfSolids sgos = new SpecificGravityOfSolids(10);
            DegreeOfSaturation      dos  = new DegreeOfSaturation(0.5);
            VoidRatio         vr         = new VoidRatio(0.5);
            UnitWeightOfWater uww        = new UnitWeightOfWater(1, UnitWeightUnits.GramPerCubicCentimeter);
            TotalUnitWeight   tuw        = new TotalUnitWeight(sgos, dos, vr, uww, UnitWeightUnits.PoundPerCubicFoot);

            Assert.AreEqual(Math.Round(tuw.NumericValue, 1), 426.6);
            Assert.AreEqual(tuw.UnitOfMeasure, UnitWeightUnits.PoundPerCubicFoot);
            Assert.AreEqual(tuw.Symbol, "𝛾_t");;
        }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Density"/> class. Assumes g = 9.81 m/s^2.
 /// </summary>
 /// <param name="totalUnitWeight">gamma_t in rho=gamma_t/g.</param>
 /// <param name="units">Measurement system to hold value in after initial calculation.</param>
 public Density(TotalUnitWeight totalUnitWeight, UnitWeightUnits units)
     : this(ConvertToUnits(new BaseUnitWeightScalar("𝛾", ConvertToUnits(totalUnitWeight, UnitWeightUnits.KilogramPerMeterCubed).NumericValue / 9.81, UnitWeightUnits.KilogramPerMeterCubed), units).NumericValue, units)
 {
 }