public void Convert_ToSingle_EqualsValueAsSameType() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); }
public void EqualsReturnsFalseOnNull() { MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.False(joulepermole.Equals(null)); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void CompareToThrowsOnTypeMismatch() { MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.Throws <ArgumentException>(() => joulepermole.CompareTo(new object())); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = MolarEnergy.FromJoulesPerMole(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(MolarEnergy.FromJoulesPerMole(1), -1, ComparisonType.Relative)); }
/// <inheritdoc cref="MolarEnergy.FromKilojoulesPerMole(double?)"/> public static MolarEnergy?KilojoulesPerMole(this double?value) => MolarEnergy.FromKilojoulesPerMole(value);
public void FromJoulesPerMole_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => MolarEnergy.FromJoulesPerMole(double.NaN)); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal(MolarEnergy.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(MolarEnergyUnit))); }
public void Convert_ChangeType_QuantityType_EqualsQuantityType() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal(QuantityType.MolarEnergy, Convert.ChangeType(quantity, typeof(QuantityType))); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(MolarEnergy))); }
public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
public void Convert_ToString_EqualsToString() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
/// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double?)"/> public static MolarEnergy?JoulesPerMole(this decimal?value) => MolarEnergy.FromJoulesPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value));
public void GetHashCode_Equals() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal(new { MolarEnergy.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
/// <inheritdoc cref="MolarEnergy.FromKilojoulesPerMole(double)"/> public static MolarEnergy KilojoulesPerMole(this long value) => MolarEnergy.FromKilojoulesPerMole(value);
public void NegationOperator_ReturnsQuantity_WithNegatedValue(decimal value) { var quantity = MolarEnergy.FromJoulesPerMole(value); Assert.Equal(MolarEnergy.FromJoulesPerMole(-value), -quantity); }
public void FromJoulesPerMole_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); }
/// <inheritdoc cref="MolarEnergy.FromMegajoulesPerMole(double?)"/> public static MolarEnergy?MegajoulesPerMole(this double?value) => MolarEnergy.FromMegajoulesPerMole(value);
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = MolarEnergy.FromJoulesPerMole(1).ToBaseUnit(); Assert.Equal(MolarEnergy.BaseUnit, quantityInBaseUnit.Unit); }
/// <inheritdoc cref="MolarEnergy.FromMegajoulesPerMole(double)"/> public static MolarEnergy MegajoulesPerMole(this float value) => MolarEnergy.FromMegajoulesPerMole(value);
public void CompareToThrowsOnNull() { MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.Throws <ArgumentNullException>(() => joulepermole.CompareTo(null)); }
/// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double)"/> public static MolarEnergy JoulesPerMole(this double value) => MolarEnergy.FromJoulesPerMole(value);
public void EqualsReturnsFalseOnTypeMismatch() { MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); Assert.False(joulepermole.Equals(new object())); }
/// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double?)"/> public static MolarEnergy?JoulesPerMole(this float?value) => MolarEnergy.FromJoulesPerMole(value);
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
/// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double)"/> public static MolarEnergy JoulesPerMole(this decimal value) => MolarEnergy.FromJoulesPerMole(Convert.ToDouble(value));
public void Convert_ToBool_ThrowsInvalidCastException() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToBoolean(quantity)); }
public void Convert_ToInt32_EqualsValueAsSameType() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity)); }