public void GivenBaseNumberWhenDivideBaseNumberWithZeroValueThenDivideByZeroException()
        {
            var numerator   = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft"].ToModelUom(), 3);
            var denominator = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["sec"].ToModelUom(), 0);

            Assert.Throws <DivideByZeroException>(() => numerator.Divide(denominator));
        }
        public void GivenBaseNumberWhenDivideByZeroShouldThrowException()
        {
            var uom    = _mileUnitOfMeasure;
            var number = new NumericValue(uom.ToModelUom(), 3.62);

            Assert.Throws <DivideByZeroException>(() => number.Divide(0));
        }
        public void GivenBaseNumberWhenDivideDoubleShouldReturnNewBaseNumberWithSourceDividedByDouble()
        {
            var uom    = _mileUnitOfMeasure;
            var number = new NumericValue(uom.ToModelUom(), 3.62);

            var result = number.Divide(1.23);

            Assert.AreEqual(3.62 / 1.23, result.Value, Epsilon);
        }
        public void GivenBaseNumberWithCompositeUnitOfMeasureWhenDivdeBaseNumberWithCompositeUnitOfMeasureThenUnitOfMeasuresSimplified()
        {
            var numerator   = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft1sec-1"].ToModelUom(), 52.15);
            var denominator = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["gal1sec-1"].ToModelUom(), 12);

            var quotient = numerator.Divide(denominator);

            Assert.AreEqual("ft1gal-1", quotient.UnitOfMeasure.Code);
            Assert.AreEqual(4.345833333333333, quotient.Value, Epsilon);
        }
        public void GivenBaseNumberWhenWhenDivideBaseNumberWithCompositeUnitOfMeasureThenUnitOfMeasuresSimplified()
        {
            var numerator   = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft"].ToModelUom(), 12.54);
            var denominator = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["[sec2]-1"].ToModelUom(), 5);

            var quotient = numerator.Divide(denominator);

            Assert.AreEqual("ft1sec2", quotient.UnitOfMeasure.Code);
            Assert.AreEqual(2.508, quotient.Value, Epsilon);
        }
        public void GivenNumericValueWithCompositeUnitOfMeasureWhenDivideBaseNumberThenUnitOfMeasuresCombined()
        {
            var numerator   = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft1sec-1"].ToModelUom(), 2.4);
            var denominator = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["sec"].ToModelUom(), 5);

            var quotient = numerator.Divide(denominator);

            Assert.AreEqual("ft1[sec2]-1", quotient.UnitOfMeasure.Code);
            Assert.AreEqual(.48, quotient.Value, Epsilon);
        }
        public void GivenBaseNumberWhenDivideBaseNumberWithSameUnitThenValueDivided()
        {
            var numerator   = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft"].ToModelUom(), 12);
            var denominator = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft"].ToModelUom(), 6);

            var quotient = numerator.Divide(denominator);

            Assert.AreEqual("ratio", quotient.UnitOfMeasure.Code);
            Assert.AreEqual(2, quotient.Value, Epsilon);
        }