/// <inheritdoc cref="HeatFlux.FromWattsPerSquareMeter(UnitsNet.QuantityValue)" /> public static HeatFlux?WattsPerSquareMeter(this decimal?value) => HeatFlux.FromWattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value));
public void CompareToThrowsOnTypeMismatch() { HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.Throws <ArgumentException>(() => wattpersquaremeter.CompareTo(new object())); }
public void EqualsReturnsFalseOnTypeMismatch() { HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.False(wattpersquaremeter.Equals(new object())); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal(HeatFlux.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void GetHashCode_Equals() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal(new { HeatFlux.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode()); }
public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(HeatFluxUnit))); }
public void PowerDividedByHeatFluxEqualsArea() { Area area = Power.FromWatts(12) / HeatFlux.FromWattsPerSquareMeter(3); Assert.Equal(area, Area.FromSquareMeters(4)); }
public void ToUnit() { var wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); var btuperhoursquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerHourSquareFoot); AssertEx.EqualTolerance(BtusPerHourSquareFootInOneWattPerSquareMeter, (decimal)btuperhoursquarefootQuantity.Value, BtusPerHourSquareFootTolerance); Assert.Equal(HeatFluxUnit.BtuPerHourSquareFoot, btuperhoursquarefootQuantity.Unit); var btuperminutesquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerMinuteSquareFoot); AssertEx.EqualTolerance(BtusPerMinuteSquareFootInOneWattPerSquareMeter, (decimal)btuperminutesquarefootQuantity.Value, BtusPerMinuteSquareFootTolerance); Assert.Equal(HeatFluxUnit.BtuPerMinuteSquareFoot, btuperminutesquarefootQuantity.Unit); var btupersecondsquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerSecondSquareFoot); AssertEx.EqualTolerance(BtusPerSecondSquareFootInOneWattPerSquareMeter, (decimal)btupersecondsquarefootQuantity.Value, BtusPerSecondSquareFootTolerance); Assert.Equal(HeatFluxUnit.BtuPerSecondSquareFoot, btupersecondsquarefootQuantity.Unit); var btupersecondsquareinchQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerSecondSquareInch); AssertEx.EqualTolerance(BtusPerSecondSquareInchInOneWattPerSquareMeter, (decimal)btupersecondsquareinchQuantity.Value, BtusPerSecondSquareInchTolerance); Assert.Equal(HeatFluxUnit.BtuPerSecondSquareInch, btupersecondsquareinchQuantity.Unit); var caloriepersecondsquarecentimeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.CaloriePerSecondSquareCentimeter); AssertEx.EqualTolerance(CaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, (decimal)caloriepersecondsquarecentimeterQuantity.Value, CaloriesPerSecondSquareCentimeterTolerance); Assert.Equal(HeatFluxUnit.CaloriePerSecondSquareCentimeter, caloriepersecondsquarecentimeterQuantity.Unit); var centiwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.CentiwattPerSquareMeter); AssertEx.EqualTolerance(CentiwattsPerSquareMeterInOneWattPerSquareMeter, (decimal)centiwattpersquaremeterQuantity.Value, CentiwattsPerSquareMeterTolerance); Assert.Equal(HeatFluxUnit.CentiwattPerSquareMeter, centiwattpersquaremeterQuantity.Unit); var deciwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.DeciwattPerSquareMeter); AssertEx.EqualTolerance(DeciwattsPerSquareMeterInOneWattPerSquareMeter, (decimal)deciwattpersquaremeterQuantity.Value, DeciwattsPerSquareMeterTolerance); Assert.Equal(HeatFluxUnit.DeciwattPerSquareMeter, deciwattpersquaremeterQuantity.Unit); var kilocalorieperhoursquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.KilocaloriePerHourSquareMeter); AssertEx.EqualTolerance(KilocaloriesPerHourSquareMeterInOneWattPerSquareMeter, (decimal)kilocalorieperhoursquaremeterQuantity.Value, KilocaloriesPerHourSquareMeterTolerance); Assert.Equal(HeatFluxUnit.KilocaloriePerHourSquareMeter, kilocalorieperhoursquaremeterQuantity.Unit); var kilocaloriepersecondsquarecentimeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); AssertEx.EqualTolerance(KilocaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, (decimal)kilocaloriepersecondsquarecentimeterQuantity.Value, KilocaloriesPerSecondSquareCentimeterTolerance); Assert.Equal(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, kilocaloriepersecondsquarecentimeterQuantity.Unit); var kilowattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.KilowattPerSquareMeter); AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, (decimal)kilowattpersquaremeterQuantity.Value, KilowattsPerSquareMeterTolerance); Assert.Equal(HeatFluxUnit.KilowattPerSquareMeter, kilowattpersquaremeterQuantity.Unit); var microwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.MicrowattPerSquareMeter); AssertEx.EqualTolerance(MicrowattsPerSquareMeterInOneWattPerSquareMeter, (decimal)microwattpersquaremeterQuantity.Value, MicrowattsPerSquareMeterTolerance); Assert.Equal(HeatFluxUnit.MicrowattPerSquareMeter, microwattpersquaremeterQuantity.Unit); var milliwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.MilliwattPerSquareMeter); AssertEx.EqualTolerance(MilliwattsPerSquareMeterInOneWattPerSquareMeter, (decimal)milliwattpersquaremeterQuantity.Value, MilliwattsPerSquareMeterTolerance); Assert.Equal(HeatFluxUnit.MilliwattPerSquareMeter, milliwattpersquaremeterQuantity.Unit); var nanowattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.NanowattPerSquareMeter); AssertEx.EqualTolerance(NanowattsPerSquareMeterInOneWattPerSquareMeter, (decimal)nanowattpersquaremeterQuantity.Value, NanowattsPerSquareMeterTolerance); Assert.Equal(HeatFluxUnit.NanowattPerSquareMeter, nanowattpersquaremeterQuantity.Unit); var poundforceperfootsecondQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.PoundForcePerFootSecond); AssertEx.EqualTolerance(PoundsForcePerFootSecondInOneWattPerSquareMeter, (decimal)poundforceperfootsecondQuantity.Value, PoundsForcePerFootSecondTolerance); Assert.Equal(HeatFluxUnit.PoundForcePerFootSecond, poundforceperfootsecondQuantity.Unit); var poundpersecondcubedQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.PoundPerSecondCubed); AssertEx.EqualTolerance(PoundsPerSecondCubedInOneWattPerSquareMeter, (decimal)poundpersecondcubedQuantity.Value, PoundsPerSecondCubedTolerance); Assert.Equal(HeatFluxUnit.PoundPerSecondCubed, poundpersecondcubedQuantity.Unit); var wattpersquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.WattPerSquareFoot); AssertEx.EqualTolerance(WattsPerSquareFootInOneWattPerSquareMeter, (decimal)wattpersquarefootQuantity.Value, WattsPerSquareFootTolerance); Assert.Equal(HeatFluxUnit.WattPerSquareFoot, wattpersquarefootQuantity.Unit); var wattpersquareinchQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.WattPerSquareInch); AssertEx.EqualTolerance(WattsPerSquareInchInOneWattPerSquareMeter, (decimal)wattpersquareinchQuantity.Value, WattsPerSquareInchTolerance); Assert.Equal(HeatFluxUnit.WattPerSquareInch, wattpersquareinchQuantity.Unit); var wattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.WattPerSquareMeter); AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, (decimal)wattpersquaremeterQuantity.Value, WattsPerSquareMeterTolerance); Assert.Equal(HeatFluxUnit.WattPerSquareMeter, wattpersquaremeterQuantity.Unit); }
public void PowerDividedByAreaEqualsHeatFlux() { HeatFlux heatFlux = Power.FromWatts(12) / Area.FromSquareMeters(3); Assert.Equal(heatFlux, HeatFlux.FromWattsPerSquareMeter(4)); }
public void HeatFluxTimesAreaEqualsPower() { Power power = HeatFlux.FromWattsPerSquareMeter(3) * Area.FromSquareMeters(4); Assert.Equal(power, Power.FromWatts(12)); }
public void FromWattsPerSquareMeter_WithNanValue_CreateQuantityAndAffectNaNValue() { var nanQuantity = HeatFlux.FromWattsPerSquareMeter(double.NaN); Assert.True(double.IsNaN(nanQuantity.Value)); }
public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); }
public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); }
public void Convert_ToSingle_EqualsValueAsSameType() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = HeatFlux.FromWattsPerSquareMeter(1).ToBaseUnit(); Assert.Equal(HeatFlux.BaseUnit, quantityInBaseUnit.Unit); }
public void Convert_ToString_EqualsToString() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = HeatFlux.FromWattsPerSquareMeter(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(HeatFlux.FromWattsPerSquareMeter(1), -1, ComparisonType.Relative)); }
public void Convert_ChangeType_SelfType_EqualsSelf() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(HeatFlux))); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void Convert_ChangeType_QuantityType_EqualsQuantityType() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal(QuantityType.HeatFlux, Convert.ChangeType(quantity, typeof(QuantityType))); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); }
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void NegationOperator_ReturnsQuantity_WithNegatedValue(decimal value) { var quantity = HeatFlux.FromWattsPerSquareMeter(value); Assert.Equal(HeatFlux.FromWattsPerSquareMeter(-value), -quantity); }
public void Convert_ToDecimal_EqualsValueAsSameType() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); }
public void CompareToThrowsOnNull() { HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.Throws <ArgumentNullException>(() => wattpersquaremeter.CompareTo(null)); }
public void Convert_ToInt32_EqualsValueAsSameType() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity)); }
public void EqualsReturnsFalseOnNull() { HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); Assert.False(wattpersquaremeter.Equals(null)); }
/// <inheritdoc cref="HeatFlux.FromWattsPerSquareMeter(UnitsNet.QuantityValue)" /> public static HeatFlux WattsPerSquareMeter(this decimal value) => HeatFlux.FromWattsPerSquareMeter(Convert.ToDouble(value));