public void ConvertsWell() { var weight1 = new Weight(10, MassUnit.Kilogram); var weight2 = weight1.ConvertTo(MassUnit.Ounce); Assert.Equal(new Weight(352.74, MassUnit.Ounce), weight2); }
/// <summary> /// Sets the sensor's calibration factor based on a factor calculated with a know weight by calling <see cref="CalculateCalibrationFactor"/>. /// </summary> /// <param name="factor"></param> /// <param name="knownValue"></param> public void SetCalibrationFactor(int factor, Weight knownValue) { gramsPerAdcUnit = knownValue.ConvertTo(WeightUnits.Grams) / factor; }