public void FromRadiansPerSecondSquared_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity));
 }
        public void GetHashCode_Equals()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal(new { RotationalAcceleration.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
        public void CompareToThrowsOnNull()
        {
            RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1);

            Assert.Throws <ArgumentNullException>(() => radianpersecondsquared.CompareTo(null));
        }
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1);

            Assert.False(radianpersecondsquared.Equals(new object()));
        }
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = RotationalAcceleration.FromRadiansPerSecondSquared(1).ToBaseUnit();

            Assert.Equal(RotationalAcceleration.BaseUnit, quantityInBaseUnit.Unit);
        }
        public void ArithmeticOperators()
        {
            RotationalAcceleration v = RotationalAcceleration.FromRadiansPerSecondSquared(1);

            AssertEx.EqualTolerance(-1, -v.RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance);
            AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(3) - v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance);
            AssertEx.EqualTolerance(2, (v + v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance);
            AssertEx.EqualTolerance(10, (v * 10).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance);
            AssertEx.EqualTolerance(10, (10 * v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance);
            AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(10) / 5).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance);
            AssertEx.EqualTolerance(2, RotationalAcceleration.FromRadiansPerSecondSquared(10) / RotationalAcceleration.FromRadiansPerSecondSquared(5), RadiansPerSecondSquaredTolerance);
        }
Ejemplo n.º 9
0
 /// <inheritdoc cref="RotationalAcceleration.FromRadiansPerSecondSquared(double)"/>
 public static RotationalAcceleration RadiansPerSecondSquared(this long value) => RotationalAcceleration.FromRadiansPerSecondSquared(value);
Ejemplo n.º 10
0
 /// <inheritdoc cref="RotationalAcceleration.FromRadiansPerSecondSquared(double?)"/>
 public static RotationalAcceleration?RadiansPerSecondSquared(this double?value) => RotationalAcceleration.FromRadiansPerSecondSquared(value);
Ejemplo n.º 11
0
 /// <inheritdoc cref="RotationalAcceleration.FromRadiansPerSecondSquared(double?)"/>
 public static RotationalAcceleration?RadiansPerSecondSquared(this decimal?value) => RotationalAcceleration.FromRadiansPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value));
Ejemplo n.º 12
0
 /// <inheritdoc cref="RotationalAcceleration.FromRadiansPerSecondSquared(double)"/>
 public static RotationalAcceleration RadiansPerSecondSquared(this decimal value) => RotationalAcceleration.FromRadiansPerSecondSquared(Convert.ToDouble(value));
 public void FromRadiansPerSecondSquared_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN));
 }
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(decimal value)
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(value);

            Assert.Equal(RotationalAcceleration.FromRadiansPerSecondSquared(-value), -quantity);
        }
        public void Convert_ToString_EqualsToString()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
        public void FromRadiansPerSecondSquared_WithNanValue_CreateQuantityAndAffectNaNValue()
        {
            var nanQuantity = RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN);

            Assert.True(double.IsNaN(nanQuantity.Value));
        }
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(RotationalAcceleration)));
        }
        public void CompareToThrowsOnTypeMismatch()
        {
            RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1);

            Assert.Throws <ArgumentException>(() => radianpersecondsquared.CompareTo(new object()));
        }
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(RotationalAccelerationUnit)));
        }
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = RotationalAcceleration.FromRadiansPerSecondSquared(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(RotationalAcceleration.FromRadiansPerSecondSquared(1), -1, ComparisonType.Relative));
        }
        public void Convert_ChangeType_QuantityType_EqualsQuantityType()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal(QuantityType.RotationalAcceleration, Convert.ChangeType(quantity, typeof(QuantityType)));
        }
        public void EqualsReturnsFalseOnNull()
        {
            RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1);

            Assert.False(radianpersecondsquared.Equals(null));
        }
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal(RotationalAcceleration.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
        public void Convert_ToInt32_EqualsValueAsSameType()
        {
            var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0);

            Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity));
        }
 public static RotationalAcceleration?RadiansPerSecondSquared <T>(this T?value) where T : struct => RotationalAcceleration.FromRadiansPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value));