Exemplo n.º 1
0
        public void GivenNullWhenSubtractFromSourceShoulReturnSourceValue()
        {
            var number = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["cm"].ToModelUom(), 4.25);

            number.SubtractFromSource(null);

            Assert.AreEqual(4.25, number.Value, Epsilon);
        }
Exemplo n.º 2
0
        public void GivenBaseNumberAndDoubleWhenSubtractFromSourceShouldSubtractFromSource()
        {
            var firstNumber = new NumericValue(_mileUnitOfMeasure.ToModelUom(), 42.24);

            firstNumber.SubtractFromSource(12.13);

            Assert.AreEqual(30.11, firstNumber.Value, Epsilon);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }