/// <inheritdoc cref="ElectricCurrent.FromAmperes(double)"/> public static ElectricCurrent Amperes(this double value) => ElectricCurrent.FromAmperes(value);
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void Convert_ToInt64_EqualsValueAsSameType() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal((long)quantity.Value, Convert.ToInt64(quantity)); }
public void EqualsReturnsFalseOnTypeMismatch() { ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.False(ampere.Equals(new object())); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = ElectricCurrent.FromAmperes(1).ToBaseUnit(); Assert.Equal(ElectricCurrent.BaseUnit, quantityInBaseUnit.Unit); }
public void CompareToThrowsOnNull() { ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.Throws <ArgumentNullException>(() => ampere.CompareTo(null)); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(ElectricCurrent))); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(ElectricCurrentUnit))); }
public void Convert_ToString_EqualsToString() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
public void Convert_ToUInt32_EqualsValueAsSameType() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal((uint)quantity.Value, Convert.ToUInt32(quantity)); }
/// <inheritdoc cref="ElectricCurrent.FromAmperes(double?)"/> public static ElectricCurrent?Amperes(this decimal?value) => ElectricCurrent.FromAmperes(value == null ? (double?)null : Convert.ToDouble(value.Value));
/// <inheritdoc cref="ElectricCurrent.FromAmperes(double)"/> public static ElectricCurrent Amperes(this decimal value) => ElectricCurrent.FromAmperes(Convert.ToDouble(value));
/// <inheritdoc cref="ElectricCurrent.FromAmperes(double?)"/> public static ElectricCurrent?Amperes(this float?value) => ElectricCurrent.FromAmperes(value);
public void FromAmperes_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => ElectricCurrent.FromAmperes(double.NaN)); }
public void Convert_ChangeType_QuantityType_EqualsQuantityType() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(QuantityType.ElectricCurrent, Convert.ChangeType(quantity, typeof(QuantityType))); }
public void ElectricResistanceTimesElectricCurrentEqualsElectricPotential(float resistance, float current, float expected) { ElectricPotential potential = ElectricResistance.FromOhms(resistance) * ElectricCurrent.FromAmperes(current); Assert.Equal(expected, potential.Volts); }
public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(ElectricCurrent.Info, Convert.ChangeType(quantity, typeof(QuantityInfo))); }
public void CompareToThrowsOnTypeMismatch() { ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.Throws <ArgumentException>(() => ampere.CompareTo(new object())); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(ElectricCurrent.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = ElectricCurrent.FromAmperes(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(ElectricCurrent.FromAmperes(1), -1, ComparisonType.Relative)); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void EqualsReturnsFalseOnNull() { ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); Assert.False(ampere.Equals(null)); }
public void GetHashCode_Equals() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(new { ElectricCurrent.Info.Name, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { var quantity = ElectricCurrent.FromAmperes(value); Assert.Equal(ElectricCurrent.FromAmperes(-value), -quantity); }
public void Convert_ToDecimal_EqualsValueAsSameType() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); }
public void FromAmperes_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); }
public void Convert_ToSByte_EqualsValueAsSameType() { var quantity = ElectricCurrent.FromAmperes(1.0); Assert.Equal((sbyte)quantity.Value, Convert.ToSByte(quantity)); }
/// <inheritdoc cref="ElectricCurrent.FromAmperes(UnitsNet.QuantityValue)" /> public static ElectricCurrent Amperes <T>(this T value) => ElectricCurrent.FromAmperes(Convert.ToDouble(value));