public void Verify_that_second_order_derived_dimless_is_dimless()
        {
            /* Also should not matter that they are the same units per se, only that the dimensions
             * themselves are considered dimensionless. This could easily be a more specialized version
             * of the same unit test. */

            var derivedQty = new Quantity(default(double), A.SquareKilometer, L.Meter.Invert(), L.Kilometer.Invert());
            Assert.That(derivedQty.IsDimensionless);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Protected Constructor
        /// </summary>
        protected TimeableClockBase()
        {
            const int infinite = Timeout.Infinite;
            _timer = new Timer(ProtectedTimerCallback, null, infinite, infinite);

            var s = T.Second;

            TimePerStepQty = new Quantity(1d, s);
            _timerIntervalQty = new Quantity(double.NegativeInfinity, s);
        }
        private static IQuantity CalculateAngular(IQuantity x, IQuantity y, IPlanarAngle desiredUnit,
            Func<double, double, double> trigonometry)
        {
            //TODO: just dimensionless?
            x.VerifyDimensionless();
            y.VerifyDimensionless();

            var radian = SiTheta.Radian;

            desiredUnit = desiredUnit ?? radian;

            IQuantity result = new Quantity(trigonometry(x.Value, y.Value), radian);

            if (desiredUnit is SiTheta) return result;

            return result.ConvertTo(desiredUnit);
        }
Exemplo n.º 4
0
 public void VerifyResults(Quantity result, double a, IQuantity b, double expectedValue)
 {
     base.VerifyResults(result, b.Inverse(), a, expectedValue);
 }
Exemplo n.º 5
0
 protected override void VerifyResults <TA, TB>(Quantity result, IQuantity a, IQuantity b, double expectedValue)
 {
     base.VerifyResults <TA, TB>(result, a, b.Inverse(), expectedValue);
 }
 public void Verify_that_second_order_derived_dimless_is_not_dimless()
 {
     var derivedQty = new Quantity(default(double), A.SquareKilometer, A.SquareKilometer);
     Assert.That(derivedQty.IsDimensionless, Is.False);
 }
 public void Verify_that_first_order_derived_dimless_is_not_dimless()
 {
     var derivedQty = new Quantity(default(double), L.Kilometer, L.Meter, L.Kilometer);
     Assert.That(derivedQty.IsDimensionless, Is.False);
 }
        public void Verify_that_first_order_derived_dimless_is_dimless()
        {
            var derivedQty = new Quantity(default(double), L.Meter, L.Meter.Invert());

            Assert.That(derivedQty.IsDimensionless);
        }
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="value"></param>
 /// <param name="result"></param>
 /// <returns></returns>
 protected bool TryInvokeOperator <T>(T value, out Quantity result)
 {
     result = value.InvokeOperator <T, Quantity>(Operator, value);
     return(result != null);
 }
 public void Verify_that_first_order_derived_dimless_is_dimless()
 {
     var derivedQty = new Quantity(default(double), L.Meter, L.Meter.Invert());
     Assert.That(derivedQty.IsDimensionless);
 }
 /// <summary>
 /// Initializes the quantities.
 /// </summary>
 protected override void InitializeQuantities()
 {
     // For purposes of this test, does not matter what dimensions themselves are, per se.
     VerifyUnaryQuantity(A = new Quantity(Value, L.Meter));
     VerifyUnaryQuantity(B = new Quantity(Value));
 }
        public void Verify_that_second_order_derived_dimless_is_not_dimless()
        {
            var derivedQty = new Quantity(default(double), A.SquareKilometer, A.SquareKilometer);

            Assert.That(derivedQty.IsDimensionless, Is.False);
        }
        public void Verify_that_first_order_derived_dimless_is_not_dimless()
        {
            var derivedQty = new Quantity(default(double), L.Kilometer, L.Meter, L.Kilometer);

            Assert.That(derivedQty.IsDimensionless, Is.False);
        }
        //private static bool IsDegree(this IQuantity angle, double expectedAngle)
        //{
        //    angle.VerifyAngular();
        //    // TODO: might be better if we had an actual IEquatable<IQuantiy> here ...
        //    return angle.ConvertTo(UsTheta.Degree).Value.Equals(expectedAngle);
        //}
        private static IQuantity CalculateDimensionless(this IQuantity angle, Func<double, double> trigonometry)
        {
            angle.VerifyAngular();

            var theta = angle.ConvertTo(SiTheta.Radian);

            var result = new Quantity(trigonometry(theta.Value));

            return result;
        }
 public void Verify_that_pure_dimless_is_dimless()
 {
     var qty = new Quantity();
     Assert.That(qty.IsDimensionless);
 }
 public void Verify_area_squared_equivalent()
 {
     var a = new Quantity(Value, A.SquareMeter.Squared());
     var b = new Quantity(Value, L.Meter.Squared().Squared());
     Assert.That(a.Equals(b), "{{{0}}} did not equal {{{1}}}.", a, b);
 }
        public void Verify_that_pure_dimless_is_dimless()
        {
            var qty = new Quantity();

            Assert.That(qty.IsDimensionless);
        }