public void CompareToThrowsOnNull() { CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.Throws <ArgumentNullException>(() => inversekelvin.CompareTo(null)); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(CoefficientOfThermalExpansionUnit))); }
public void NumberToInverseKelvinTest() => Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(2), 2.InverseKelvin());
public void Convert_ToSingle_EqualsValueAsSameType() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); }
public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
public void EqualsReturnsFalseOnNull() { CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.False(inversekelvin.Equals(null)); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(value); Assert.Equal(CoefficientOfThermalExpansion.FromInverseKelvin(-value), -quantity); }
/// <inheritdoc cref="CoefficientOfThermalExpansion.FromInverseKelvin(UnitsNet.QuantityValue)" /> public static CoefficientOfThermalExpansion InverseKelvin <T>(this T value) => CoefficientOfThermalExpansion.FromInverseKelvin(Convert.ToDouble(value));
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void GetHashCode_Equals() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal(new { CoefficientOfThermalExpansion.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal(CoefficientOfThermalExpansion.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public static CoefficientOfThermalExpansion?InverseKelvin <T>(this T?value) where T : struct => CoefficientOfThermalExpansion.FromInverseKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value));
public void FromInverseKelvin_WithNanValue_CreateQuantityAndAffectNaNValue() { var nanQuantity = CoefficientOfThermalExpansion.FromInverseKelvin(double.NaN); Assert.True(double.IsNaN(nanQuantity.Value)); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(CoefficientOfThermalExpansion.FromInverseKelvin(1), -1, ComparisonType.Relative)); }
public void FromInverseKelvin_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.NegativeInfinity)); }
public void EqualsReturnsFalseOnTypeMismatch() { CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.False(inversekelvin.Equals(new object())); }
public void FromInverseKelvin_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => CoefficientOfThermalExpansion.FromInverseKelvin(double.NaN)); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void ToUnit_WithNullUnitSystem_ThrowsNullException() { var inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.Throws <ArgumentNullException>(() => inversekelvin.ToUnit(null)); }
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = CoefficientOfThermalExpansion.FromInverseKelvin(1).ToBaseUnit(); Assert.Equal(CoefficientOfThermalExpansion.BaseUnit, quantityInBaseUnit.Unit); }
public void Convert_ToString_EqualsToString() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
public void ArithmeticOperators() { CoefficientOfThermalExpansion v = CoefficientOfThermalExpansion.FromInverseKelvin(1); AssertEx.EqualTolerance(-1, -v.InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(2, (CoefficientOfThermalExpansion.FromInverseKelvin(3) - v).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(2, (v + v).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(10, (v * 10).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(10, (10 * v).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(2, (CoefficientOfThermalExpansion.FromInverseKelvin(10) / 5).InverseKelvin, InverseKelvinTolerance); AssertEx.EqualTolerance(2, CoefficientOfThermalExpansion.FromInverseKelvin(10) / CoefficientOfThermalExpansion.FromInverseKelvin(5), InverseKelvinTolerance); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(CoefficientOfThermalExpansion))); }
public void CompareToThrowsOnTypeMismatch() { CoefficientOfThermalExpansion inversekelvin = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.Throws <ArgumentException>(() => inversekelvin.CompareTo(new object())); }
public void Convert_ChangeType_QuantityType_EqualsQuantityType() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); Assert.Equal(QuantityType.CoefficientOfThermalExpansion, Convert.ChangeType(quantity, typeof(QuantityType))); }
public void Equals_RelativeTolerance_IsImplemented() { var v = CoefficientOfThermalExpansion.FromInverseKelvin(1); Assert.True(v.Equals(CoefficientOfThermalExpansion.FromInverseKelvin(1), InverseKelvinTolerance, ComparisonType.Relative)); Assert.False(v.Equals(CoefficientOfThermalExpansion.Zero, InverseKelvinTolerance, ComparisonType.Relative)); }