예제 #1
0
        public void GivenNullWhenAddToSourceShouldReturnSourceValue()
        {
            var number = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["lb"].ToModelUom(), 22.1);

            number.AddToSource(null);

            Assert.AreEqual(22.1, number.Value, Epsilon);
        }
예제 #2
0
        public void GivenBaseNumberAndDoubleValueWhenAddToSourceShouldAddDoubleToSourceValue()
        {
            var number = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["mg"].ToModelUom(), 3.14);

            number.AddToSource(4.13);

            Assert.AreEqual(7.27, number.Value, Epsilon);
        }
예제 #3
0
        public void GivenBaseNumberWhenAddBaseNumberWithDifferentUnitOfMeasureThenShouldConvertAndAddToSource()
        {
            var firstNumber  = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["cm"].ToModelUom(), 1);
            var secondNumber = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["in"].ToModelUom(), 1);

            firstNumber.AddToSource(secondNumber);

            Assert.AreEqual(3.54, firstNumber.Value, Epsilon);
        }
예제 #4
0
        public void GivenBaseNumberWhenAddBaseNumberToSourceThenShouldAddTheSecondNumberToSourceValue()
        {
            var firstNumber  = new NumericValue(_mileUnitOfMeasure.ToModelUom(), 42.24);
            var secondNumber = new NumericValue(_mileUnitOfMeasure.ToModelUom(), 12.34);

            firstNumber.AddToSource(secondNumber);

            Assert.AreEqual(54.58, firstNumber.Value, Epsilon);
        }