public void FromMetersToTheFourth_WithNanValue_CreateQuantityAndAffectNaNValue()
        {
            var nanQuantity = AreaMomentOfInertia.FromMetersToTheFourth(double.NaN);

            Assert.True(double.IsNaN(nanQuantity.Value));
        }
Ejemplo n.º 2
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
Ejemplo n.º 3
0
        public void Convert_ToBool_ThrowsInvalidCastException()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToBoolean(quantity));
        }
Ejemplo n.º 4
0
        public void CompareToThrowsOnNull()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.Throws <ArgumentNullException>(() => metertothefourth.CompareTo(null));
        }
Ejemplo n.º 5
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.False(metertothefourth.Equals(new object()));
        }
 /// <inheritdoc cref="AreaMomentOfInertia.FromMetersToTheFourth(double?)"/>
 public static AreaMomentOfInertia?MetersToTheFourth(this decimal?value) => AreaMomentOfInertia.FromMetersToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value));
Ejemplo n.º 7
0
        public void ArithmeticOperators()
        {
            AreaMomentOfInertia v = AreaMomentOfInertia.FromMetersToTheFourth(1);

            AssertEx.EqualTolerance(-1, -v.MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(3) - v).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, (v + v).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(10, (v * 10).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(10, (10 * v).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(10) / 5).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, AreaMomentOfInertia.FromMetersToTheFourth(10) / AreaMomentOfInertia.FromMetersToTheFourth(5), MetersToTheFourthTolerance);
        }
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(AreaMomentOfInertia)));
        }
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(AreaMomentOfInertiaUnit)));
        }
        public void Convert_ToString_EqualsToString()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
        public void Convert_ToUInt16_EqualsValueAsSameType()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal((ushort)quantity.Value, Convert.ToUInt16(quantity));
        }
 public void FromMetersToTheFourth_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN));
 }
 public void FromMetersToTheFourth_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity));
 }
 public void NumberToMetersToTheFourthTest() =>
 Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(2), 2.MetersToTheFourth());
 /// <inheritdoc cref="AreaMomentOfInertia.FromMetersToTheFourth(double?)"/>
 public static AreaMomentOfInertia?MetersToTheFourth(this float?value) => AreaMomentOfInertia.FromMetersToTheFourth(value);
        public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(AreaMomentOfInertia.Info, Convert.ChangeType(quantity, typeof(QuantityInfo)));
        }
 /// <inheritdoc cref="AreaMomentOfInertia.FromMetersToTheFourth(double)"/>
 public static AreaMomentOfInertia MetersToTheFourth(this decimal value) => AreaMomentOfInertia.FromMetersToTheFourth(Convert.ToDouble(value));
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(AreaMomentOfInertia.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
Ejemplo n.º 19
0
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = AreaMomentOfInertia.FromMetersToTheFourth(1).ToBaseUnit();

            Assert.Equal(AreaMomentOfInertia.BaseUnit, quantityInBaseUnit.Unit);
        }
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
Ejemplo n.º 21
0
        public void CompareToThrowsOnTypeMismatch()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.Throws <ArgumentException>(() => metertothefourth.CompareTo(new object()));
        }
        public void GetHashCode_Equals()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(new { AreaMomentOfInertia.Info.Name, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
Ejemplo n.º 23
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(AreaMomentOfInertia.FromMetersToTheFourth(1), -1, ComparisonType.Relative));
        }
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value)
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(value);

            Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(-value), -quantity);
        }
Ejemplo n.º 25
0
        public void EqualsReturnsFalseOnNull()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.False(metertothefourth.Equals(null));
        }
Ejemplo n.º 26
0
        public void AreaMomentOfInertiaDividedByLengthEqualsVolume()
        {
            Volume volume = AreaMomentOfInertia.FromMetersToTheFourth(20) / Length.FromMeters(10);

            Assert.Equal(Volume.FromCubicMeters(2), volume);
        }
Ejemplo n.º 27
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
 /// <inheritdoc cref="AreaMomentOfInertia.FromMetersToTheFourth(double)"/>
 public static AreaMomentOfInertia MetersToTheFourth(this double value) => AreaMomentOfInertia.FromMetersToTheFourth(value);
Ejemplo n.º 29
0
        public void Convert_ToByte_EqualsValueAsSameType()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal((byte)quantity.Value, Convert.ToByte(quantity));
        }
 public static AreaMomentOfInertia MetersToTheFourth <T>(this T value) =>
 AreaMomentOfInertia.FromMetersToTheFourth(Convert.ToDecimal(value));