private static void DoAssosciativeQuantityDivide <TDividend, TDivisor, TExpectedResult>(TDividend nonZeroDividend, TDivisor nonZeroDivisor)
        {
            IUnit unit = new Mock <IUnit>().Object;
            Quantity <TDividend> dividend  = new Quantity <TDividend>(nonZeroDividend, unit);
            Quantity <TDivisor>  divisor   = new Quantity <TDivisor>(nonZeroDivisor, unit);
            QuantityBase         ldrResult = dividend / divisor;
            QuantityBase         rdlResult = divisor / dividend;

            if (ldrResult == null)
            {
                throw new NullReferenceException("Result of left / right was null.");
            }
            if (rdlResult == null)
            {
                throw new NullReferenceException("Result of right / left was null.");
            }

            if (!(ldrResult is Quantity <TExpectedResult>))
            {
                throw new NotSupportedException(string.Format("Expected result type {0}, but got {1}.",
                                                              typeof(Quantity <TExpectedResult>), ldrResult.GetType()));
            }
            if (!(rdlResult is Quantity <TExpectedResult>))
            {
                throw new NotSupportedException(string.Format("Expected result type {0}, but got {1}.",
                                                              typeof(Quantity <TExpectedResult>), rdlResult.GetType()));
            }
        }
        private static void DoQuantitySubtract <TDividend, TDivisor, TExpectedResult>()
        {
            IUnit unit = new Mock <IUnit>().Object;
            Quantity <TDividend> dividend  = new Quantity <TDividend>(default(TDividend), unit);
            Quantity <TDivisor>  divisor   = new Quantity <TDivisor>(default(TDivisor), unit);
            QuantityBase         ldrResult = dividend - divisor;
            QuantityBase         rdlResult = divisor - dividend;

            if (ldrResult == null)
            {
                throw new NullReferenceException("Result of left - right was null.");
            }
            if (rdlResult == null)
            {
                throw new NullReferenceException("Result of right - left was null.");
            }

            if (!(ldrResult is Quantity <TExpectedResult>))
            {
                throw new NotSupportedException(string.Format("Expected result type {0}, but got {1}.",
                                                              typeof(Quantity <TExpectedResult>), ldrResult.GetType()));
            }
            if (!(rdlResult is Quantity <TExpectedResult>))
            {
                throw new NotSupportedException(string.Format("Expected result type {0}, but got {1}.",
                                                              typeof(Quantity <TExpectedResult>), rdlResult.GetType()));
            }
        }
        private static void DoAssosciativeQuantityMultiply <TLeft, TRight, TExpectedResult>()
        {
            IUnit             unit      = new Mock <IUnit>().Object;
            Quantity <TLeft>  left      = new Quantity <TLeft>(default(TLeft), unit);
            Quantity <TRight> right     = new Quantity <TRight>(default(TRight), unit);
            QuantityBase      lxrResult = left * right;
            QuantityBase      rxlResult = right * left;

            if (lxrResult == null)
            {
                throw new NullReferenceException("Result of left*right was null.");
            }
            if (rxlResult == null)
            {
                throw new NullReferenceException("Result of right*left was null.");
            }

            if (!(rxlResult is Quantity <TExpectedResult>))
            {
                throw new NotSupportedException(string.Format("Expected result type {0}, but got {1}.",
                                                              typeof(Quantity <TExpectedResult>), lxrResult.GetType()));
            }
            if (!(rxlResult is Quantity <TExpectedResult>))
            {
                throw new NotSupportedException(string.Format("Expected result type {0}, but got {1}.",
                                                              typeof(Quantity <TExpectedResult>), rxlResult.GetType()));
            }
        }