public void GivenBaseNumberWhenAddDoubleShouldReturnNewBaseNumberWithSourceAddedToDouble()
        {
            var uom    = _mileUnitOfMeasure;
            var number = new NumericValue(uom.ToModelUom(), 3.62);

            var result = number.Add(1.23);

            Assert.AreEqual(4.85, result.Value, Epsilon);
        }
        public void GivenTwoBaseNumbersWithSameUomWhenAddedShouldReturnNewBaseNumberWithSumAsSourceValue()
        {
            var uom            = InternalUnitSystemManager.Instance.UnitOfMeasures["C"];
            var originalNumber = new NumericValue(uom.ToModelUom(), 22);
            var secondNumber   = new NumericValue(uom.ToModelUom(), 11);

            var result = originalNumber.Add(secondNumber);

            Assert.AreEqual(33, result.Value);
        }
        public void GivenBaseNumbersWithIncompatibleUnitsWhenAddThenException()
        {
            var originalUom    = InternalUnitSystemManager.Instance.UnitOfMeasures["m"];
            var originalNumber = new NumericValue(originalUom.ToModelUom(), 1.75);

            var secondUom    = InternalUnitSystemManager.Instance.UnitOfMeasures["C"];
            var secondNumber = new NumericValue(secondUom.ToModelUom(), 3.5);

            Assert.Throws <InvalidOperationException>(() => originalNumber.Add(secondNumber));
        }
        public void GivenBaseNumberWhenAddBaseNumberThenResultIsInOriginalUom()
        {
            var originalUom    = InternalUnitSystemManager.Instance.UnitOfMeasures["m"];
            var originalNumber = new NumericValue(originalUom.ToModelUom(), 1.75);

            var secondUom    = InternalUnitSystemManager.Instance.UnitOfMeasures["ft"];
            var secondNumber = new NumericValue(secondUom.ToModelUom(), 3.5);

            var expected = 2.8168; //1.75m + (3.5ft -> m)
            var actual   = originalNumber.Add(secondNumber);

            Assert.AreEqual(expected, actual.Value, Epsilon);
        }