public void FromValueAndUnit() { AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.JoulePerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.KilojoulePerMoleKelvin).KilojoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.MegajoulePerMoleKelvin).MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); }
public void Convert_ToInt16_EqualsValueAsSameType() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity)); }
public void Convert_ToString_EqualsToString() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void CompareToThrowsOnNull() { MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.Throws <ArgumentNullException>(() => joulepermolekelvin.CompareTo(null)); }
public void EqualsReturnsFalseOnTypeMismatch() { MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.False(joulepermolekelvin.Equals(new object())); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal(MolarEntropy.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(MolarEntropyUnit))); }
public void Convert_ChangeType_QuantityType_EqualsQuantityType() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal(QuantityType.MolarEntropy, Convert.ChangeType(quantity, typeof(QuantityType))); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(MolarEntropy))); }
public void FromJoulesPerMoleKelvin_WithNanValue_CreateQuantityAndAffectNaNValue() { var nanQuantity = MolarEntropy.FromJoulesPerMoleKelvin(double.NaN); Assert.True(double.IsNaN(nanQuantity.Value)); }
public static MolarEntropy KilojoulesPerMoleKelvin <T>(this T value) => MolarEntropy.FromKilojoulesPerMoleKelvin(Convert.ToDouble(value));
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = MolarEntropy.FromJoulesPerMoleKelvin(1).ToBaseUnit(); Assert.Equal(MolarEntropy.BaseUnit, quantityInBaseUnit.Unit); }
public void GetHashCode_Equals() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal(new { MolarEntropy.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
public void CompareToThrowsOnTypeMismatch() { MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.Throws <ArgumentException>(() => joulepermolekelvin.CompareTo(new object())); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(value); Assert.Equal(MolarEntropy.FromJoulesPerMoleKelvin(-value), -quantity); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(MolarEntropy.FromJoulesPerMoleKelvin(1), -1, ComparisonType.Relative)); }
public void Ctor_WithNaNValue_CreateQuantityAndAffectNaNValue() { var nanQuantity = new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin); Assert.True(double.IsNaN(nanQuantity.Value)); }
public void EqualsReturnsFalseOnNull() { MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.False(joulepermolekelvin.Equals(null)); }
public static MolarEntropy MegajoulesPerMoleKelvin <T>(this T value) => MolarEntropy.FromMegajoulesPerMoleKelvin(Convert.ToDecimal(value));
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void FromJoulesPerMoleKelvin_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); }
public void Convert_ToDecimal_EqualsValueAsSameType() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); }
public void FromJoulesPerMoleKelvin_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); }
public void Convert_ToSingle_EqualsValueAsSameType() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); }
public void ToUnit_WithNullUnitSystem_ThrowsNullException() { var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); Assert.Throws <ArgumentNullException>(() => joulepermolekelvin.ToUnit(null)); }
public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
public static MolarEntropy?MegajoulesPerMoleKelvin <T>(this T?value) where T : struct => MolarEntropy.FromMegajoulesPerMoleKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value));