/// <inheritdoc cref="Capacitance.FromFarads(double?)"/> public static Capacitance?Farads(this decimal?value) => Capacitance.FromFarads(value == null ? (double?)null : Convert.ToDouble(value.Value));
public void Convert_ChangeType_QuantityType_EqualsQuantityType() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(QuantityType.Capacitance, Convert.ChangeType(quantity, typeof(QuantityType))); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = Capacitance.FromFarads(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void Convert_ToString_EqualsToString() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(Capacitance))); }
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = Capacitance.FromFarads(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void Convert_ToInt32_EqualsValueAsSameType() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity)); }
public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(Capacitance.Info, Convert.ChangeType(quantity, typeof(QuantityInfo))); }
public void FromFarads_WithNanValue_CreateQuantityAndAffectNaNValue() { var nanQuantity = Capacitance.FromFarads(double.NaN); Assert.True(double.IsNaN(nanQuantity.Value)); }
public void FromFarads_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Capacitance.FromFarads(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => Capacitance.FromFarads(double.NegativeInfinity)); }
public void FromFarads_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Capacitance.FromFarads(double.NaN)); }
public void ConversionRoundTrip() { Capacitance farad = Capacitance.FromFarads(1); AssertEx.EqualTolerance(1, Capacitance.FromFarads(farad.Farads).Farads, FaradsTolerance); }
public void As() { var farad = Capacitance.FromFarads(1); AssertEx.EqualTolerance(FaradsInOneFarad, farad.As(CapacitanceUnit.Farad), FaradsTolerance); }
public void FaradToCapacitanceUnits() { Capacitance farad = Capacitance.FromFarads(1); AssertEx.EqualTolerance(FaradsInOneFarad, farad.Farads, FaradsTolerance); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = Capacitance.FromFarads(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { var quantity = Capacitance.FromFarads(value); Assert.Equal(Capacitance.FromFarads(-value), -quantity); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = Capacitance.FromFarads(1).ToBaseUnit(); Assert.Equal(Capacitance.BaseUnit, quantityInBaseUnit.Unit); }
public void Convert_ToDecimal_EqualsValueAsSameType() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); }
public void CompareToThrowsOnTypeMismatch() { Capacitance farad = Capacitance.FromFarads(1); Assert.Throws <ArgumentException>(() => farad.CompareTo(new object())); }
public void Convert_ToSingle_EqualsValueAsSameType() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); }
public void CompareToThrowsOnNull() { Capacitance farad = Capacitance.FromFarads(1); Assert.Throws <ArgumentNullException>(() => farad.CompareTo(null)); }
public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = Capacitance.FromFarads(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(Capacitance.FromFarads(1), -1, ComparisonType.Relative)); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(CapacitanceUnit))); }
public void EqualsReturnsFalseOnTypeMismatch() { Capacitance farad = Capacitance.FromFarads(1); Assert.False(farad.Equals(new object())); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(Capacitance.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void EqualsReturnsFalseOnNull() { Capacitance farad = Capacitance.FromFarads(1); Assert.False(farad.Equals(null)); }
public void GetHashCode_Equals() { var quantity = Capacitance.FromFarads(1.0); Assert.Equal(new { Capacitance.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
/// <inheritdoc cref="Capacitance.FromFarads(double)"/> public static Capacitance Farads(this decimal value) => Capacitance.FromFarads(Convert.ToDouble(value));