/// <summary> /// Initializes a new instance of the <see cref="SpecificGravityOfWater"/> class. Uses <see cref="UnitWeightOfWaterAt4DegreesC" /> as reference. /// </summary> /// <param name="waterUnitWeight">Calculation for gamma_w/gamma_0.</param> public SpecificGravityOfWater(UnitWeightOfWater waterUnitWeight) { this.Symbol = "G_w"; UnitWeightOfWaterAt4DegreesC referenceWeight = new UnitWeightOfWaterAt4DegreesC(); this.NumericValue = waterUnitWeight.NumericValue / BaseUnitWeightScalar.ConvertToUnits(referenceWeight, waterUnitWeight.UnitOfMeasure).NumericValue; }
public void Constructor2ShouldStoreAndPrintValueAndSymbol() { UnitWeightOfWater uws = new UnitWeightOfWater(10, UnitWeightUnits.GramPerCubicCentimeter); SpecificGravityOfWater sgw = new SpecificGravityOfWater(uws); String correctAnswer = "G_w = 10"; Assert.AreEqual("G_w", sgw.Symbol); Assert.AreEqual(sgw.NumericValue, 10); Assert.AreEqual(correctAnswer, sgw.ToString()); }
public void Constructor1ShouldStoreAndPrintValueAndSymbol() { UnitWeightOfWater uww = new UnitWeightOfWater(10, UnitWeightUnits.GramPerCubicCentimeter); String correctAnswer = "𝛾_w = 10 g/cc"; Assert.AreEqual("𝛾_w", uww.Symbol); Assert.AreEqual(uww.NumericValue, 10); Assert.AreEqual(correctAnswer, uww.ToString()); }
public void Constructor2ShouldStoreAndPrintValueAndSymbolWithPoundPerFootCubed() { WeightOfWater ww = new WeightOfWater(10, WeightUnits.Grams); WaterVolume wv = new WaterVolume(10, VolumeUnits.CubicCentimeters); UnitWeightOfWater uww = new UnitWeightOfWater(ww, wv, UnitWeightUnits.PoundPerCubicFoot); Assert.AreEqual(Math.Round(uww.NumericValue, 1), 62.4); Assert.AreEqual(uww.UnitOfMeasure, UnitWeightUnits.PoundPerCubicFoot); Assert.AreEqual(uww.Symbol, "𝛾_w"); }
public void Constructor3ShouldStoreAndPrintValueAndSymbol() { UnitWeightOfSolids uws = new UnitWeightOfSolids(10, UnitWeightUnits.GramPerCubicCentimeter); UnitWeightOfWater uww = new UnitWeightOfWater(2, UnitWeightUnits.GramPerCubicCentimeter); SpecificGravityOfSolids sgs = new SpecificGravityOfSolids(uws, uww); String correctAnswer = "G_s = 5"; Assert.AreEqual("G_s", sgs.Symbol); Assert.AreEqual(sgs.NumericValue, 5); Assert.AreEqual(correctAnswer, sgs.ToString()); }
public void Constructor3ShouldStoreAndPrintValueAndSymbol() { TotalUnitWeight tuw = new TotalUnitWeight(10, UnitWeightUnits.GramPerCubicCentimeter); UnitWeightOfWater uww = new UnitWeightOfWater(2, UnitWeightUnits.GramPerCubicCentimeter); MassSpecificGravity msg = new MassSpecificGravity(tuw, uww); String correctAnswer = "G_m = 5"; Assert.AreEqual("G_m", msg.Symbol); Assert.AreEqual(msg.NumericValue, 5); Assert.AreEqual(correctAnswer, msg.ToString()); }
public void Constructor3ShouldStoreAndPrintValueAndSymbolWithKilograms() { MassSpecificGravity msg = new MassSpecificGravity(10); UnitWeightOfWater uww = new UnitWeightOfWater(1, UnitWeightUnits.GramPerCubicCentimeter); TotalVolume tv = new TotalVolume(10, VolumeUnits.CubicCentimeters); TotalWeight tw = new TotalWeight(msg, uww, tv, WeightUnits.Kilograms); Assert.AreEqual("W", tw.Symbol); Assert.AreEqual(Math.Round(tw.NumericValue, 2), .10); Assert.AreEqual(tw.UnitOfMeasure, WeightUnits.Kilograms); }
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");; }
/// <summary> /// Initializes a new instance of the <see cref="SpecificGravityOfSolids"/> class. /// </summary> /// <param name="solidUnitWeight">gamma_s for gamma_s/gamma_0.</param> /// <param name="referenceWeight">gamma_0 for gamma_s/gamma_0.</param> public SpecificGravityOfSolids(UnitWeightOfSolids solidUnitWeight, UnitWeightOfWater referenceWeight) { this.Symbol = "G_s"; this.NumericValue = solidUnitWeight.NumericValue / BaseUnitWeightScalar.ConvertToUnits(referenceWeight, solidUnitWeight.UnitOfMeasure).NumericValue; }
/// <summary> /// Initializes a new instance of the <see cref="TotalWeight"/> class. /// </summary> /// <param name="massSpecificGravity">G_m in W=G_m*gamma_w*V.</param> /// <param name="unitWeightOfWater">gamma_w in W=G_m*gamma_w*V.</param> /// <param name="totalVolume">V in W=G_m*gamma_w*V.</param> /// <param name="units">Measurement unit to hold value after initial calculation (ie kg).</param> public TotalWeight(MassSpecificGravity massSpecificGravity, UnitWeightOfWater unitWeightOfWater, TotalVolume totalVolume, WeightUnits units) : this(ConvertToUnits(new BaseWeightScalar("𝛾", BaseUnitWeightScalar.ConvertToUnits(unitWeightOfWater, UnitWeightUnits.KilogramPerMeterCubed).NumericValue *BaseVolumeScalar.ConvertToUnits(totalVolume, VolumeUnits.CubicMeters).NumericValue *massSpecificGravity.NumericValue, WeightUnits.Kilograms), units).NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="MassSpecificGravity"/> class. /// </summary> /// <param name="totalUnitWeight">gamma_t in G_m=gamma_t/gamma_0.</param> /// <param name="referenceWeight">gamma_0 in G_m=gamma_t/gamma_0.</param> public MassSpecificGravity(TotalUnitWeight totalUnitWeight, UnitWeightOfWater referenceWeight) { this.Symbol = "G_m"; this.NumericValue = totalUnitWeight.NumericValue / BaseUnitWeightScalar.ConvertToUnits(referenceWeight, totalUnitWeight.UnitOfMeasure).NumericValue; }