public void Convert_ToString_EqualsToString() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void Convert_ToInt64_EqualsValueAsSameType() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal((long)quantity.Value, Convert.ToInt64(quantity)); }
public void EqualsReturnsFalseOnTypeMismatch() { Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.False(henrypermeter.Equals(new object())); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void ConversionRoundTrip() { Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); AssertEx.EqualTolerance(1, Permeability.FromHenriesPerMeter(henrypermeter.HenriesPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); }
public void CompareToThrowsOnNull() { Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.Throws <ArgumentNullException>(() => henrypermeter.CompareTo(null)); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void GetHashCode_Equals() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal(new { Permeability.Info.Name, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal(Permeability.Info, Convert.ChangeType(quantity, typeof(QuantityInfo))); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal(Permeability.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(PermeabilityUnit))); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(Permeability))); }
public void Convert_ToUInt32_EqualsValueAsSameType() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal((uint)quantity.Value, Convert.ToUInt32(quantity)); }
public void As() { var henrypermeter = Permeability.FromHenriesPerMeter(1); AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.As(PermeabilityUnit.HenryPerMeter), HenriesPerMeterTolerance); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { var quantity = Permeability.FromHenriesPerMeter(value); Assert.Equal(Permeability.FromHenriesPerMeter(-value), -quantity); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = Permeability.FromHenriesPerMeter(1).ToBaseUnit(); Assert.Equal(Permeability.BaseUnit, quantityInBaseUnit.Unit); }
public void NumberToHenriesPerMeterTest() => Assert.Equal(Permeability.FromHenriesPerMeter(2), 2.HenriesPerMeter());
public void CompareToThrowsOnTypeMismatch() { Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.Throws <ArgumentException>(() => henrypermeter.CompareTo(new object())); }
public void FromValueAndUnit() { AssertEx.EqualTolerance(1, Permeability.From(1, PermeabilityUnit.HenryPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = Permeability.FromHenriesPerMeter(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(Permeability.FromHenriesPerMeter(1), -1, ComparisonType.Relative)); }
/// <inheritdoc cref="Permeability.FromHenriesPerMeter(UnitsNet.QuantityValue)" /> public static Permeability HenriesPerMeter <T>(this T value) => Permeability.FromHenriesPerMeter(Convert.ToDouble(value));
public void EqualsReturnsFalseOnNull() { Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.False(henrypermeter.Equals(null)); }
public void HenryPerMeterToPermeabilityUnits() { Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.HenriesPerMeter, HenriesPerMeterTolerance); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void FromHenriesPerMeter_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); }
public void Convert_ToDecimal_EqualsValueAsSameType() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); }
public void FromHenriesPerMeter_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Permeability.FromHenriesPerMeter(double.NaN)); }
public void Convert_ToSByte_EqualsValueAsSameType() { var quantity = Permeability.FromHenriesPerMeter(1.0); Assert.Equal((sbyte)quantity.Value, Convert.ToSByte(quantity)); }
public void ToUnit_WithNullUnitSystem_ThrowsNullException() { var henrypermeter = Permeability.FromHenriesPerMeter(1); Assert.Throws <ArgumentNullException>(() => henrypermeter.ToUnit(null)); }