public void GivenNullWhenSubtractFromSourceShoulReturnSourceValue() { var number = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["cm"].ToModelUom(), 4.25); number.SubtractFromSource(null); Assert.AreEqual(4.25, number.Value, Epsilon); }
public void GivenBaseNumberAndDoubleWhenSubtractFromSourceShouldSubtractFromSource() { var firstNumber = new NumericValue(_mileUnitOfMeasure.ToModelUom(), 42.24); firstNumber.SubtractFromSource(12.13); Assert.AreEqual(30.11, firstNumber.Value, Epsilon); }
public void GivenBaseNumberWhenSubtractBaseNumberWithDifferentUnitOfMeasureThenShouldConvertAndSubtractFromSource() { var firstNumber = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["cm"].ToModelUom(), 3.54); var secondNumber = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["in"].ToModelUom(), 1); firstNumber.SubtractFromSource(secondNumber); Assert.AreEqual(1, firstNumber.Value, Epsilon); }
public void GivenBaseNumberWhenSubtractBaseNumberFromSourceShouldSubtractValueFromSourceValue() { var number = new NumericValue(_mileUnitOfMeasure.ToModelUom(), 9.876); var secondNumber = new NumericValue(_mileUnitOfMeasure.ToModelUom(), 1.234); number.SubtractFromSource(secondNumber); Assert.AreEqual(8.642, number.Value); }