public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void CompareToThrowsOnNull() { ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.Throws <ArgumentNullException>(() => voltpermeter.CompareTo(null)); }
public void EqualsReturnsFalseOnTypeMismatch() { ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.False(voltpermeter.Equals(new object())); }
public void ToUnit_WithNullUnitSystem_ThrowsNullException() { var voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.Throws <ArgumentNullException>(() => voltpermeter.ToUnit(null)); }
public void ConversionRoundTrip() { ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); AssertEx.EqualTolerance(1, ElectricField.FromVoltsPerMeter(voltpermeter.VoltsPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); }
public void GetHashCode_Equals() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal(new { ElectricField.Info.Name, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { var quantity = ElectricField.FromVoltsPerMeter(value); Assert.Equal(ElectricField.FromVoltsPerMeter(-value), -quantity); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal(ElectricField.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal(ElectricField.Info, Convert.ChangeType(quantity, typeof(QuantityInfo))); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(ElectricFieldUnit))); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(ElectricField))); }
public void FromVoltsPerMeter_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => ElectricField.FromVoltsPerMeter(double.NaN)); }
public void NumberToVoltsPerMeterTest() => Assert.Equal(ElectricField.FromVoltsPerMeter(2), 2.VoltsPerMeter());
public void As() { var voltpermeter = ElectricField.FromVoltsPerMeter(1); AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, voltpermeter.As(ElectricFieldUnit.VoltPerMeter), VoltsPerMeterTolerance); }
/// <inheritdoc cref="ElectricField.FromVoltsPerMeter(double)"/> public static ElectricField VoltsPerMeter(this double value) => ElectricField.FromVoltsPerMeter(value);
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = ElectricField.FromVoltsPerMeter(1).ToBaseUnit(); Assert.Equal(ElectricField.BaseUnit, quantityInBaseUnit.Unit); }
/// <inheritdoc cref="ElectricField.FromVoltsPerMeter(double?)"/> public static ElectricField?VoltsPerMeter(this float?value) => ElectricField.FromVoltsPerMeter(value);
public void CompareToThrowsOnTypeMismatch() { ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.Throws <ArgumentException>(() => voltpermeter.CompareTo(new object())); }
/// <inheritdoc cref="ElectricField.FromVoltsPerMeter(double)"/> public static ElectricField VoltsPerMeter(this decimal value) => ElectricField.FromVoltsPerMeter(Convert.ToDouble(value));
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = ElectricField.FromVoltsPerMeter(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(ElectricField.FromVoltsPerMeter(1), -1, ComparisonType.Relative)); }
/// <inheritdoc cref="ElectricField.FromVoltsPerMeter(double?)"/> public static ElectricField?VoltsPerMeter(this decimal?value) => ElectricField.FromVoltsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value));
public void EqualsReturnsFalseOnNull() { ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); Assert.False(voltpermeter.Equals(null)); }
public void VoltPerMeterToElectricFieldUnits() { ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, voltpermeter.VoltsPerMeter, VoltsPerMeterTolerance); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void FromVoltsPerMeter_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); }
public void Convert_ToDecimal_EqualsValueAsSameType() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); }
public void Convert_ToString_EqualsToString() { var quantity = ElectricField.FromVoltsPerMeter(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }