public void FromMetersToTheFourth_WithNanValue_CreateQuantityAndAffectNaNValue() { var nanQuantity = AreaMomentOfInertia.FromMetersToTheFourth(double.NaN); Assert.True(double.IsNaN(nanQuantity.Value)); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void Convert_ToBool_ThrowsInvalidCastException() { var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToBoolean(quantity)); }
public void CompareToThrowsOnNull() { AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); Assert.Throws <ArgumentNullException>(() => metertothefourth.CompareTo(null)); }
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));
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))); }
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))); }
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()); }
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); }
public void EqualsReturnsFalseOnNull() { AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); Assert.False(metertothefourth.Equals(null)); }
public void AreaMomentOfInertiaDividedByLengthEqualsVolume() { Volume volume = AreaMomentOfInertia.FromMetersToTheFourth(20) / Length.FromMeters(10); Assert.Equal(Volume.FromCubicMeters(2), volume); }
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);
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));