public void FromAmperesPerMeter_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); }
public void As() { var amperepermeter = Magnetization.FromAmperesPerMeter(1); AssertEx.EqualTolerance(AmperesPerMeterInOneAmperePerMeter, amperepermeter.As(MagnetizationUnit.AmperePerMeter), AmperesPerMeterTolerance); }
public void CompareToThrowsOnTypeMismatch() { Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.Throws <ArgumentException>(() => amperepermeter.CompareTo(new object())); }
/// <inheritdoc cref="Magnetization.FromAmperesPerMeter(double)"/> public static Magnetization AmperesPerMeter(this decimal value) => Magnetization.FromAmperesPerMeter(Convert.ToDouble(value));
public void EqualsReturnsFalseOnTypeMismatch() { Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.False(amperepermeter.Equals(new object())); }
public void GetHashCode_Equals() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal(new { Magnetization.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
/// <inheritdoc cref="Magnetization.FromAmperesPerMeter(double)"/> public static Magnetization AmperesPerMeter(this double value) => Magnetization.FromAmperesPerMeter(value);
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void Convert_ToDecimal_EqualsValueAsSameType() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = Magnetization.FromAmperesPerMeter(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(Magnetization.FromAmperesPerMeter(1), -1, ComparisonType.Relative)); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = Magnetization.FromAmperesPerMeter(1).ToBaseUnit(); Assert.Equal(Magnetization.BaseUnit, quantityInBaseUnit.Unit); }
public void FromAmperesPerMeter_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Magnetization.FromAmperesPerMeter(double.NaN)); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal(Magnetization.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void Convert_ToInt16_EqualsValueAsSameType() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity)); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void Convert_ToSingle_EqualsValueAsSameType() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { var quantity = Magnetization.FromAmperesPerMeter(value); Assert.Equal(Magnetization.FromAmperesPerMeter(-value), -quantity); }
public void Convert_ToString_EqualsToString() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
/// <inheritdoc cref="Magnetization.FromAmperesPerMeter(double?)"/> public static Magnetization?AmperesPerMeter(this float?value) => Magnetization.FromAmperesPerMeter(value);
public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
/// <inheritdoc cref="Magnetization.FromAmperesPerMeter(double?)"/> public static Magnetization?AmperesPerMeter(this decimal?value) => Magnetization.FromAmperesPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value));
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(Magnetization))); }
public void EqualsReturnsFalseOnNull() { Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.False(amperepermeter.Equals(null)); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(MagnetizationUnit))); }
public void ConversionRoundTrip() { Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); AssertEx.EqualTolerance(1, Magnetization.FromAmperesPerMeter(amperepermeter.AmperesPerMeter).AmperesPerMeter, AmperesPerMeterTolerance); }
public void Convert_ChangeType_QuantityType_EqualsQuantityType() { var quantity = Magnetization.FromAmperesPerMeter(1.0); Assert.Equal(QuantityType.Magnetization, Convert.ChangeType(quantity, typeof(QuantityType))); }
public void CompareToThrowsOnNull() { Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.Throws <ArgumentNullException>(() => amperepermeter.CompareTo(null)); }
public void ToUnit_WithNullUnitSystem_ThrowsNullException() { var amperepermeter = Magnetization.FromAmperesPerMeter(1); Assert.Throws <ArgumentNullException>(() => amperepermeter.ToUnit(null)); }