diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 93d9ed5461..532ba6ddba 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Acceleration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Acceleration() if(unit == AccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -204,6 +206,7 @@ public static BaseDimensions BaseDimensions /// /// Get Acceleration from CentimetersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromCentimetersPerSecondSquared(double centimeterspersecondsquared) @@ -218,6 +221,7 @@ public static Acceleration FromCentimetersPerSecondSquared(QuantityValue centime /// /// Get Acceleration from DecimetersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromDecimetersPerSecondSquared(double decimeterspersecondsquared) @@ -232,6 +236,7 @@ public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimete /// /// Get Acceleration from FeetPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromFeetPerSecondSquared(double feetpersecondsquared) @@ -246,6 +251,7 @@ public static Acceleration FromFeetPerSecondSquared(QuantityValue feetperseconds /// /// Get Acceleration from InchesPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromInchesPerSecondSquared(double inchespersecondsquared) @@ -260,6 +266,7 @@ public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersec /// /// Get Acceleration from KilometersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKilometersPerSecondSquared(double kilometerspersecondsquared) @@ -274,6 +281,7 @@ public static Acceleration FromKilometersPerSecondSquared(QuantityValue kilomete /// /// Get Acceleration from KnotsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerHour(double knotsperhour) @@ -288,6 +296,7 @@ public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) /// /// Get Acceleration from KnotsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerMinute(double knotsperminute) @@ -302,6 +311,7 @@ public static Acceleration FromKnotsPerMinute(QuantityValue knotsperminute) /// /// Get Acceleration from KnotsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerSecond(double knotspersecond) @@ -316,6 +326,7 @@ public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) /// /// Get Acceleration from MetersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromMetersPerSecondSquared(double meterspersecondsquared) @@ -330,6 +341,7 @@ public static Acceleration FromMetersPerSecondSquared(QuantityValue meterspersec /// /// Get Acceleration from MicrometersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromMicrometersPerSecondSquared(double micrometerspersecondsquared) @@ -344,6 +356,7 @@ public static Acceleration FromMicrometersPerSecondSquared(QuantityValue microme /// /// Get Acceleration from MillimetersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromMillimetersPerSecondSquared(double millimeterspersecondsquared) @@ -358,6 +371,7 @@ public static Acceleration FromMillimetersPerSecondSquared(QuantityValue millime /// /// Get Acceleration from NanometersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromNanometersPerSecondSquared(double nanometerspersecondsquared) @@ -372,6 +386,7 @@ public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanomete /// /// Get Acceleration from StandardGravity. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromStandardGravity(double standardgravity) diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 25a934310e..f457b97678 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static AmountOfSubstance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static AmountOfSubstance() if(unit == AmountOfSubstanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -209,6 +211,7 @@ public static BaseDimensions BaseDimensions /// /// Get AmountOfSubstance from Centimoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromCentimoles(double centimoles) @@ -223,6 +226,7 @@ public static AmountOfSubstance FromCentimoles(QuantityValue centimoles) /// /// Get AmountOfSubstance from CentipoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromCentipoundMoles(double centipoundmoles) @@ -237,6 +241,7 @@ public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmole /// /// Get AmountOfSubstance from Decimoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromDecimoles(double decimoles) @@ -251,6 +256,7 @@ public static AmountOfSubstance FromDecimoles(QuantityValue decimoles) /// /// Get AmountOfSubstance from DecipoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromDecipoundMoles(double decipoundmoles) @@ -265,6 +271,7 @@ public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) /// /// Get AmountOfSubstance from Kilomoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromKilomoles(double kilomoles) @@ -279,6 +286,7 @@ public static AmountOfSubstance FromKilomoles(QuantityValue kilomoles) /// /// Get AmountOfSubstance from KilopoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromKilopoundMoles(double kilopoundmoles) @@ -293,6 +301,7 @@ public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) /// /// Get AmountOfSubstance from Micromoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMicromoles(double micromoles) @@ -307,6 +316,7 @@ public static AmountOfSubstance FromMicromoles(QuantityValue micromoles) /// /// Get AmountOfSubstance from MicropoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMicropoundMoles(double micropoundmoles) @@ -321,6 +331,7 @@ public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmole /// /// Get AmountOfSubstance from Millimoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMillimoles(double millimoles) @@ -335,6 +346,7 @@ public static AmountOfSubstance FromMillimoles(QuantityValue millimoles) /// /// Get AmountOfSubstance from MillipoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMillipoundMoles(double millipoundmoles) @@ -349,6 +361,7 @@ public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmole /// /// Get AmountOfSubstance from Moles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMoles(double moles) @@ -363,6 +376,7 @@ public static AmountOfSubstance FromMoles(QuantityValue moles) /// /// Get AmountOfSubstance from Nanomoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromNanomoles(double nanomoles) @@ -377,6 +391,7 @@ public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) /// /// Get AmountOfSubstance from NanopoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromNanopoundMoles(double nanopoundmoles) @@ -391,6 +406,7 @@ public static AmountOfSubstance FromNanopoundMoles(QuantityValue nanopoundmoles) /// /// Get AmountOfSubstance from PoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromPoundMoles(double poundmoles) diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 2a923e3bf9..e2404063fc 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static AmplitudeRatio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static AmplitudeRatio() if(unit == AmplitudeRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -158,6 +160,7 @@ public static BaseDimensions BaseDimensions /// /// Get AmplitudeRatio from DecibelMicrovolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelMicrovolts(double decibelmicrovolts) @@ -172,6 +175,7 @@ public static AmplitudeRatio FromDecibelMicrovolts(QuantityValue decibelmicrovol /// /// Get AmplitudeRatio from DecibelMillivolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelMillivolts(double decibelmillivolts) @@ -186,6 +190,7 @@ public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivol /// /// Get AmplitudeRatio from DecibelsUnloaded. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelsUnloaded(double decibelsunloaded) @@ -200,6 +205,7 @@ public static AmplitudeRatio FromDecibelsUnloaded(QuantityValue decibelsunloaded /// /// Get AmplitudeRatio from DecibelVolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelVolts(double decibelvolts) diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 5cf37f370d..47bedaa99c 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Angle() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static Angle() if(unit == AngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -208,6 +210,7 @@ public static BaseDimensions BaseDimensions /// /// Get Angle from Arcminutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromArcminutes(double arcminutes) @@ -222,6 +225,7 @@ public static Angle FromArcminutes(QuantityValue arcminutes) /// /// Get Angle from Arcseconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromArcseconds(double arcseconds) @@ -236,6 +240,7 @@ public static Angle FromArcseconds(QuantityValue arcseconds) /// /// Get Angle from Centiradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromCentiradians(double centiradians) @@ -250,6 +255,7 @@ public static Angle FromCentiradians(QuantityValue centiradians) /// /// Get Angle from Deciradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromDeciradians(double deciradians) @@ -264,6 +270,7 @@ public static Angle FromDeciradians(QuantityValue deciradians) /// /// Get Angle from Degrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromDegrees(double degrees) @@ -278,6 +285,7 @@ public static Angle FromDegrees(QuantityValue degrees) /// /// Get Angle from Gradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromGradians(double gradians) @@ -292,6 +300,7 @@ public static Angle FromGradians(QuantityValue gradians) /// /// Get Angle from Microdegrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMicrodegrees(double microdegrees) @@ -306,6 +315,7 @@ public static Angle FromMicrodegrees(QuantityValue microdegrees) /// /// Get Angle from Microradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMicroradians(double microradians) @@ -320,6 +330,7 @@ public static Angle FromMicroradians(QuantityValue microradians) /// /// Get Angle from Millidegrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMillidegrees(double millidegrees) @@ -334,6 +345,7 @@ public static Angle FromMillidegrees(QuantityValue millidegrees) /// /// Get Angle from Milliradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMilliradians(double milliradians) @@ -348,6 +360,7 @@ public static Angle FromMilliradians(QuantityValue milliradians) /// /// Get Angle from Nanodegrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromNanodegrees(double nanodegrees) @@ -362,6 +375,7 @@ public static Angle FromNanodegrees(QuantityValue nanodegrees) /// /// Get Angle from Nanoradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromNanoradians(double nanoradians) @@ -376,6 +390,7 @@ public static Angle FromNanoradians(QuantityValue nanoradians) /// /// Get Angle from Radians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromRadians(double radians) @@ -390,6 +405,7 @@ public static Angle FromRadians(QuantityValue radians) /// /// Get Angle from Revolutions. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromRevolutions(double revolutions) diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 57c4f21f3c..9d1b65e372 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ApparentEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ApparentEnergy() if(unit == ApparentEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get ApparentEnergy from KilovoltampereHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentEnergy FromKilovoltampereHours(double kilovoltamperehours) @@ -168,6 +171,7 @@ public static ApparentEnergy FromKilovoltampereHours(QuantityValue kilovoltamper /// /// Get ApparentEnergy from MegavoltampereHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentEnergy FromMegavoltampereHours(double megavoltamperehours) @@ -182,6 +186,7 @@ public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamper /// /// Get ApparentEnergy from VoltampereHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentEnergy FromVoltampereHours(double voltamperehours) diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 2c0e3e803e..1e36aa827f 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ApparentPower() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ApparentPower() if(unit == ApparentPowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -159,6 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ApparentPower from Gigavoltamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromGigavoltamperes(double gigavoltamperes) @@ -173,6 +176,7 @@ public static ApparentPower FromGigavoltamperes(QuantityValue gigavoltamperes) /// /// Get ApparentPower from Kilovoltamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromKilovoltamperes(double kilovoltamperes) @@ -187,6 +191,7 @@ public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) /// /// Get ApparentPower from Megavoltamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromMegavoltamperes(double megavoltamperes) @@ -201,6 +206,7 @@ public static ApparentPower FromMegavoltamperes(QuantityValue megavoltamperes) /// /// Get ApparentPower from Voltamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromVoltamperes(double voltamperes) diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 4e8d498356..47414cbe3a 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Area() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Area() if(unit == AreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -204,6 +206,7 @@ public static BaseDimensions BaseDimensions /// /// Get Area from Acres. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromAcres(double acres) @@ -218,6 +221,7 @@ public static Area FromAcres(QuantityValue acres) /// /// Get Area from Hectares. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromHectares(double hectares) @@ -232,6 +236,7 @@ public static Area FromHectares(QuantityValue hectares) /// /// Get Area from SquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareCentimeters(double squarecentimeters) @@ -246,6 +251,7 @@ public static Area FromSquareCentimeters(QuantityValue squarecentimeters) /// /// Get Area from SquareDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareDecimeters(double squaredecimeters) @@ -260,6 +266,7 @@ public static Area FromSquareDecimeters(QuantityValue squaredecimeters) /// /// Get Area from SquareFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareFeet(double squarefeet) @@ -274,6 +281,7 @@ public static Area FromSquareFeet(QuantityValue squarefeet) /// /// Get Area from SquareInches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareInches(double squareinches) @@ -288,6 +296,7 @@ public static Area FromSquareInches(QuantityValue squareinches) /// /// Get Area from SquareKilometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareKilometers(double squarekilometers) @@ -302,6 +311,7 @@ public static Area FromSquareKilometers(QuantityValue squarekilometers) /// /// Get Area from SquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMeters(double squaremeters) @@ -316,6 +326,7 @@ public static Area FromSquareMeters(QuantityValue squaremeters) /// /// Get Area from SquareMicrometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMicrometers(double squaremicrometers) @@ -330,6 +341,7 @@ public static Area FromSquareMicrometers(QuantityValue squaremicrometers) /// /// Get Area from SquareMiles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMiles(double squaremiles) @@ -344,6 +356,7 @@ public static Area FromSquareMiles(QuantityValue squaremiles) /// /// Get Area from SquareMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMillimeters(double squaremillimeters) @@ -358,6 +371,7 @@ public static Area FromSquareMillimeters(QuantityValue squaremillimeters) /// /// Get Area from SquareYards. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareYards(double squareyards) @@ -372,6 +386,7 @@ public static Area FromSquareYards(QuantityValue squareyards) /// /// Get Area from UsSurveySquareFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromUsSurveySquareFeet(double ussurveysquarefeet) diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 276b89294b..4803c6cf44 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static AreaDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static AreaDensity() if(unit == AreaDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get AreaDensity from KilogramsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaDensity FromKilogramsPerSquareMeter(double kilogramspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 060e0cb7c5..04d1cb2c9a 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static AreaMomentOfInertia() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static AreaMomentOfInertia() if(unit == AreaMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -169,6 +171,7 @@ public static BaseDimensions BaseDimensions /// /// Get AreaMomentOfInertia from CentimetersToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromCentimetersToTheFourth(double centimeterstothefourth) @@ -183,6 +186,7 @@ public static AreaMomentOfInertia FromCentimetersToTheFourth(QuantityValue centi /// /// Get AreaMomentOfInertia from DecimetersToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromDecimetersToTheFourth(double decimeterstothefourth) @@ -197,6 +201,7 @@ public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decime /// /// Get AreaMomentOfInertia from FeetToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromFeetToTheFourth(double feettothefourth) @@ -211,6 +216,7 @@ public static AreaMomentOfInertia FromFeetToTheFourth(QuantityValue feettothefou /// /// Get AreaMomentOfInertia from InchesToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromInchesToTheFourth(double inchestothefourth) @@ -225,6 +231,7 @@ public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestoth /// /// Get AreaMomentOfInertia from MetersToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromMetersToTheFourth(double meterstothefourth) @@ -239,6 +246,7 @@ public static AreaMomentOfInertia FromMetersToTheFourth(QuantityValue meterstoth /// /// Get AreaMomentOfInertia from MillimetersToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromMillimetersToTheFourth(double millimeterstothefourth) diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index bb1962d612..d571141a92 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static BitRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -268,6 +270,7 @@ public static BaseDimensions BaseDimensions /// /// Get BitRate from BitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromBitsPerSecond(double bitspersecond) @@ -282,6 +285,7 @@ public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) /// /// Get BitRate from BytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromBytesPerSecond(double bytespersecond) @@ -296,6 +300,7 @@ public static BitRate FromBytesPerSecond(QuantityValue bytespersecond) /// /// Get BitRate from ExabitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExabitsPerSecond(double exabitspersecond) @@ -310,6 +315,7 @@ public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) /// /// Get BitRate from ExabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExabytesPerSecond(double exabytespersecond) @@ -324,6 +330,7 @@ public static BitRate FromExabytesPerSecond(QuantityValue exabytespersecond) /// /// Get BitRate from ExbibitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExbibitsPerSecond(double exbibitspersecond) @@ -338,6 +345,7 @@ public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) /// /// Get BitRate from ExbibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExbibytesPerSecond(double exbibytespersecond) @@ -352,6 +360,7 @@ public static BitRate FromExbibytesPerSecond(QuantityValue exbibytespersecond) /// /// Get BitRate from GibibitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGibibitsPerSecond(double gibibitspersecond) @@ -366,6 +375,7 @@ public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) /// /// Get BitRate from GibibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGibibytesPerSecond(double gibibytespersecond) @@ -380,6 +390,7 @@ public static BitRate FromGibibytesPerSecond(QuantityValue gibibytespersecond) /// /// Get BitRate from GigabitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGigabitsPerSecond(double gigabitspersecond) @@ -394,6 +405,7 @@ public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) /// /// Get BitRate from GigabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGigabytesPerSecond(double gigabytespersecond) @@ -408,6 +420,7 @@ public static BitRate FromGigabytesPerSecond(QuantityValue gigabytespersecond) /// /// Get BitRate from KibibitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKibibitsPerSecond(double kibibitspersecond) @@ -422,6 +435,7 @@ public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) /// /// Get BitRate from KibibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKibibytesPerSecond(double kibibytespersecond) @@ -436,6 +450,7 @@ public static BitRate FromKibibytesPerSecond(QuantityValue kibibytespersecond) /// /// Get BitRate from KilobitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKilobitsPerSecond(double kilobitspersecond) @@ -450,6 +465,7 @@ public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) /// /// Get BitRate from KilobytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKilobytesPerSecond(double kilobytespersecond) @@ -464,6 +480,7 @@ public static BitRate FromKilobytesPerSecond(QuantityValue kilobytespersecond) /// /// Get BitRate from MebibitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMebibitsPerSecond(double mebibitspersecond) @@ -478,6 +495,7 @@ public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) /// /// Get BitRate from MebibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMebibytesPerSecond(double mebibytespersecond) @@ -492,6 +510,7 @@ public static BitRate FromMebibytesPerSecond(QuantityValue mebibytespersecond) /// /// Get BitRate from MegabitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMegabitsPerSecond(double megabitspersecond) @@ -506,6 +525,7 @@ public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) /// /// Get BitRate from MegabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMegabytesPerSecond(double megabytespersecond) @@ -520,6 +540,7 @@ public static BitRate FromMegabytesPerSecond(QuantityValue megabytespersecond) /// /// Get BitRate from PebibitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPebibitsPerSecond(double pebibitspersecond) @@ -534,6 +555,7 @@ public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) /// /// Get BitRate from PebibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPebibytesPerSecond(double pebibytespersecond) @@ -548,6 +570,7 @@ public static BitRate FromPebibytesPerSecond(QuantityValue pebibytespersecond) /// /// Get BitRate from PetabitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPetabitsPerSecond(double petabitspersecond) @@ -562,6 +585,7 @@ public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) /// /// Get BitRate from PetabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPetabytesPerSecond(double petabytespersecond) @@ -576,6 +600,7 @@ public static BitRate FromPetabytesPerSecond(QuantityValue petabytespersecond) /// /// Get BitRate from TebibitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTebibitsPerSecond(double tebibitspersecond) @@ -590,6 +615,7 @@ public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) /// /// Get BitRate from TebibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTebibytesPerSecond(double tebibytespersecond) @@ -604,6 +630,7 @@ public static BitRate FromTebibytesPerSecond(QuantityValue tebibytespersecond) /// /// Get BitRate from TerabitsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTerabitsPerSecond(double terabitspersecond) @@ -618,6 +645,7 @@ public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) /// /// Get BitRate from TerabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTerabytesPerSecond(double terabytespersecond) diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index ab489620e6..25d0357c72 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static BrakeSpecificFuelConsumption() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static BrakeSpecificFuelConsumption() if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get BrakeSpecificFuelConsumption from GramsPerKiloWattHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(double gramsperkilowatthour) @@ -168,6 +171,7 @@ public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(QuantityValu /// /// Get BrakeSpecificFuelConsumption from KilogramsPerJoule. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(double kilogramsperjoule) @@ -182,6 +186,7 @@ public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue k /// /// Get BrakeSpecificFuelConsumption from PoundsPerMechanicalHorsepowerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(double poundspermechanicalhorsepowerhour) diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 40cd1c2f5d..cbe629571a 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Capacitance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Capacitance() if(unit == CapacitanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Capacitance from Farads. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Capacitance FromFarads(double farads) diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 51d3a376f5..5a3418ee6f 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Density() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Density() if(unit == DensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -329,6 +331,7 @@ public static BaseDimensions BaseDimensions /// /// Get Density from CentigramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromCentigramsPerDeciLiter(double centigramsperdeciliter) @@ -343,6 +346,7 @@ public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeci /// /// Get Density from CentigramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromCentigramsPerLiter(double centigramsperliter) @@ -357,6 +361,7 @@ public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) /// /// Get Density from CentigramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromCentigramsPerMilliliter(double centigramspermilliliter) @@ -371,6 +376,7 @@ public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermil /// /// Get Density from DecigramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerDeciLiter(double decigramsperdeciliter) @@ -385,6 +391,7 @@ public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdecili /// /// Get Density from DecigramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerLiter(double decigramsperliter) @@ -399,6 +406,7 @@ public static Density FromDecigramsPerLiter(QuantityValue decigramsperliter) /// /// Get Density from DecigramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerMilliliter(double decigramspermilliliter) @@ -413,6 +421,7 @@ public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilli /// /// Get Density from GramsPerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerCubicCentimeter(double gramspercubiccentimeter) @@ -427,6 +436,7 @@ public static Density FromGramsPerCubicCentimeter(QuantityValue gramspercubiccen /// /// Get Density from GramsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerCubicMeter(double gramspercubicmeter) @@ -441,6 +451,7 @@ public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) /// /// Get Density from GramsPerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerCubicMillimeter(double gramspercubicmillimeter) @@ -455,6 +466,7 @@ public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmil /// /// Get Density from GramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerDeciLiter(double gramsperdeciliter) @@ -469,6 +481,7 @@ public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) /// /// Get Density from GramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerLiter(double gramsperliter) @@ -483,6 +496,7 @@ public static Density FromGramsPerLiter(QuantityValue gramsperliter) /// /// Get Density from GramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerMilliliter(double gramspermilliliter) @@ -497,6 +511,7 @@ public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) /// /// Get Density from KilogramsPerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilogramsPerCubicCentimeter(double kilogramspercubiccentimeter) @@ -511,6 +526,7 @@ public static Density FromKilogramsPerCubicCentimeter(QuantityValue kilogramsper /// /// Get Density from KilogramsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilogramsPerCubicMeter(double kilogramspercubicmeter) @@ -525,6 +541,7 @@ public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubic /// /// Get Density from KilogramsPerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilogramsPerCubicMillimeter(double kilogramspercubicmillimeter) @@ -539,6 +556,7 @@ public static Density FromKilogramsPerCubicMillimeter(QuantityValue kilogramsper /// /// Get Density from KilopoundsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilopoundsPerCubicFoot(double kilopoundspercubicfoot) @@ -553,6 +571,7 @@ public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubi /// /// Get Density from KilopoundsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilopoundsPerCubicInch(double kilopoundspercubicinch) @@ -567,6 +586,7 @@ public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubi /// /// Get Density from MicrogramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerDeciLiter(double microgramsperdeciliter) @@ -581,6 +601,7 @@ public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeci /// /// Get Density from MicrogramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerLiter(double microgramsperliter) @@ -595,6 +616,7 @@ public static Density FromMicrogramsPerLiter(QuantityValue microgramsperliter) /// /// Get Density from MicrogramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerMilliliter(double microgramspermilliliter) @@ -609,6 +631,7 @@ public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermil /// /// Get Density from MilligramsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerCubicMeter(double milligramspercubicmeter) @@ -623,6 +646,7 @@ public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercub /// /// Get Density from MilligramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerDeciLiter(double milligramsperdeciliter) @@ -637,6 +661,7 @@ public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeci /// /// Get Density from MilligramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerLiter(double milligramsperliter) @@ -651,6 +676,7 @@ public static Density FromMilligramsPerLiter(QuantityValue milligramsperliter) /// /// Get Density from MilligramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerMilliliter(double milligramspermilliliter) @@ -665,6 +691,7 @@ public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermil /// /// Get Density from NanogramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromNanogramsPerDeciLiter(double nanogramsperdeciliter) @@ -679,6 +706,7 @@ public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdecili /// /// Get Density from NanogramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromNanogramsPerLiter(double nanogramsperliter) @@ -693,6 +721,7 @@ public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) /// /// Get Density from NanogramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromNanogramsPerMilliliter(double nanogramspermilliliter) @@ -707,6 +736,7 @@ public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilli /// /// Get Density from PicogramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerDeciLiter(double picogramsperdeciliter) @@ -721,6 +751,7 @@ public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdecili /// /// Get Density from PicogramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerLiter(double picogramsperliter) @@ -735,6 +766,7 @@ public static Density FromPicogramsPerLiter(QuantityValue picogramsperliter) /// /// Get Density from PicogramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerMilliliter(double picogramspermilliliter) @@ -749,6 +781,7 @@ public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilli /// /// Get Density from PoundsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerCubicFoot(double poundspercubicfoot) @@ -763,6 +796,7 @@ public static Density FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) /// /// Get Density from PoundsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerCubicInch(double poundspercubicinch) @@ -777,6 +811,7 @@ public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) /// /// Get Density from PoundsPerImperialGallon. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerImperialGallon(double poundsperimperialgallon) @@ -791,6 +826,7 @@ public static Density FromPoundsPerImperialGallon(QuantityValue poundsperimperia /// /// Get Density from PoundsPerUSGallon. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerUSGallon(double poundsperusgallon) @@ -805,6 +841,7 @@ public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) /// /// Get Density from SlugsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromSlugsPerCubicFoot(double slugspercubicfoot) @@ -819,6 +856,7 @@ public static Density FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) /// /// Get Density from TonnesPerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicCentimeter(double tonnespercubiccentimeter) @@ -833,6 +871,7 @@ public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubicc /// /// Get Density from TonnesPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicMeter(double tonnespercubicmeter) @@ -847,6 +886,7 @@ public static Density FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) /// /// Get Density from TonnesPerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimeter) diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 2dd85fa7a0..158c58491d 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Duration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Duration() if(unit == DurationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -189,6 +191,7 @@ public static BaseDimensions BaseDimensions /// /// Get Duration from Days. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromDays(double days) @@ -203,6 +206,7 @@ public static Duration FromDays(QuantityValue days) /// /// Get Duration from Hours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromHours(double hours) @@ -217,6 +221,7 @@ public static Duration FromHours(QuantityValue hours) /// /// Get Duration from Microseconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMicroseconds(double microseconds) @@ -231,6 +236,7 @@ public static Duration FromMicroseconds(QuantityValue microseconds) /// /// Get Duration from Milliseconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMilliseconds(double milliseconds) @@ -245,6 +251,7 @@ public static Duration FromMilliseconds(QuantityValue milliseconds) /// /// Get Duration from Minutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMinutes(double minutes) @@ -259,6 +266,7 @@ public static Duration FromMinutes(QuantityValue minutes) /// /// Get Duration from Months30. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMonths30(double months30) @@ -273,6 +281,7 @@ public static Duration FromMonths30(QuantityValue months30) /// /// Get Duration from Nanoseconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromNanoseconds(double nanoseconds) @@ -287,6 +296,7 @@ public static Duration FromNanoseconds(QuantityValue nanoseconds) /// /// Get Duration from Seconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromSeconds(double seconds) @@ -301,6 +311,7 @@ public static Duration FromSeconds(QuantityValue seconds) /// /// Get Duration from Weeks. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromWeeks(double weeks) @@ -315,6 +326,7 @@ public static Duration FromWeeks(QuantityValue weeks) /// /// Get Duration from Years365. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromYears365(double years365) diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 0d68bf7301..7a6ef0b68e 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static DynamicViscosity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static DynamicViscosity() if(unit == DynamicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -169,6 +171,7 @@ public static BaseDimensions BaseDimensions /// /// Get DynamicViscosity from Centipoise. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromCentipoise(double centipoise) @@ -183,6 +186,7 @@ public static DynamicViscosity FromCentipoise(QuantityValue centipoise) /// /// Get DynamicViscosity from MicropascalSeconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromMicropascalSeconds(double micropascalseconds) @@ -197,6 +201,7 @@ public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascals /// /// Get DynamicViscosity from MillipascalSeconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromMillipascalSeconds(double millipascalseconds) @@ -211,6 +216,7 @@ public static DynamicViscosity FromMillipascalSeconds(QuantityValue millipascals /// /// Get DynamicViscosity from NewtonSecondsPerMeterSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromNewtonSecondsPerMeterSquared(double newtonsecondspermetersquared) @@ -225,6 +231,7 @@ public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue ne /// /// Get DynamicViscosity from PascalSeconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromPascalSeconds(double pascalseconds) @@ -239,6 +246,7 @@ public static DynamicViscosity FromPascalSeconds(QuantityValue pascalseconds) /// /// Get DynamicViscosity from Poise. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromPoise(double poise) diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index e9d80577b0..bcb4a4e495 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricAdmittance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricAdmittance() if(unit == ElectricAdmittanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -159,6 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricAdmittance from Microsiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromMicrosiemens(double microsiemens) @@ -173,6 +176,7 @@ public static ElectricAdmittance FromMicrosiemens(QuantityValue microsiemens) /// /// Get ElectricAdmittance from Millisiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromMillisiemens(double millisiemens) @@ -187,6 +191,7 @@ public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) /// /// Get ElectricAdmittance from Nanosiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromNanosiemens(double nanosiemens) @@ -201,6 +206,7 @@ public static ElectricAdmittance FromNanosiemens(QuantityValue nanosiemens) /// /// Get ElectricAdmittance from Siemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromSiemens(double siemens) diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 803d924b53..b859665a87 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricCharge() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricCharge() if(unit == ElectricChargeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCharge from Coulombs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCharge FromCoulombs(double coulombs) diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 456266e71f..990164f694 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricChargeDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricChargeDensity() if(unit == ElectricChargeDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricChargeDensity from CoulombsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricChargeDensity FromCoulombsPerCubicMeter(double coulombspercubicmeter) diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index bdf193ed08..341cfe24a9 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricConductance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricConductance() if(unit == ElectricConductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricConductance from Microsiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductance FromMicrosiemens(double microsiemens) @@ -168,6 +171,7 @@ public static ElectricConductance FromMicrosiemens(QuantityValue microsiemens) /// /// Get ElectricConductance from Millisiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductance FromMillisiemens(double millisiemens) @@ -182,6 +186,7 @@ public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) /// /// Get ElectricConductance from Siemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductance FromSiemens(double siemens) diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index e738ae597b..d7f670d96f 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricConductivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricConductivity() if(unit == ElectricConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricConductivity from SiemensPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductivity FromSiemensPerMeter(double siemenspermeter) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 7e095a01fa..7ac87cd1ce 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricCurrent() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricCurrent() if(unit == ElectricCurrentUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -179,6 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCurrent from Amperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromAmperes(double amperes) @@ -193,6 +196,7 @@ public static ElectricCurrent FromAmperes(QuantityValue amperes) /// /// Get ElectricCurrent from Centiamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromCentiamperes(double centiamperes) @@ -207,6 +211,7 @@ public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) /// /// Get ElectricCurrent from Kiloamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromKiloamperes(double kiloamperes) @@ -221,6 +226,7 @@ public static ElectricCurrent FromKiloamperes(QuantityValue kiloamperes) /// /// Get ElectricCurrent from Megaamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMegaamperes(double megaamperes) @@ -235,6 +241,7 @@ public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) /// /// Get ElectricCurrent from Microamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMicroamperes(double microamperes) @@ -249,6 +256,7 @@ public static ElectricCurrent FromMicroamperes(QuantityValue microamperes) /// /// Get ElectricCurrent from Milliamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMilliamperes(double milliamperes) @@ -263,6 +271,7 @@ public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) /// /// Get ElectricCurrent from Nanoamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromNanoamperes(double nanoamperes) @@ -277,6 +286,7 @@ public static ElectricCurrent FromNanoamperes(QuantityValue nanoamperes) /// /// Get ElectricCurrent from Picoamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromPicoamperes(double picoamperes) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 80a5896afc..0f3e70a0e4 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricCurrentDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricCurrentDensity() if(unit == ElectricCurrentDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCurrentDensity from AmperesPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrentDensity FromAmperesPerSquareMeter(double amperespersquaremeter) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index e3150cf62e..c3bc0c0a09 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricCurrentGradient() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricCurrentGradient() if(unit == ElectricCurrentGradientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCurrentGradient from AmperesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrentGradient FromAmperesPerSecond(double amperespersecond) diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 1dd721f78d..ba9c8500b1 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricField() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricField() if(unit == ElectricFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricField from VoltsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricField FromVoltsPerMeter(double voltspermeter) diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 604be2d0e7..7d9f39fd11 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricInductance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricInductance() if(unit == ElectricInductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricInductance from Henries. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricInductance FromHenries(double henries) diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index cee26f9c96..8231a34342 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricPotential() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricPotential() if(unit == ElectricPotentialUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -164,6 +166,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricPotential from Kilovolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromKilovolts(double kilovolts) @@ -178,6 +181,7 @@ public static ElectricPotential FromKilovolts(QuantityValue kilovolts) /// /// Get ElectricPotential from Megavolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMegavolts(double megavolts) @@ -192,6 +196,7 @@ public static ElectricPotential FromMegavolts(QuantityValue megavolts) /// /// Get ElectricPotential from Microvolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMicrovolts(double microvolts) @@ -206,6 +211,7 @@ public static ElectricPotential FromMicrovolts(QuantityValue microvolts) /// /// Get ElectricPotential from Millivolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMillivolts(double millivolts) @@ -220,6 +226,7 @@ public static ElectricPotential FromMillivolts(QuantityValue millivolts) /// /// Get ElectricPotential from Volts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromVolts(double volts) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 845b7f15a1..fcf63810c1 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static ElectricPotentialAc() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static ElectricPotentialAc() if(unit == ElectricPotentialAcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -163,6 +165,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricPotentialAc from KilovoltsAc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromKilovoltsAc(double kilovoltsac) @@ -177,6 +180,7 @@ public static ElectricPotentialAc FromKilovoltsAc(QuantityValue kilovoltsac) /// /// Get ElectricPotentialAc from MegavoltsAc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMegavoltsAc(double megavoltsac) @@ -191,6 +195,7 @@ public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) /// /// Get ElectricPotentialAc from MicrovoltsAc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMicrovoltsAc(double microvoltsac) @@ -205,6 +210,7 @@ public static ElectricPotentialAc FromMicrovoltsAc(QuantityValue microvoltsac) /// /// Get ElectricPotentialAc from MillivoltsAc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMillivoltsAc(double millivoltsac) @@ -219,6 +225,7 @@ public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) /// /// Get ElectricPotentialAc from VoltsAc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromVoltsAc(double voltsac) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index adf2dd26c7..88be3d5059 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static ElectricPotentialDc() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static ElectricPotentialDc() if(unit == ElectricPotentialDcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -163,6 +165,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricPotentialDc from KilovoltsDc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromKilovoltsDc(double kilovoltsdc) @@ -177,6 +180,7 @@ public static ElectricPotentialDc FromKilovoltsDc(QuantityValue kilovoltsdc) /// /// Get ElectricPotentialDc from MegavoltsDc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMegavoltsDc(double megavoltsdc) @@ -191,6 +195,7 @@ public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) /// /// Get ElectricPotentialDc from MicrovoltsDc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMicrovoltsDc(double microvoltsdc) @@ -205,6 +210,7 @@ public static ElectricPotentialDc FromMicrovoltsDc(QuantityValue microvoltsdc) /// /// Get ElectricPotentialDc from MillivoltsDc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMillivoltsDc(double millivoltsdc) @@ -219,6 +225,7 @@ public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) /// /// Get ElectricPotentialDc from VoltsDc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromVoltsDc(double voltsdc) diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 38f5aa4f63..d6a6515d32 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricResistance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricResistance() if(unit == ElectricResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -159,6 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricResistance from Kiloohms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromKiloohms(double kiloohms) @@ -173,6 +176,7 @@ public static ElectricResistance FromKiloohms(QuantityValue kiloohms) /// /// Get ElectricResistance from Megaohms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromMegaohms(double megaohms) @@ -187,6 +191,7 @@ public static ElectricResistance FromMegaohms(QuantityValue megaohms) /// /// Get ElectricResistance from Milliohms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromMilliohms(double milliohms) @@ -201,6 +206,7 @@ public static ElectricResistance FromMilliohms(QuantityValue milliohms) /// /// Get ElectricResistance from Ohms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromOhms(double ohms) diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index a1196038e5..4023ff5c3c 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricResistivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ElectricResistivity() if(unit == ElectricResistivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -159,6 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricResistivity from MicroohmMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromMicroohmMeters(double microohmmeters) @@ -173,6 +176,7 @@ public static ElectricResistivity FromMicroohmMeters(QuantityValue microohmmeter /// /// Get ElectricResistivity from MilliohmMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromMilliohmMeters(double milliohmmeters) @@ -187,6 +191,7 @@ public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeter /// /// Get ElectricResistivity from NanoohmMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromNanoohmMeters(double nanoohmmeters) @@ -201,6 +206,7 @@ public static ElectricResistivity FromNanoohmMeters(QuantityValue nanoohmmeters) /// /// Get ElectricResistivity from OhmMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromOhmMeters(double ohmmeters) diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 21a5e464e8..e44892aa62 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Energy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Energy() if(unit == EnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -249,6 +251,7 @@ public static BaseDimensions BaseDimensions /// /// Get Energy from BritishThermalUnits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromBritishThermalUnits(double britishthermalunits) @@ -263,6 +266,7 @@ public static Energy FromBritishThermalUnits(QuantityValue britishthermalunits) /// /// Get Energy from Calories. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromCalories(double calories) @@ -277,6 +281,7 @@ public static Energy FromCalories(QuantityValue calories) /// /// Get Energy from DecathermsEc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromDecathermsEc(double decathermsec) @@ -291,6 +296,7 @@ public static Energy FromDecathermsEc(QuantityValue decathermsec) /// /// Get Energy from DecathermsImperial. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromDecathermsImperial(double decathermsimperial) @@ -305,6 +311,7 @@ public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) /// /// Get Energy from DecathermsUs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromDecathermsUs(double decathermsus) @@ -319,6 +326,7 @@ public static Energy FromDecathermsUs(QuantityValue decathermsus) /// /// Get Energy from ElectronVolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromElectronVolts(double electronvolts) @@ -333,6 +341,7 @@ public static Energy FromElectronVolts(QuantityValue electronvolts) /// /// Get Energy from Ergs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromErgs(double ergs) @@ -347,6 +356,7 @@ public static Energy FromErgs(QuantityValue ergs) /// /// Get Energy from FootPounds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromFootPounds(double footpounds) @@ -361,6 +371,7 @@ public static Energy FromFootPounds(QuantityValue footpounds) /// /// Get Energy from GigabritishThermalUnits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromGigabritishThermalUnits(double gigabritishthermalunits) @@ -375,6 +386,7 @@ public static Energy FromGigabritishThermalUnits(QuantityValue gigabritishtherma /// /// Get Energy from GigawattHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromGigawattHours(double gigawatthours) @@ -389,6 +401,7 @@ public static Energy FromGigawattHours(QuantityValue gigawatthours) /// /// Get Energy from Joules. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromJoules(double joules) @@ -403,6 +416,7 @@ public static Energy FromJoules(QuantityValue joules) /// /// Get Energy from KilobritishThermalUnits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilobritishThermalUnits(double kilobritishthermalunits) @@ -417,6 +431,7 @@ public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishtherma /// /// Get Energy from Kilocalories. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilocalories(double kilocalories) @@ -431,6 +446,7 @@ public static Energy FromKilocalories(QuantityValue kilocalories) /// /// Get Energy from Kilojoules. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilojoules(double kilojoules) @@ -445,6 +461,7 @@ public static Energy FromKilojoules(QuantityValue kilojoules) /// /// Get Energy from KilowattHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilowattHours(double kilowatthours) @@ -459,6 +476,7 @@ public static Energy FromKilowattHours(QuantityValue kilowatthours) /// /// Get Energy from MegabritishThermalUnits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegabritishThermalUnits(double megabritishthermalunits) @@ -473,6 +491,7 @@ public static Energy FromMegabritishThermalUnits(QuantityValue megabritishtherma /// /// Get Energy from Megajoules. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegajoules(double megajoules) @@ -487,6 +506,7 @@ public static Energy FromMegajoules(QuantityValue megajoules) /// /// Get Energy from MegawattHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegawattHours(double megawatthours) @@ -501,6 +521,7 @@ public static Energy FromMegawattHours(QuantityValue megawatthours) /// /// Get Energy from ThermsEc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromThermsEc(double thermsec) @@ -515,6 +536,7 @@ public static Energy FromThermsEc(QuantityValue thermsec) /// /// Get Energy from ThermsImperial. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromThermsImperial(double thermsimperial) @@ -529,6 +551,7 @@ public static Energy FromThermsImperial(QuantityValue thermsimperial) /// /// Get Energy from ThermsUs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromThermsUs(double thermsus) @@ -543,6 +566,7 @@ public static Energy FromThermsUs(QuantityValue thermsus) /// /// Get Energy from WattHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromWattHours(double watthours) diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index e695b349f6..c36252ab99 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Entropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Entropy() if(unit == EntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -174,6 +176,7 @@ public static BaseDimensions BaseDimensions /// /// Get Entropy from CaloriesPerKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromCaloriesPerKelvin(double caloriesperkelvin) @@ -188,6 +191,7 @@ public static Entropy FromCaloriesPerKelvin(QuantityValue caloriesperkelvin) /// /// Get Entropy from JoulesPerDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromJoulesPerDegreeCelsius(double joulesperdegreecelsius) @@ -202,6 +206,7 @@ public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreece /// /// Get Entropy from JoulesPerKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromJoulesPerKelvin(double joulesperkelvin) @@ -216,6 +221,7 @@ public static Entropy FromJoulesPerKelvin(QuantityValue joulesperkelvin) /// /// Get Entropy from KilocaloriesPerKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilocaloriesPerKelvin(double kilocaloriesperkelvin) @@ -230,6 +236,7 @@ public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkel /// /// Get Entropy from KilojoulesPerDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilojoulesPerDegreeCelsius(double kilojoulesperdegreecelsius) @@ -244,6 +251,7 @@ public static Entropy FromKilojoulesPerDegreeCelsius(QuantityValue kilojoulesper /// /// Get Entropy from KilojoulesPerKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilojoulesPerKelvin(double kilojoulesperkelvin) @@ -258,6 +266,7 @@ public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) /// /// Get Entropy from MegajoulesPerKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromMegajoulesPerKelvin(double megajoulesperkelvin) diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index dc687014d4..24a6e1a777 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Force() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Force() if(unit == ForceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -189,6 +191,7 @@ public static BaseDimensions BaseDimensions /// /// Get Force from Decanewtons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromDecanewtons(double decanewtons) @@ -203,6 +206,7 @@ public static Force FromDecanewtons(QuantityValue decanewtons) /// /// Get Force from Dyne. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromDyne(double dyne) @@ -217,6 +221,7 @@ public static Force FromDyne(QuantityValue dyne) /// /// Get Force from KilogramsForce. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromKilogramsForce(double kilogramsforce) @@ -231,6 +236,7 @@ public static Force FromKilogramsForce(QuantityValue kilogramsforce) /// /// Get Force from Kilonewtons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromKilonewtons(double kilonewtons) @@ -245,6 +251,7 @@ public static Force FromKilonewtons(QuantityValue kilonewtons) /// /// Get Force from KiloPonds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromKiloPonds(double kiloponds) @@ -259,6 +266,7 @@ public static Force FromKiloPonds(QuantityValue kiloponds) /// /// Get Force from Meganewtons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromMeganewtons(double meganewtons) @@ -273,6 +281,7 @@ public static Force FromMeganewtons(QuantityValue meganewtons) /// /// Get Force from Newtons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromNewtons(double newtons) @@ -287,6 +296,7 @@ public static Force FromNewtons(QuantityValue newtons) /// /// Get Force from Poundals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromPoundals(double poundals) @@ -301,6 +311,7 @@ public static Force FromPoundals(QuantityValue poundals) /// /// Get Force from PoundsForce. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromPoundsForce(double poundsforce) @@ -315,6 +326,7 @@ public static Force FromPoundsForce(QuantityValue poundsforce) /// /// Get Force from TonnesForce. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromTonnesForce(double tonnesforce) diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 185b004d19..d3597b7083 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ForceChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ForceChangeRate() if(unit == ForceChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -194,6 +196,7 @@ public static BaseDimensions BaseDimensions /// /// Get ForceChangeRate from CentinewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromCentinewtonsPerSecond(double centinewtonspersecond) @@ -208,6 +211,7 @@ public static ForceChangeRate FromCentinewtonsPerSecond(QuantityValue centinewto /// /// Get ForceChangeRate from DecanewtonsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecanewtonsPerMinute(double decanewtonsperminute) @@ -222,6 +226,7 @@ public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtons /// /// Get ForceChangeRate from DecanewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecanewtonsPerSecond(double decanewtonspersecond) @@ -236,6 +241,7 @@ public static ForceChangeRate FromDecanewtonsPerSecond(QuantityValue decanewtons /// /// Get ForceChangeRate from DecinewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecinewtonsPerSecond(double decinewtonspersecond) @@ -250,6 +256,7 @@ public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtons /// /// Get ForceChangeRate from KilonewtonsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromKilonewtonsPerMinute(double kilonewtonsperminute) @@ -264,6 +271,7 @@ public static ForceChangeRate FromKilonewtonsPerMinute(QuantityValue kilonewtons /// /// Get ForceChangeRate from KilonewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromKilonewtonsPerSecond(double kilonewtonspersecond) @@ -278,6 +286,7 @@ public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtons /// /// Get ForceChangeRate from MicronewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromMicronewtonsPerSecond(double micronewtonspersecond) @@ -292,6 +301,7 @@ public static ForceChangeRate FromMicronewtonsPerSecond(QuantityValue micronewto /// /// Get ForceChangeRate from MillinewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromMillinewtonsPerSecond(double millinewtonspersecond) @@ -306,6 +316,7 @@ public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewto /// /// Get ForceChangeRate from NanonewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromNanonewtonsPerSecond(double nanonewtonspersecond) @@ -320,6 +331,7 @@ public static ForceChangeRate FromNanonewtonsPerSecond(QuantityValue nanonewtons /// /// Get ForceChangeRate from NewtonsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromNewtonsPerMinute(double newtonsperminute) @@ -334,6 +346,7 @@ public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminut /// /// Get ForceChangeRate from NewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromNewtonsPerSecond(double newtonspersecond) diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index 095821a376..da8a54d874 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ForcePerLength() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ForcePerLength() if(unit == ForcePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -184,6 +186,7 @@ public static BaseDimensions BaseDimensions /// /// Get ForcePerLength from CentinewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromCentinewtonsPerMeter(double centinewtonspermeter) @@ -198,6 +201,7 @@ public static ForcePerLength FromCentinewtonsPerMeter(QuantityValue centinewtons /// /// Get ForcePerLength from DecinewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromDecinewtonsPerMeter(double decinewtonspermeter) @@ -212,6 +216,7 @@ public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspe /// /// Get ForcePerLength from KilogramsForcePerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromKilogramsForcePerMeter(double kilogramsforcepermeter) @@ -226,6 +231,7 @@ public static ForcePerLength FromKilogramsForcePerMeter(QuantityValue kilogramsf /// /// Get ForcePerLength from KilonewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromKilonewtonsPerMeter(double kilonewtonspermeter) @@ -240,6 +246,7 @@ public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspe /// /// Get ForcePerLength from MeganewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromMeganewtonsPerMeter(double meganewtonspermeter) @@ -254,6 +261,7 @@ public static ForcePerLength FromMeganewtonsPerMeter(QuantityValue meganewtonspe /// /// Get ForcePerLength from MicronewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromMicronewtonsPerMeter(double micronewtonspermeter) @@ -268,6 +276,7 @@ public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtons /// /// Get ForcePerLength from MillinewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromMillinewtonsPerMeter(double millinewtonspermeter) @@ -282,6 +291,7 @@ public static ForcePerLength FromMillinewtonsPerMeter(QuantityValue millinewtons /// /// Get ForcePerLength from NanonewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromNanonewtonsPerMeter(double nanonewtonspermeter) @@ -296,6 +306,7 @@ public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspe /// /// Get ForcePerLength from NewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromNewtonsPerMeter(double newtonspermeter) diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 28f561007c..72866114d7 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Frequency() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Frequency() if(unit == FrequencyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -179,6 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get Frequency from CyclesPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromCyclesPerHour(double cyclesperhour) @@ -193,6 +196,7 @@ public static Frequency FromCyclesPerHour(QuantityValue cyclesperhour) /// /// Get Frequency from CyclesPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromCyclesPerMinute(double cyclesperminute) @@ -207,6 +211,7 @@ public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) /// /// Get Frequency from Gigahertz. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromGigahertz(double gigahertz) @@ -221,6 +226,7 @@ public static Frequency FromGigahertz(QuantityValue gigahertz) /// /// Get Frequency from Hertz. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromHertz(double hertz) @@ -235,6 +241,7 @@ public static Frequency FromHertz(QuantityValue hertz) /// /// Get Frequency from Kilohertz. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromKilohertz(double kilohertz) @@ -249,6 +256,7 @@ public static Frequency FromKilohertz(QuantityValue kilohertz) /// /// Get Frequency from Megahertz. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromMegahertz(double megahertz) @@ -263,6 +271,7 @@ public static Frequency FromMegahertz(QuantityValue megahertz) /// /// Get Frequency from RadiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromRadiansPerSecond(double radianspersecond) @@ -277,6 +286,7 @@ public static Frequency FromRadiansPerSecond(QuantityValue radianspersecond) /// /// Get Frequency from Terahertz. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromTerahertz(double terahertz) diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 60a80f59bc..67877a4372 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static HeatFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static HeatFlux() if(unit == HeatFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -219,6 +221,7 @@ public static BaseDimensions BaseDimensions /// /// Get HeatFlux from BtusPerHourSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerHourSquareFoot(double btusperhoursquarefoot) @@ -233,6 +236,7 @@ public static HeatFlux FromBtusPerHourSquareFoot(QuantityValue btusperhoursquare /// /// Get HeatFlux from BtusPerMinuteSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerMinuteSquareFoot(double btusperminutesquarefoot) @@ -247,6 +251,7 @@ public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesq /// /// Get HeatFlux from BtusPerSecondSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerSecondSquareFoot(double btuspersecondsquarefoot) @@ -261,6 +266,7 @@ public static HeatFlux FromBtusPerSecondSquareFoot(QuantityValue btuspersecondsq /// /// Get HeatFlux from BtusPerSecondSquareInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerSecondSquareInch(double btuspersecondsquareinch) @@ -275,6 +281,7 @@ public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsq /// /// Get HeatFlux from CaloriesPerSecondSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromCaloriesPerSecondSquareCentimeter(double caloriespersecondsquarecentimeter) @@ -289,6 +296,7 @@ public static HeatFlux FromCaloriesPerSecondSquareCentimeter(QuantityValue calor /// /// Get HeatFlux from CentiwattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromCentiwattsPerSquareMeter(double centiwattspersquaremeter) @@ -303,6 +311,7 @@ public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspers /// /// Get HeatFlux from DeciwattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromDeciwattsPerSquareMeter(double deciwattspersquaremeter) @@ -317,6 +326,7 @@ public static HeatFlux FromDeciwattsPerSquareMeter(QuantityValue deciwattspersqu /// /// Get HeatFlux from KilocaloriesPerHourSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilocaloriesPerHourSquareMeter(double kilocaloriesperhoursquaremeter) @@ -331,6 +341,7 @@ public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocalo /// /// Get HeatFlux from KilocaloriesPerSecondSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(double kilocaloriespersecondsquarecentimeter) @@ -345,6 +356,7 @@ public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(QuantityValue k /// /// Get HeatFlux from KilowattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilowattsPerSquareMeter(double kilowattspersquaremeter) @@ -359,6 +371,7 @@ public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersqu /// /// Get HeatFlux from MicrowattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromMicrowattsPerSquareMeter(double microwattspersquaremeter) @@ -373,6 +386,7 @@ public static HeatFlux FromMicrowattsPerSquareMeter(QuantityValue microwattspers /// /// Get HeatFlux from MilliwattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromMilliwattsPerSquareMeter(double milliwattspersquaremeter) @@ -387,6 +401,7 @@ public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspers /// /// Get HeatFlux from NanowattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromNanowattsPerSquareMeter(double nanowattspersquaremeter) @@ -401,6 +416,7 @@ public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersqu /// /// Get HeatFlux from WattsPerSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareFoot(double wattspersquarefoot) @@ -415,6 +431,7 @@ public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) /// /// Get HeatFlux from WattsPerSquareInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareInch(double wattspersquareinch) @@ -429,6 +446,7 @@ public static HeatFlux FromWattsPerSquareInch(QuantityValue wattspersquareinch) /// /// Get HeatFlux from WattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareMeter(double wattspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 79fbb16f01..c0c60c5e38 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static HeatTransferCoefficient() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static HeatTransferCoefficient() if(unit == HeatTransferCoefficientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -149,6 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get HeatTransferCoefficient from WattsPerSquareMeterCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(double wattspersquaremetercelsius) @@ -163,6 +166,7 @@ public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(QuantityVal /// /// Get HeatTransferCoefficient from WattsPerSquareMeterKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(double wattspersquaremeterkelvin) diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index b04962702f..fdd8c4efd8 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Illuminance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Illuminance() if(unit == IlluminanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -159,6 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get Illuminance from Kilolux. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromKilolux(double kilolux) @@ -173,6 +176,7 @@ public static Illuminance FromKilolux(QuantityValue kilolux) /// /// Get Illuminance from Lux. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromLux(double lux) @@ -187,6 +191,7 @@ public static Illuminance FromLux(QuantityValue lux) /// /// Get Illuminance from Megalux. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromMegalux(double megalux) @@ -201,6 +206,7 @@ public static Illuminance FromMegalux(QuantityValue megalux) /// /// Get Illuminance from Millilux. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromMillilux(double millilux) diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 8faa30c6e9..976c240afb 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Information() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -268,6 +270,7 @@ public static BaseDimensions BaseDimensions /// /// Get Information from Bits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromBits(double bits) @@ -282,6 +285,7 @@ public static Information FromBits(QuantityValue bits) /// /// Get Information from Bytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromBytes(double bytes) @@ -296,6 +300,7 @@ public static Information FromBytes(QuantityValue bytes) /// /// Get Information from Exabits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExabits(double exabits) @@ -310,6 +315,7 @@ public static Information FromExabits(QuantityValue exabits) /// /// Get Information from Exabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExabytes(double exabytes) @@ -324,6 +330,7 @@ public static Information FromExabytes(QuantityValue exabytes) /// /// Get Information from Exbibits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExbibits(double exbibits) @@ -338,6 +345,7 @@ public static Information FromExbibits(QuantityValue exbibits) /// /// Get Information from Exbibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExbibytes(double exbibytes) @@ -352,6 +360,7 @@ public static Information FromExbibytes(QuantityValue exbibytes) /// /// Get Information from Gibibits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGibibits(double gibibits) @@ -366,6 +375,7 @@ public static Information FromGibibits(QuantityValue gibibits) /// /// Get Information from Gibibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGibibytes(double gibibytes) @@ -380,6 +390,7 @@ public static Information FromGibibytes(QuantityValue gibibytes) /// /// Get Information from Gigabits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGigabits(double gigabits) @@ -394,6 +405,7 @@ public static Information FromGigabits(QuantityValue gigabits) /// /// Get Information from Gigabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGigabytes(double gigabytes) @@ -408,6 +420,7 @@ public static Information FromGigabytes(QuantityValue gigabytes) /// /// Get Information from Kibibits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKibibits(double kibibits) @@ -422,6 +435,7 @@ public static Information FromKibibits(QuantityValue kibibits) /// /// Get Information from Kibibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKibibytes(double kibibytes) @@ -436,6 +450,7 @@ public static Information FromKibibytes(QuantityValue kibibytes) /// /// Get Information from Kilobits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKilobits(double kilobits) @@ -450,6 +465,7 @@ public static Information FromKilobits(QuantityValue kilobits) /// /// Get Information from Kilobytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKilobytes(double kilobytes) @@ -464,6 +480,7 @@ public static Information FromKilobytes(QuantityValue kilobytes) /// /// Get Information from Mebibits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMebibits(double mebibits) @@ -478,6 +495,7 @@ public static Information FromMebibits(QuantityValue mebibits) /// /// Get Information from Mebibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMebibytes(double mebibytes) @@ -492,6 +510,7 @@ public static Information FromMebibytes(QuantityValue mebibytes) /// /// Get Information from Megabits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMegabits(double megabits) @@ -506,6 +525,7 @@ public static Information FromMegabits(QuantityValue megabits) /// /// Get Information from Megabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMegabytes(double megabytes) @@ -520,6 +540,7 @@ public static Information FromMegabytes(QuantityValue megabytes) /// /// Get Information from Pebibits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPebibits(double pebibits) @@ -534,6 +555,7 @@ public static Information FromPebibits(QuantityValue pebibits) /// /// Get Information from Pebibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPebibytes(double pebibytes) @@ -548,6 +570,7 @@ public static Information FromPebibytes(QuantityValue pebibytes) /// /// Get Information from Petabits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPetabits(double petabits) @@ -562,6 +585,7 @@ public static Information FromPetabits(QuantityValue petabits) /// /// Get Information from Petabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPetabytes(double petabytes) @@ -576,6 +600,7 @@ public static Information FromPetabytes(QuantityValue petabytes) /// /// Get Information from Tebibits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTebibits(double tebibits) @@ -590,6 +615,7 @@ public static Information FromTebibits(QuantityValue tebibits) /// /// Get Information from Tebibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTebibytes(double tebibytes) @@ -604,6 +630,7 @@ public static Information FromTebibytes(QuantityValue tebibytes) /// /// Get Information from Terabits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTerabits(double terabits) @@ -618,6 +645,7 @@ public static Information FromTerabits(QuantityValue terabits) /// /// Get Information from Terabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTerabytes(double terabytes) diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 8ac3e0e0eb..03773eae0f 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Irradiance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Irradiance() if(unit == IrradianceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -149,6 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get Irradiance from KilowattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiance FromKilowattsPerSquareMeter(double kilowattspersquaremeter) @@ -163,6 +166,7 @@ public static Irradiance FromKilowattsPerSquareMeter(QuantityValue kilowattspers /// /// Get Irradiance from WattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiance FromWattsPerSquareMeter(double wattspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 7f2d9760b2..d495d594da 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Irradiation() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Irradiation() if(unit == IrradiationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get Irradiation from JoulesPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiation FromJoulesPerSquareMeter(double joulespersquaremeter) @@ -168,6 +171,7 @@ public static Irradiation FromJoulesPerSquareMeter(QuantityValue joulespersquare /// /// Get Irradiation from KilowattHoursPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiation FromKilowattHoursPerSquareMeter(double kilowatthourspersquaremeter) @@ -182,6 +186,7 @@ public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatt /// /// Get Irradiation from WattHoursPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiation FromWattHoursPerSquareMeter(double watthourspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 32a767342a..ad40138c55 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static KinematicViscosity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static KinematicViscosity() if(unit == KinematicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -179,6 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get KinematicViscosity from Centistokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromCentistokes(double centistokes) @@ -193,6 +196,7 @@ public static KinematicViscosity FromCentistokes(QuantityValue centistokes) /// /// Get KinematicViscosity from Decistokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromDecistokes(double decistokes) @@ -207,6 +211,7 @@ public static KinematicViscosity FromDecistokes(QuantityValue decistokes) /// /// Get KinematicViscosity from Kilostokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromKilostokes(double kilostokes) @@ -221,6 +226,7 @@ public static KinematicViscosity FromKilostokes(QuantityValue kilostokes) /// /// Get KinematicViscosity from Microstokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromMicrostokes(double microstokes) @@ -235,6 +241,7 @@ public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) /// /// Get KinematicViscosity from Millistokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromMillistokes(double millistokes) @@ -249,6 +256,7 @@ public static KinematicViscosity FromMillistokes(QuantityValue millistokes) /// /// Get KinematicViscosity from Nanostokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromNanostokes(double nanostokes) @@ -263,6 +271,7 @@ public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) /// /// Get KinematicViscosity from SquareMetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromSquareMetersPerSecond(double squaremeterspersecond) @@ -277,6 +286,7 @@ public static KinematicViscosity FromSquareMetersPerSecond(QuantityValue squarem /// /// Get KinematicViscosity from Stokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromStokes(double stokes) diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index d35d311ac1..63db7bef58 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static LapseRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static LapseRate() if(unit == LapseRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get LapseRate from DegreesCelciusPerKilometer. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LapseRate FromDegreesCelciusPerKilometer(double degreescelciusperkilometer) diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index 6f27d38fca..a0515554d4 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Length() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Length() if(unit == LengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -249,6 +251,7 @@ public static BaseDimensions BaseDimensions /// /// Get Length from Centimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromCentimeters(double centimeters) @@ -263,6 +266,7 @@ public static Length FromCentimeters(QuantityValue centimeters) /// /// Get Length from Decimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDecimeters(double decimeters) @@ -277,6 +281,7 @@ public static Length FromDecimeters(QuantityValue decimeters) /// /// Get Length from DtpPicas. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDtpPicas(double dtppicas) @@ -291,6 +296,7 @@ public static Length FromDtpPicas(QuantityValue dtppicas) /// /// Get Length from DtpPoints. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDtpPoints(double dtppoints) @@ -305,6 +311,7 @@ public static Length FromDtpPoints(QuantityValue dtppoints) /// /// Get Length from Fathoms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromFathoms(double fathoms) @@ -319,6 +326,7 @@ public static Length FromFathoms(QuantityValue fathoms) /// /// Get Length from Feet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromFeet(double feet) @@ -333,6 +341,7 @@ public static Length FromFeet(QuantityValue feet) /// /// Get Length from Inches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromInches(double inches) @@ -347,6 +356,7 @@ public static Length FromInches(QuantityValue inches) /// /// Get Length from Kilometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromKilometers(double kilometers) @@ -361,6 +371,7 @@ public static Length FromKilometers(QuantityValue kilometers) /// /// Get Length from Meters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMeters(double meters) @@ -375,6 +386,7 @@ public static Length FromMeters(QuantityValue meters) /// /// Get Length from Microinches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMicroinches(double microinches) @@ -389,6 +401,7 @@ public static Length FromMicroinches(QuantityValue microinches) /// /// Get Length from Micrometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMicrometers(double micrometers) @@ -403,6 +416,7 @@ public static Length FromMicrometers(QuantityValue micrometers) /// /// Get Length from Mils. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMils(double mils) @@ -417,6 +431,7 @@ public static Length FromMils(QuantityValue mils) /// /// Get Length from Miles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMiles(double miles) @@ -431,6 +446,7 @@ public static Length FromMiles(QuantityValue miles) /// /// Get Length from Millimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMillimeters(double millimeters) @@ -445,6 +461,7 @@ public static Length FromMillimeters(QuantityValue millimeters) /// /// Get Length from Nanometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromNanometers(double nanometers) @@ -459,6 +476,7 @@ public static Length FromNanometers(QuantityValue nanometers) /// /// Get Length from NauticalMiles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromNauticalMiles(double nauticalmiles) @@ -473,6 +491,7 @@ public static Length FromNauticalMiles(QuantityValue nauticalmiles) /// /// Get Length from PrinterPicas. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromPrinterPicas(double printerpicas) @@ -487,6 +506,7 @@ public static Length FromPrinterPicas(QuantityValue printerpicas) /// /// Get Length from PrinterPoints. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromPrinterPoints(double printerpoints) @@ -501,6 +521,7 @@ public static Length FromPrinterPoints(QuantityValue printerpoints) /// /// Get Length from Shackles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromShackles(double shackles) @@ -515,6 +536,7 @@ public static Length FromShackles(QuantityValue shackles) /// /// Get Length from Twips. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromTwips(double twips) @@ -529,6 +551,7 @@ public static Length FromTwips(QuantityValue twips) /// /// Get Length from UsSurveyFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromUsSurveyFeet(double ussurveyfeet) @@ -543,6 +566,7 @@ public static Length FromUsSurveyFeet(QuantityValue ussurveyfeet) /// /// Get Length from Yards. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromYards(double yards) diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 5d5b97c5d6..6c91ecd36f 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Level() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static Level() if(unit == LevelUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -148,6 +150,7 @@ public static BaseDimensions BaseDimensions /// /// Get Level from Decibels. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Level FromDecibels(double decibels) @@ -162,6 +165,7 @@ public static Level FromDecibels(QuantityValue decibels) /// /// Get Level from Nepers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Level FromNepers(double nepers) diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 12fb970428..348f941c22 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static LinearDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static LinearDensity() if(unit == LinearDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get LinearDensity from GramsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LinearDensity FromGramsPerMeter(double gramspermeter) @@ -168,6 +171,7 @@ public static LinearDensity FromGramsPerMeter(QuantityValue gramspermeter) /// /// Get LinearDensity from KilogramsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LinearDensity FromKilogramsPerMeter(double kilogramspermeter) @@ -182,6 +186,7 @@ public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermete /// /// Get LinearDensity from PoundsPerFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LinearDensity FromPoundsPerFoot(double poundsperfoot) diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index 1b85162ec6..41c198207e 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static LuminousFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static LuminousFlux() if(unit == LuminousFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get LuminousFlux from Lumens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LuminousFlux FromLumens(double lumens) diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 7ab5e508c0..ac1ce0f294 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static LuminousIntensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static LuminousIntensity() if(unit == LuminousIntensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get LuminousIntensity from Candela. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LuminousIntensity FromCandela(double candela) diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 9670600aa0..e3ec597be8 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MagneticField() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MagneticField() if(unit == MagneticFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get MagneticField from Teslas. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MagneticField FromTeslas(double teslas) diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index ecf97a2aa1..03a99e9c45 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MagneticFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MagneticFlux() if(unit == MagneticFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get MagneticFlux from Webers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MagneticFlux FromWebers(double webers) diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 0cdd76a5f7..cb8998db5e 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Magnetization() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Magnetization() if(unit == MagnetizationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Magnetization from AmperesPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Magnetization FromAmperesPerMeter(double amperespermeter) diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index c0292d940d..bfab2fd9ea 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Mass() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Mass() if(unit == MassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -244,6 +246,7 @@ public static BaseDimensions BaseDimensions /// /// Get Mass from Centigrams. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromCentigrams(double centigrams) @@ -258,6 +261,7 @@ public static Mass FromCentigrams(QuantityValue centigrams) /// /// Get Mass from Decagrams. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromDecagrams(double decagrams) @@ -272,6 +276,7 @@ public static Mass FromDecagrams(QuantityValue decagrams) /// /// Get Mass from Decigrams. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromDecigrams(double decigrams) @@ -286,6 +291,7 @@ public static Mass FromDecigrams(QuantityValue decigrams) /// /// Get Mass from Grams. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromGrams(double grams) @@ -300,6 +306,7 @@ public static Mass FromGrams(QuantityValue grams) /// /// Get Mass from Hectograms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromHectograms(double hectograms) @@ -314,6 +321,7 @@ public static Mass FromHectograms(QuantityValue hectograms) /// /// Get Mass from Kilograms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilograms(double kilograms) @@ -328,6 +336,7 @@ public static Mass FromKilograms(QuantityValue kilograms) /// /// Get Mass from Kilopounds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilopounds(double kilopounds) @@ -342,6 +351,7 @@ public static Mass FromKilopounds(QuantityValue kilopounds) /// /// Get Mass from Kilotonnes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilotonnes(double kilotonnes) @@ -356,6 +366,7 @@ public static Mass FromKilotonnes(QuantityValue kilotonnes) /// /// Get Mass from LongHundredweight. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromLongHundredweight(double longhundredweight) @@ -370,6 +381,7 @@ public static Mass FromLongHundredweight(QuantityValue longhundredweight) /// /// Get Mass from LongTons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromLongTons(double longtons) @@ -384,6 +396,7 @@ public static Mass FromLongTons(QuantityValue longtons) /// /// Get Mass from Megapounds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMegapounds(double megapounds) @@ -398,6 +411,7 @@ public static Mass FromMegapounds(QuantityValue megapounds) /// /// Get Mass from Megatonnes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMegatonnes(double megatonnes) @@ -412,6 +426,7 @@ public static Mass FromMegatonnes(QuantityValue megatonnes) /// /// Get Mass from Micrograms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMicrograms(double micrograms) @@ -426,6 +441,7 @@ public static Mass FromMicrograms(QuantityValue micrograms) /// /// Get Mass from Milligrams. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMilligrams(double milligrams) @@ -440,6 +456,7 @@ public static Mass FromMilligrams(QuantityValue milligrams) /// /// Get Mass from Nanograms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromNanograms(double nanograms) @@ -454,6 +471,7 @@ public static Mass FromNanograms(QuantityValue nanograms) /// /// Get Mass from Ounces. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromOunces(double ounces) @@ -468,6 +486,7 @@ public static Mass FromOunces(QuantityValue ounces) /// /// Get Mass from Pounds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromPounds(double pounds) @@ -482,6 +501,7 @@ public static Mass FromPounds(QuantityValue pounds) /// /// Get Mass from ShortHundredweight. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromShortHundredweight(double shorthundredweight) @@ -496,6 +516,7 @@ public static Mass FromShortHundredweight(QuantityValue shorthundredweight) /// /// Get Mass from ShortTons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromShortTons(double shorttons) @@ -510,6 +531,7 @@ public static Mass FromShortTons(QuantityValue shorttons) /// /// Get Mass from Stone. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromStone(double stone) @@ -524,6 +546,7 @@ public static Mass FromStone(QuantityValue stone) /// /// Get Mass from Tonnes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromTonnes(double tonnes) diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index d94bf06be9..a15dacc580 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MassFlow() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MassFlow() if(unit == MassFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -214,6 +216,7 @@ public static BaseDimensions BaseDimensions /// /// Get MassFlow from CentigramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromCentigramsPerSecond(double centigramspersecond) @@ -228,6 +231,7 @@ public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond /// /// Get MassFlow from DecagramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromDecagramsPerSecond(double decagramspersecond) @@ -242,6 +246,7 @@ public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) /// /// Get MassFlow from DecigramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromDecigramsPerSecond(double decigramspersecond) @@ -256,6 +261,7 @@ public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) /// /// Get MassFlow from GramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromGramsPerSecond(double gramspersecond) @@ -270,6 +276,7 @@ public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) /// /// Get MassFlow from HectogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromHectogramsPerSecond(double hectogramspersecond) @@ -284,6 +291,7 @@ public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond /// /// Get MassFlow from KilogramsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromKilogramsPerHour(double kilogramsperhour) @@ -298,6 +306,7 @@ public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) /// /// Get MassFlow from KilogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromKilogramsPerSecond(double kilogramspersecond) @@ -312,6 +321,7 @@ public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) /// /// Get MassFlow from MegapoundsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMegapoundsPerHour(double megapoundsperhour) @@ -326,6 +336,7 @@ public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) /// /// Get MassFlow from MicrogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMicrogramsPerSecond(double microgramspersecond) @@ -340,6 +351,7 @@ public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond /// /// Get MassFlow from MilligramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMilligramsPerSecond(double milligramspersecond) @@ -354,6 +366,7 @@ public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond /// /// Get MassFlow from NanogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromNanogramsPerSecond(double nanogramspersecond) @@ -368,6 +381,7 @@ public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) /// /// Get MassFlow from PoundsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromPoundsPerHour(double poundsperhour) @@ -382,6 +396,7 @@ public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) /// /// Get MassFlow from ShortTonsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromShortTonsPerHour(double shorttonsperhour) @@ -396,6 +411,7 @@ public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) /// /// Get MassFlow from TonnesPerDay. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromTonnesPerDay(double tonnesperday) @@ -410,6 +426,7 @@ public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) /// /// Get MassFlow from TonnesPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromTonnesPerHour(double tonnesperhour) diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index 7fc96defff..f88493f6a0 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MassFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MassFlux() if(unit == MassFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -149,6 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get MassFlux from GramsPerSecondPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlux FromGramsPerSecondPerSquareMeter(double gramspersecondpersquaremeter) @@ -163,6 +166,7 @@ public static MassFlux FromGramsPerSecondPerSquareMeter(QuantityValue gramsperse /// /// Get MassFlux from KilogramsPerSecondPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlux FromKilogramsPerSecondPerSquareMeter(double kilogramspersecondpersquaremeter) diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 5a7d16d447..c20bf95dff 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MassMomentOfInertia() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MassMomentOfInertia() if(unit == MassMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -269,6 +271,7 @@ public static BaseDimensions BaseDimensions /// /// Get MassMomentOfInertia from GramSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareCentimeters(double gramsquarecentimeters) @@ -283,6 +286,7 @@ public static MassMomentOfInertia FromGramSquareCentimeters(QuantityValue gramsq /// /// Get MassMomentOfInertia from GramSquareDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareDecimeters(double gramsquaredecimeters) @@ -297,6 +301,7 @@ public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsqu /// /// Get MassMomentOfInertia from GramSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareMeters(double gramsquaremeters) @@ -311,6 +316,7 @@ public static MassMomentOfInertia FromGramSquareMeters(QuantityValue gramsquarem /// /// Get MassMomentOfInertia from GramSquareMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareMillimeters(double gramsquaremillimeters) @@ -325,6 +331,7 @@ public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsq /// /// Get MassMomentOfInertia from KilogramSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareCentimeters(double kilogramsquarecentimeters) @@ -339,6 +346,7 @@ public static MassMomentOfInertia FromKilogramSquareCentimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilogramSquareDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareDecimeters(double kilogramsquaredecimeters) @@ -353,6 +361,7 @@ public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kil /// /// Get MassMomentOfInertia from KilogramSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareMeters(double kilogramsquaremeters) @@ -367,6 +376,7 @@ public static MassMomentOfInertia FromKilogramSquareMeters(QuantityValue kilogra /// /// Get MassMomentOfInertia from KilogramSquareMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareMillimeters(double kilogramsquaremillimeters) @@ -381,6 +391,7 @@ public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilotonneSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareCentimeters(double kilotonnesquarecentimeters) @@ -395,6 +406,7 @@ public static MassMomentOfInertia FromKilotonneSquareCentimeters(QuantityValue k /// /// Get MassMomentOfInertia from KilotonneSquareDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareDecimeters(double kilotonnesquaredecimeters) @@ -409,6 +421,7 @@ public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilotonneSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareMeters(double kilotonnesquaremeters) @@ -423,6 +436,7 @@ public static MassMomentOfInertia FromKilotonneSquareMeters(QuantityValue kiloto /// /// Get MassMomentOfInertia from KilotonneSquareMilimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareMilimeters(double kilotonnesquaremilimeters) @@ -437,6 +451,7 @@ public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue ki /// /// Get MassMomentOfInertia from MegatonneSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareCentimeters(double megatonnesquarecentimeters) @@ -451,6 +466,7 @@ public static MassMomentOfInertia FromMegatonneSquareCentimeters(QuantityValue m /// /// Get MassMomentOfInertia from MegatonneSquareDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareDecimeters(double megatonnesquaredecimeters) @@ -465,6 +481,7 @@ public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue me /// /// Get MassMomentOfInertia from MegatonneSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareMeters(double megatonnesquaremeters) @@ -479,6 +496,7 @@ public static MassMomentOfInertia FromMegatonneSquareMeters(QuantityValue megato /// /// Get MassMomentOfInertia from MegatonneSquareMilimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareMilimeters(double megatonnesquaremilimeters) @@ -493,6 +511,7 @@ public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue me /// /// Get MassMomentOfInertia from MilligramSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareCentimeters(double milligramsquarecentimeters) @@ -507,6 +526,7 @@ public static MassMomentOfInertia FromMilligramSquareCentimeters(QuantityValue m /// /// Get MassMomentOfInertia from MilligramSquareDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareDecimeters(double milligramsquaredecimeters) @@ -521,6 +541,7 @@ public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue mi /// /// Get MassMomentOfInertia from MilligramSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareMeters(double milligramsquaremeters) @@ -535,6 +556,7 @@ public static MassMomentOfInertia FromMilligramSquareMeters(QuantityValue millig /// /// Get MassMomentOfInertia from MilligramSquareMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareMillimeters(double milligramsquaremillimeters) @@ -549,6 +571,7 @@ public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue m /// /// Get MassMomentOfInertia from PoundSquareFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromPoundSquareFeet(double poundsquarefeet) @@ -563,6 +586,7 @@ public static MassMomentOfInertia FromPoundSquareFeet(QuantityValue poundsquaref /// /// Get MassMomentOfInertia from PoundSquareInches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromPoundSquareInches(double poundsquareinches) @@ -577,6 +601,7 @@ public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquar /// /// Get MassMomentOfInertia from TonneSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareCentimeters(double tonnesquarecentimeters) @@ -591,6 +616,7 @@ public static MassMomentOfInertia FromTonneSquareCentimeters(QuantityValue tonne /// /// Get MassMomentOfInertia from TonneSquareDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareDecimeters(double tonnesquaredecimeters) @@ -605,6 +631,7 @@ public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnes /// /// Get MassMomentOfInertia from TonneSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareMeters(double tonnesquaremeters) @@ -619,6 +646,7 @@ public static MassMomentOfInertia FromTonneSquareMeters(QuantityValue tonnesquar /// /// Get MassMomentOfInertia from TonneSquareMilimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareMilimeters(double tonnesquaremilimeters) diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 75d55e12a4..89522b44f4 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MolarEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MolarEnergy() if(unit == MolarEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get MolarEnergy from JoulesPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEnergy FromJoulesPerMole(double joulespermole) @@ -168,6 +171,7 @@ public static MolarEnergy FromJoulesPerMole(QuantityValue joulespermole) /// /// Get MolarEnergy from KilojoulesPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEnergy FromKilojoulesPerMole(double kilojoulespermole) @@ -182,6 +186,7 @@ public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) /// /// Get MolarEnergy from MegajoulesPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEnergy FromMegajoulesPerMole(double megajoulespermole) diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index d268149d27..be9e2836f4 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MolarEntropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MolarEntropy() if(unit == MolarEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get MolarEntropy from JoulesPerMoleKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEntropy FromJoulesPerMoleKelvin(double joulespermolekelvin) @@ -168,6 +171,7 @@ public static MolarEntropy FromJoulesPerMoleKelvin(QuantityValue joulespermoleke /// /// Get MolarEntropy from KilojoulesPerMoleKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEntropy FromKilojoulesPerMoleKelvin(double kilojoulespermolekelvin) @@ -182,6 +186,7 @@ public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulesp /// /// Get MolarEntropy from MegajoulesPerMoleKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEntropy FromMegajoulesPerMoleKelvin(double megajoulespermolekelvin) diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 3bec571f22..415482397c 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MolarMass() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static MolarMass() if(unit == MolarMassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -199,6 +201,7 @@ public static BaseDimensions BaseDimensions /// /// Get MolarMass from CentigramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromCentigramsPerMole(double centigramspermole) @@ -213,6 +216,7 @@ public static MolarMass FromCentigramsPerMole(QuantityValue centigramspermole) /// /// Get MolarMass from DecagramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromDecagramsPerMole(double decagramspermole) @@ -227,6 +231,7 @@ public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) /// /// Get MolarMass from DecigramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromDecigramsPerMole(double decigramspermole) @@ -241,6 +246,7 @@ public static MolarMass FromDecigramsPerMole(QuantityValue decigramspermole) /// /// Get MolarMass from GramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromGramsPerMole(double gramspermole) @@ -255,6 +261,7 @@ public static MolarMass FromGramsPerMole(QuantityValue gramspermole) /// /// Get MolarMass from HectogramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromHectogramsPerMole(double hectogramspermole) @@ -269,6 +276,7 @@ public static MolarMass FromHectogramsPerMole(QuantityValue hectogramspermole) /// /// Get MolarMass from KilogramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromKilogramsPerMole(double kilogramspermole) @@ -283,6 +291,7 @@ public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) /// /// Get MolarMass from KilopoundsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromKilopoundsPerMole(double kilopoundspermole) @@ -297,6 +306,7 @@ public static MolarMass FromKilopoundsPerMole(QuantityValue kilopoundspermole) /// /// Get MolarMass from MegapoundsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMegapoundsPerMole(double megapoundspermole) @@ -311,6 +321,7 @@ public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) /// /// Get MolarMass from MicrogramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMicrogramsPerMole(double microgramspermole) @@ -325,6 +336,7 @@ public static MolarMass FromMicrogramsPerMole(QuantityValue microgramspermole) /// /// Get MolarMass from MilligramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMilligramsPerMole(double milligramspermole) @@ -339,6 +351,7 @@ public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) /// /// Get MolarMass from NanogramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromNanogramsPerMole(double nanogramspermole) @@ -353,6 +366,7 @@ public static MolarMass FromNanogramsPerMole(QuantityValue nanogramspermole) /// /// Get MolarMass from PoundsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromPoundsPerMole(double poundspermole) diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index f25cefd5d0..f124e5f0de 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Molarity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Molarity() if(unit == MolarityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -179,6 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get Molarity from CentimolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromCentimolesPerLiter(double centimolesperliter) @@ -193,6 +196,7 @@ public static Molarity FromCentimolesPerLiter(QuantityValue centimolesperliter) /// /// Get Molarity from DecimolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromDecimolesPerLiter(double decimolesperliter) @@ -207,6 +211,7 @@ public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) /// /// Get Molarity from MicromolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMicromolesPerLiter(double micromolesperliter) @@ -221,6 +226,7 @@ public static Molarity FromMicromolesPerLiter(QuantityValue micromolesperliter) /// /// Get Molarity from MillimolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMillimolesPerLiter(double millimolesperliter) @@ -235,6 +241,7 @@ public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) /// /// Get Molarity from MolesPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMolesPerCubicMeter(double molespercubicmeter) @@ -249,6 +256,7 @@ public static Molarity FromMolesPerCubicMeter(QuantityValue molespercubicmeter) /// /// Get Molarity from MolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMolesPerLiter(double molesperliter) @@ -263,6 +271,7 @@ public static Molarity FromMolesPerLiter(QuantityValue molesperliter) /// /// Get Molarity from NanomolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromNanomolesPerLiter(double nanomolesperliter) @@ -277,6 +286,7 @@ public static Molarity FromNanomolesPerLiter(QuantityValue nanomolesperliter) /// /// Get Molarity from PicomolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromPicomolesPerLiter(double picomolesperliter) diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 33554f2ecc..6f5328b446 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Permeability() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Permeability() if(unit == PermeabilityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Permeability from HenriesPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Permeability FromHenriesPerMeter(double henriespermeter) diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index b52fa37930..b30afd7fee 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Permittivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Permittivity() if(unit == PermittivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -144,6 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Permittivity from FaradsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Permittivity FromFaradsPerMeter(double faradspermeter) diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index f83a8256d0..48b7f3e2c3 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Power() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -239,6 +241,7 @@ public static BaseDimensions BaseDimensions /// /// Get Power from BoilerHorsepower. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromBoilerHorsepower(double boilerhorsepower) @@ -253,6 +256,7 @@ public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) /// /// Get Power from BritishThermalUnitsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromBritishThermalUnitsPerHour(double britishthermalunitsperhour) @@ -267,6 +271,7 @@ public static Power FromBritishThermalUnitsPerHour(QuantityValue britishthermalu /// /// Get Power from Decawatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromDecawatts(double decawatts) @@ -281,6 +286,7 @@ public static Power FromDecawatts(QuantityValue decawatts) /// /// Get Power from Deciwatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromDeciwatts(double deciwatts) @@ -295,6 +301,7 @@ public static Power FromDeciwatts(QuantityValue deciwatts) /// /// Get Power from ElectricalHorsepower. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromElectricalHorsepower(double electricalhorsepower) @@ -309,6 +316,7 @@ public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) /// /// Get Power from Femtowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromFemtowatts(double femtowatts) @@ -323,6 +331,7 @@ public static Power FromFemtowatts(QuantityValue femtowatts) /// /// Get Power from Gigawatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromGigawatts(double gigawatts) @@ -337,6 +346,7 @@ public static Power FromGigawatts(QuantityValue gigawatts) /// /// Get Power from HydraulicHorsepower. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromHydraulicHorsepower(double hydraulichorsepower) @@ -351,6 +361,7 @@ public static Power FromHydraulicHorsepower(QuantityValue hydraulichorsepower) /// /// Get Power from KilobritishThermalUnitsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromKilobritishThermalUnitsPerHour(double kilobritishthermalunitsperhour) @@ -365,6 +376,7 @@ public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritish /// /// Get Power from Kilowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromKilowatts(double kilowatts) @@ -379,6 +391,7 @@ public static Power FromKilowatts(QuantityValue kilowatts) /// /// Get Power from MechanicalHorsepower. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMechanicalHorsepower(double mechanicalhorsepower) @@ -393,6 +406,7 @@ public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) /// /// Get Power from Megawatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMegawatts(double megawatts) @@ -407,6 +421,7 @@ public static Power FromMegawatts(QuantityValue megawatts) /// /// Get Power from MetricHorsepower. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMetricHorsepower(double metrichorsepower) @@ -421,6 +436,7 @@ public static Power FromMetricHorsepower(QuantityValue metrichorsepower) /// /// Get Power from Microwatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMicrowatts(double microwatts) @@ -435,6 +451,7 @@ public static Power FromMicrowatts(QuantityValue microwatts) /// /// Get Power from Milliwatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMilliwatts(double milliwatts) @@ -449,6 +466,7 @@ public static Power FromMilliwatts(QuantityValue milliwatts) /// /// Get Power from Nanowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromNanowatts(double nanowatts) @@ -463,6 +481,7 @@ public static Power FromNanowatts(QuantityValue nanowatts) /// /// Get Power from Petawatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromPetawatts(double petawatts) @@ -477,6 +496,7 @@ public static Power FromPetawatts(QuantityValue petawatts) /// /// Get Power from Picowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromPicowatts(double picowatts) @@ -491,6 +511,7 @@ public static Power FromPicowatts(QuantityValue picowatts) /// /// Get Power from Terawatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromTerawatts(double terawatts) @@ -505,6 +526,7 @@ public static Power FromTerawatts(QuantityValue terawatts) /// /// Get Power from Watts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromWatts(double watts) diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index bb32edabf2..96475c0e53 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static PowerDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static PowerDensity() if(unit == PowerDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -359,6 +361,7 @@ public static BaseDimensions BaseDimensions /// /// Get PowerDensity from DecawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerCubicFoot(double decawattspercubicfoot) @@ -373,6 +376,7 @@ public static PowerDensity FromDecawattsPerCubicFoot(QuantityValue decawattsperc /// /// Get PowerDensity from DecawattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerCubicInch(double decawattspercubicinch) @@ -387,6 +391,7 @@ public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattsperc /// /// Get PowerDensity from DecawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerCubicMeter(double decawattspercubicmeter) @@ -401,6 +406,7 @@ public static PowerDensity FromDecawattsPerCubicMeter(QuantityValue decawattsper /// /// Get PowerDensity from DecawattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerLiter(double decawattsperliter) @@ -415,6 +421,7 @@ public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter /// /// Get PowerDensity from DeciwattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerCubicFoot(double deciwattspercubicfoot) @@ -429,6 +436,7 @@ public static PowerDensity FromDeciwattsPerCubicFoot(QuantityValue deciwattsperc /// /// Get PowerDensity from DeciwattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerCubicInch(double deciwattspercubicinch) @@ -443,6 +451,7 @@ public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattsperc /// /// Get PowerDensity from DeciwattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerCubicMeter(double deciwattspercubicmeter) @@ -457,6 +466,7 @@ public static PowerDensity FromDeciwattsPerCubicMeter(QuantityValue deciwattsper /// /// Get PowerDensity from DeciwattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerLiter(double deciwattsperliter) @@ -471,6 +481,7 @@ public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter /// /// Get PowerDensity from GigawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerCubicFoot(double gigawattspercubicfoot) @@ -485,6 +496,7 @@ public static PowerDensity FromGigawattsPerCubicFoot(QuantityValue gigawattsperc /// /// Get PowerDensity from GigawattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerCubicInch(double gigawattspercubicinch) @@ -499,6 +511,7 @@ public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattsperc /// /// Get PowerDensity from GigawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerCubicMeter(double gigawattspercubicmeter) @@ -513,6 +526,7 @@ public static PowerDensity FromGigawattsPerCubicMeter(QuantityValue gigawattsper /// /// Get PowerDensity from GigawattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerLiter(double gigawattsperliter) @@ -527,6 +541,7 @@ public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter /// /// Get PowerDensity from KilowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerCubicFoot(double kilowattspercubicfoot) @@ -541,6 +556,7 @@ public static PowerDensity FromKilowattsPerCubicFoot(QuantityValue kilowattsperc /// /// Get PowerDensity from KilowattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerCubicInch(double kilowattspercubicinch) @@ -555,6 +571,7 @@ public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattsperc /// /// Get PowerDensity from KilowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerCubicMeter(double kilowattspercubicmeter) @@ -569,6 +586,7 @@ public static PowerDensity FromKilowattsPerCubicMeter(QuantityValue kilowattsper /// /// Get PowerDensity from KilowattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerLiter(double kilowattsperliter) @@ -583,6 +601,7 @@ public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter /// /// Get PowerDensity from MegawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerCubicFoot(double megawattspercubicfoot) @@ -597,6 +616,7 @@ public static PowerDensity FromMegawattsPerCubicFoot(QuantityValue megawattsperc /// /// Get PowerDensity from MegawattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerCubicInch(double megawattspercubicinch) @@ -611,6 +631,7 @@ public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattsperc /// /// Get PowerDensity from MegawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerCubicMeter(double megawattspercubicmeter) @@ -625,6 +646,7 @@ public static PowerDensity FromMegawattsPerCubicMeter(QuantityValue megawattsper /// /// Get PowerDensity from MegawattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerLiter(double megawattsperliter) @@ -639,6 +661,7 @@ public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter /// /// Get PowerDensity from MicrowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerCubicFoot(double microwattspercubicfoot) @@ -653,6 +676,7 @@ public static PowerDensity FromMicrowattsPerCubicFoot(QuantityValue microwattspe /// /// Get PowerDensity from MicrowattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerCubicInch(double microwattspercubicinch) @@ -667,6 +691,7 @@ public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspe /// /// Get PowerDensity from MicrowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerCubicMeter(double microwattspercubicmeter) @@ -681,6 +706,7 @@ public static PowerDensity FromMicrowattsPerCubicMeter(QuantityValue microwattsp /// /// Get PowerDensity from MicrowattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerLiter(double microwattsperliter) @@ -695,6 +721,7 @@ public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperlit /// /// Get PowerDensity from MilliwattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerCubicFoot(double milliwattspercubicfoot) @@ -709,6 +736,7 @@ public static PowerDensity FromMilliwattsPerCubicFoot(QuantityValue milliwattspe /// /// Get PowerDensity from MilliwattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerCubicInch(double milliwattspercubicinch) @@ -723,6 +751,7 @@ public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspe /// /// Get PowerDensity from MilliwattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerCubicMeter(double milliwattspercubicmeter) @@ -737,6 +766,7 @@ public static PowerDensity FromMilliwattsPerCubicMeter(QuantityValue milliwattsp /// /// Get PowerDensity from MilliwattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerLiter(double milliwattsperliter) @@ -751,6 +781,7 @@ public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperlit /// /// Get PowerDensity from NanowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerCubicFoot(double nanowattspercubicfoot) @@ -765,6 +796,7 @@ public static PowerDensity FromNanowattsPerCubicFoot(QuantityValue nanowattsperc /// /// Get PowerDensity from NanowattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerCubicInch(double nanowattspercubicinch) @@ -779,6 +811,7 @@ public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattsperc /// /// Get PowerDensity from NanowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerCubicMeter(double nanowattspercubicmeter) @@ -793,6 +826,7 @@ public static PowerDensity FromNanowattsPerCubicMeter(QuantityValue nanowattsper /// /// Get PowerDensity from NanowattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerLiter(double nanowattsperliter) @@ -807,6 +841,7 @@ public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter /// /// Get PowerDensity from PicowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerCubicFoot(double picowattspercubicfoot) @@ -821,6 +856,7 @@ public static PowerDensity FromPicowattsPerCubicFoot(QuantityValue picowattsperc /// /// Get PowerDensity from PicowattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerCubicInch(double picowattspercubicinch) @@ -835,6 +871,7 @@ public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattsperc /// /// Get PowerDensity from PicowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerCubicMeter(double picowattspercubicmeter) @@ -849,6 +886,7 @@ public static PowerDensity FromPicowattsPerCubicMeter(QuantityValue picowattsper /// /// Get PowerDensity from PicowattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerLiter(double picowattsperliter) @@ -863,6 +901,7 @@ public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter /// /// Get PowerDensity from TerawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerCubicFoot(double terawattspercubicfoot) @@ -877,6 +916,7 @@ public static PowerDensity FromTerawattsPerCubicFoot(QuantityValue terawattsperc /// /// Get PowerDensity from TerawattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerCubicInch(double terawattspercubicinch) @@ -891,6 +931,7 @@ public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattsperc /// /// Get PowerDensity from TerawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerCubicMeter(double terawattspercubicmeter) @@ -905,6 +946,7 @@ public static PowerDensity FromTerawattsPerCubicMeter(QuantityValue terawattsper /// /// Get PowerDensity from TerawattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerLiter(double terawattsperliter) @@ -919,6 +961,7 @@ public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter /// /// Get PowerDensity from WattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerCubicFoot(double wattspercubicfoot) @@ -933,6 +976,7 @@ public static PowerDensity FromWattsPerCubicFoot(QuantityValue wattspercubicfoot /// /// Get PowerDensity from WattsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerCubicInch(double wattspercubicinch) @@ -947,6 +991,7 @@ public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch /// /// Get PowerDensity from WattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerCubicMeter(double wattspercubicmeter) @@ -961,6 +1006,7 @@ public static PowerDensity FromWattsPerCubicMeter(QuantityValue wattspercubicmet /// /// Get PowerDensity from WattsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerLiter(double wattsperliter) diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 7f00035b07..fb6fa26a3e 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static PowerRatio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static PowerRatio() if(unit == PowerRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -148,6 +150,7 @@ public static BaseDimensions BaseDimensions /// /// Get PowerRatio from DecibelMilliwatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerRatio FromDecibelMilliwatts(double decibelmilliwatts) @@ -162,6 +165,7 @@ public static PowerRatio FromDecibelMilliwatts(QuantityValue decibelmilliwatts) /// /// Get PowerRatio from DecibelWatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerRatio FromDecibelWatts(double decibelwatts) diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 9b1ed49c46..d41790233a 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Pressure() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Pressure() if(unit == PressureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -324,6 +326,7 @@ public static BaseDimensions BaseDimensions /// /// Get Pressure from Atmospheres. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromAtmospheres(double atmospheres) @@ -338,6 +341,7 @@ public static Pressure FromAtmospheres(QuantityValue atmospheres) /// /// Get Pressure from Bars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromBars(double bars) @@ -352,6 +356,7 @@ public static Pressure FromBars(QuantityValue bars) /// /// Get Pressure from Centibars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromCentibars(double centibars) @@ -366,6 +371,7 @@ public static Pressure FromCentibars(QuantityValue centibars) /// /// Get Pressure from Decapascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromDecapascals(double decapascals) @@ -380,6 +386,7 @@ public static Pressure FromDecapascals(QuantityValue decapascals) /// /// Get Pressure from Decibars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromDecibars(double decibars) @@ -394,6 +401,7 @@ public static Pressure FromDecibars(QuantityValue decibars) /// /// Get Pressure from FeetOfHead. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromFeetOfHead(double feetofhead) @@ -408,6 +416,7 @@ public static Pressure FromFeetOfHead(QuantityValue feetofhead) /// /// Get Pressure from Gigapascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromGigapascals(double gigapascals) @@ -422,6 +431,7 @@ public static Pressure FromGigapascals(QuantityValue gigapascals) /// /// Get Pressure from Hectopascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromHectopascals(double hectopascals) @@ -436,6 +446,7 @@ public static Pressure FromHectopascals(QuantityValue hectopascals) /// /// Get Pressure from InchesOfMercury. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromInchesOfMercury(double inchesofmercury) @@ -450,6 +461,7 @@ public static Pressure FromInchesOfMercury(QuantityValue inchesofmercury) /// /// Get Pressure from Kilobars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilobars(double kilobars) @@ -464,6 +476,7 @@ public static Pressure FromKilobars(QuantityValue kilobars) /// /// Get Pressure from KilogramsForcePerSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilogramsForcePerSquareCentimeter(double kilogramsforcepersquarecentimeter) @@ -478,6 +491,7 @@ public static Pressure FromKilogramsForcePerSquareCentimeter(QuantityValue kilog /// /// Get Pressure from KilogramsForcePerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilogramsForcePerSquareMeter(double kilogramsforcepersquaremeter) @@ -492,6 +506,7 @@ public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsf /// /// Get Pressure from KilogramsForcePerSquareMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilogramsForcePerSquareMillimeter(double kilogramsforcepersquaremillimeter) @@ -506,6 +521,7 @@ public static Pressure FromKilogramsForcePerSquareMillimeter(QuantityValue kilog /// /// Get Pressure from KilonewtonsPerSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareCentimeter(double kilonewtonspersquarecentimeter) @@ -520,6 +536,7 @@ public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewt /// /// Get Pressure from KilonewtonsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareMeter(double kilonewtonspersquaremeter) @@ -534,6 +551,7 @@ public static Pressure FromKilonewtonsPerSquareMeter(QuantityValue kilonewtonspe /// /// Get Pressure from KilonewtonsPerSquareMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareMillimeter(double kilonewtonspersquaremillimeter) @@ -548,6 +566,7 @@ public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewt /// /// Get Pressure from Kilopascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilopascals(double kilopascals) @@ -562,6 +581,7 @@ public static Pressure FromKilopascals(QuantityValue kilopascals) /// /// Get Pressure from KilopoundsForcePerSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilopoundsForcePerSquareFoot(double kilopoundsforcepersquarefoot) @@ -576,6 +596,7 @@ public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopounds /// /// Get Pressure from KilopoundsForcePerSquareInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilopoundsForcePerSquareInch(double kilopoundsforcepersquareinch) @@ -590,6 +611,7 @@ public static Pressure FromKilopoundsForcePerSquareInch(QuantityValue kilopounds /// /// Get Pressure from Megabars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMegabars(double megabars) @@ -604,6 +626,7 @@ public static Pressure FromMegabars(QuantityValue megabars) /// /// Get Pressure from MeganewtonsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMeganewtonsPerSquareMeter(double meganewtonspersquaremeter) @@ -618,6 +641,7 @@ public static Pressure FromMeganewtonsPerSquareMeter(QuantityValue meganewtonspe /// /// Get Pressure from Megapascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMegapascals(double megapascals) @@ -632,6 +656,7 @@ public static Pressure FromMegapascals(QuantityValue megapascals) /// /// Get Pressure from MetersOfHead. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMetersOfHead(double metersofhead) @@ -646,6 +671,7 @@ public static Pressure FromMetersOfHead(QuantityValue metersofhead) /// /// Get Pressure from Micropascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMicropascals(double micropascals) @@ -660,6 +686,7 @@ public static Pressure FromMicropascals(QuantityValue micropascals) /// /// Get Pressure from Millibars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMillibars(double millibars) @@ -674,6 +701,7 @@ public static Pressure FromMillibars(QuantityValue millibars) /// /// Get Pressure from MillimetersOfMercury. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMillimetersOfMercury(double millimetersofmercury) @@ -688,6 +716,7 @@ public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercu /// /// Get Pressure from NewtonsPerSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromNewtonsPerSquareCentimeter(double newtonspersquarecentimeter) @@ -702,6 +731,7 @@ public static Pressure FromNewtonsPerSquareCentimeter(QuantityValue newtonspersq /// /// Get Pressure from NewtonsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromNewtonsPerSquareMeter(double newtonspersquaremeter) @@ -716,6 +746,7 @@ public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquarem /// /// Get Pressure from NewtonsPerSquareMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromNewtonsPerSquareMillimeter(double newtonspersquaremillimeter) @@ -730,6 +761,7 @@ public static Pressure FromNewtonsPerSquareMillimeter(QuantityValue newtonspersq /// /// Get Pressure from Pascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPascals(double pascals) @@ -744,6 +776,7 @@ public static Pressure FromPascals(QuantityValue pascals) /// /// Get Pressure from PoundsForcePerSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPoundsForcePerSquareFoot(double poundsforcepersquarefoot) @@ -758,6 +791,7 @@ public static Pressure FromPoundsForcePerSquareFoot(QuantityValue poundsforceper /// /// Get Pressure from PoundsForcePerSquareInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPoundsForcePerSquareInch(double poundsforcepersquareinch) @@ -772,6 +806,7 @@ public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforceper /// /// Get Pressure from TechnicalAtmospheres. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTechnicalAtmospheres(double technicalatmospheres) @@ -786,6 +821,7 @@ public static Pressure FromTechnicalAtmospheres(QuantityValue technicalatmospher /// /// Get Pressure from TonnesForcePerSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareCentimeter(double tonnesforcepersquarecentimeter) @@ -800,6 +836,7 @@ public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesfo /// /// Get Pressure from TonnesForcePerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareMeter(double tonnesforcepersquaremeter) @@ -814,6 +851,7 @@ public static Pressure FromTonnesForcePerSquareMeter(QuantityValue tonnesforcepe /// /// Get Pressure from TonnesForcePerSquareMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareMillimeter(double tonnesforcepersquaremillimeter) @@ -828,6 +866,7 @@ public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesfo /// /// Get Pressure from Torrs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTorrs(double torrs) diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index d4272d02f0..ae29fd01b2 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static PressureChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static PressureChangeRate() if(unit == PressureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -159,6 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get PressureChangeRate from AtmospheresPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromAtmospheresPerSecond(double atmospherespersecond) @@ -173,6 +176,7 @@ public static PressureChangeRate FromAtmospheresPerSecond(QuantityValue atmosphe /// /// Get PressureChangeRate from KilopascalsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromKilopascalsPerSecond(double kilopascalspersecond) @@ -187,6 +191,7 @@ public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopasc /// /// Get PressureChangeRate from MegapascalsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromMegapascalsPerSecond(double megapascalspersecond) @@ -201,6 +206,7 @@ public static PressureChangeRate FromMegapascalsPerSecond(QuantityValue megapasc /// /// Get PressureChangeRate from PascalsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromPascalsPerSecond(double pascalspersecond) diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 738f138e7c..5cd499aca0 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Ratio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static Ratio() if(unit == RatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -168,6 +170,7 @@ public static BaseDimensions BaseDimensions /// /// Get Ratio from DecimalFractions. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromDecimalFractions(double decimalfractions) @@ -182,6 +185,7 @@ public static Ratio FromDecimalFractions(QuantityValue decimalfractions) /// /// Get Ratio from PartsPerBillion. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerBillion(double partsperbillion) @@ -196,6 +200,7 @@ public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) /// /// Get Ratio from PartsPerMillion. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerMillion(double partspermillion) @@ -210,6 +215,7 @@ public static Ratio FromPartsPerMillion(QuantityValue partspermillion) /// /// Get Ratio from PartsPerThousand. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerThousand(double partsperthousand) @@ -224,6 +230,7 @@ public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) /// /// Get Ratio from PartsPerTrillion. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerTrillion(double partspertrillion) @@ -238,6 +245,7 @@ public static Ratio FromPartsPerTrillion(QuantityValue partspertrillion) /// /// Get Ratio from Percent. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPercent(double percent) diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index dbff2b914b..8aeda23be5 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ReactiveEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ReactiveEnergy() if(unit == ReactiveEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get ReactiveEnergy from KilovoltampereReactiveHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactiveEnergy FromKilovoltampereReactiveHours(double kilovoltamperereactivehours) @@ -168,6 +171,7 @@ public static ReactiveEnergy FromKilovoltampereReactiveHours(QuantityValue kilov /// /// Get ReactiveEnergy from MegavoltampereReactiveHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactiveEnergy FromMegavoltampereReactiveHours(double megavoltamperereactivehours) @@ -182,6 +186,7 @@ public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megav /// /// Get ReactiveEnergy from VoltampereReactiveHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactiveEnergy FromVoltampereReactiveHours(double voltamperereactivehours) diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index 71565b2f36..dd16e29098 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ReactivePower() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ReactivePower() if(unit == ReactivePowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -159,6 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ReactivePower from GigavoltamperesReactive. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromGigavoltamperesReactive(double gigavoltamperesreactive) @@ -173,6 +176,7 @@ public static ReactivePower FromGigavoltamperesReactive(QuantityValue gigavoltam /// /// Get ReactivePower from KilovoltamperesReactive. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromKilovoltamperesReactive(double kilovoltamperesreactive) @@ -187,6 +191,7 @@ public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltam /// /// Get ReactivePower from MegavoltamperesReactive. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromMegavoltamperesReactive(double megavoltamperesreactive) @@ -201,6 +206,7 @@ public static ReactivePower FromMegavoltamperesReactive(QuantityValue megavoltam /// /// Get ReactivePower from VoltamperesReactive. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromVoltamperesReactive(double voltamperesreactive) diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 02fb49c631..b3da859a51 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static RotationalAcceleration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static RotationalAcceleration() if(unit == RotationalAccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalAcceleration from DegreesPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalAcceleration FromDegreesPerSecondSquared(double degreespersecondsquared) @@ -168,6 +171,7 @@ public static RotationalAcceleration FromDegreesPerSecondSquared(QuantityValue d /// /// Get RotationalAcceleration from RadiansPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalAcceleration FromRadiansPerSecondSquared(double radianspersecondsquared) @@ -182,6 +186,7 @@ public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue r /// /// Get RotationalAcceleration from RevolutionsPerMinutePerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(double revolutionsperminutepersecond) diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 1e39a23e6c..bac0b2696a 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static RotationalSpeed() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static RotationalSpeed() if(unit == RotationalSpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -204,6 +206,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalSpeed from CentiradiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromCentiradiansPerSecond(double centiradianspersecond) @@ -218,6 +221,7 @@ public static RotationalSpeed FromCentiradiansPerSecond(QuantityValue centiradia /// /// Get RotationalSpeed from DeciradiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDeciradiansPerSecond(double deciradianspersecond) @@ -232,6 +236,7 @@ public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradians /// /// Get RotationalSpeed from DegreesPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDegreesPerMinute(double degreesperminute) @@ -246,6 +251,7 @@ public static RotationalSpeed FromDegreesPerMinute(QuantityValue degreesperminut /// /// Get RotationalSpeed from DegreesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDegreesPerSecond(double degreespersecond) @@ -260,6 +266,7 @@ public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecon /// /// Get RotationalSpeed from MicrodegreesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMicrodegreesPerSecond(double microdegreespersecond) @@ -274,6 +281,7 @@ public static RotationalSpeed FromMicrodegreesPerSecond(QuantityValue microdegre /// /// Get RotationalSpeed from MicroradiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMicroradiansPerSecond(double microradianspersecond) @@ -288,6 +296,7 @@ public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradia /// /// Get RotationalSpeed from MillidegreesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMillidegreesPerSecond(double millidegreespersecond) @@ -302,6 +311,7 @@ public static RotationalSpeed FromMillidegreesPerSecond(QuantityValue millidegre /// /// Get RotationalSpeed from MilliradiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMilliradiansPerSecond(double milliradianspersecond) @@ -316,6 +326,7 @@ public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradia /// /// Get RotationalSpeed from NanodegreesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromNanodegreesPerSecond(double nanodegreespersecond) @@ -330,6 +341,7 @@ public static RotationalSpeed FromNanodegreesPerSecond(QuantityValue nanodegrees /// /// Get RotationalSpeed from NanoradiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromNanoradiansPerSecond(double nanoradianspersecond) @@ -344,6 +356,7 @@ public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradians /// /// Get RotationalSpeed from RadiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromRadiansPerSecond(double radianspersecond) @@ -358,6 +371,7 @@ public static RotationalSpeed FromRadiansPerSecond(QuantityValue radianspersecon /// /// Get RotationalSpeed from RevolutionsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromRevolutionsPerMinute(double revolutionsperminute) @@ -372,6 +386,7 @@ public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutions /// /// Get RotationalSpeed from RevolutionsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromRevolutionsPerSecond(double revolutionspersecond) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 8bf6de9434..3e1c56dcb9 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static RotationalStiffness() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static RotationalStiffness() if(unit == RotationalStiffnessUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalStiffness from KilonewtonMetersPerRadian. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffness FromKilonewtonMetersPerRadian(double kilonewtonmetersperradian) @@ -168,6 +171,7 @@ public static RotationalStiffness FromKilonewtonMetersPerRadian(QuantityValue ki /// /// Get RotationalStiffness from MeganewtonMetersPerRadian. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffness FromMeganewtonMetersPerRadian(double meganewtonmetersperradian) @@ -182,6 +186,7 @@ public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue me /// /// Get RotationalStiffness from NewtonMetersPerRadian. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffness FromNewtonMetersPerRadian(double newtonmetersperradian) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 450cad0399..5caca3d77f 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static RotationalStiffnessPerLength() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static RotationalStiffnessPerLength() if(unit == RotationalStiffnessPerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -154,6 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(double kilonewtonmetersperradianpermeter) @@ -168,6 +171,7 @@ public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter /// /// Get RotationalStiffnessPerLength from MeganewtonMetersPerRadianPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(double meganewtonmetersperradianpermeter) @@ -182,6 +186,7 @@ public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter /// /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(double newtonmetersperradianpermeter) diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index cfd85fc85e..c0ca84ee21 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static SolidAngle() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static SolidAngle() if(unit == SolidAngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -143,6 +145,7 @@ public static BaseDimensions BaseDimensions /// /// Get SolidAngle from Steradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SolidAngle FromSteradians(double steradians) diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index ed49eb7f15..e54e9bfa4c 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static SpecificEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static SpecificEnergy() if(unit == SpecificEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -179,6 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificEnergy from CaloriesPerGram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromCaloriesPerGram(double caloriespergram) @@ -193,6 +196,7 @@ public static SpecificEnergy FromCaloriesPerGram(QuantityValue caloriespergram) /// /// Get SpecificEnergy from JoulesPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromJoulesPerKilogram(double joulesperkilogram) @@ -207,6 +211,7 @@ public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogr /// /// Get SpecificEnergy from KilocaloriesPerGram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromKilocaloriesPerGram(double kilocaloriespergram) @@ -221,6 +226,7 @@ public static SpecificEnergy FromKilocaloriesPerGram(QuantityValue kilocaloriesp /// /// Get SpecificEnergy from KilojoulesPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromKilojoulesPerKilogram(double kilojoulesperkilogram) @@ -235,6 +241,7 @@ public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesp /// /// Get SpecificEnergy from KilowattHoursPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromKilowattHoursPerKilogram(double kilowatthoursperkilogram) @@ -249,6 +256,7 @@ public static SpecificEnergy FromKilowattHoursPerKilogram(QuantityValue kilowatt /// /// Get SpecificEnergy from MegajoulesPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromMegajoulesPerKilogram(double megajoulesperkilogram) @@ -263,6 +271,7 @@ public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesp /// /// Get SpecificEnergy from MegawattHoursPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromMegawattHoursPerKilogram(double megawatthoursperkilogram) @@ -277,6 +286,7 @@ public static SpecificEnergy FromMegawattHoursPerKilogram(QuantityValue megawatt /// /// Get SpecificEnergy from WattHoursPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromWattHoursPerKilogram(double watthoursperkilogram) diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 0ea0131f12..8532c5d830 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static SpecificEntropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static SpecificEntropy() if(unit == SpecificEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -179,6 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificEntropy from CaloriesPerGramKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromCaloriesPerGramKelvin(double caloriespergramkelvin) @@ -193,6 +196,7 @@ public static SpecificEntropy FromCaloriesPerGramKelvin(QuantityValue caloriespe /// /// Get SpecificEntropy from JoulesPerKilogramDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(double joulesperkilogramdegreecelsius) @@ -207,6 +211,7 @@ public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue j /// /// Get SpecificEntropy from JoulesPerKilogramKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromJoulesPerKilogramKelvin(double joulesperkilogramkelvin) @@ -221,6 +226,7 @@ public static SpecificEntropy FromJoulesPerKilogramKelvin(QuantityValue joulespe /// /// Get SpecificEntropy from KilocaloriesPerGramKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilocaloriesPerGramKelvin(double kilocaloriespergramkelvin) @@ -235,6 +241,7 @@ public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kiloca /// /// Get SpecificEntropy from KilojoulesPerKilogramDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(double kilojoulesperkilogramdegreecelsius) @@ -249,6 +256,7 @@ public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(QuantityVal /// /// Get SpecificEntropy from KilojoulesPerKilogramKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilojoulesPerKilogramKelvin(double kilojoulesperkilogramkelvin) @@ -263,6 +271,7 @@ public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilo /// /// Get SpecificEntropy from MegajoulesPerKilogramDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(double megajoulesperkilogramdegreecelsius) @@ -277,6 +286,7 @@ public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(QuantityVal /// /// Get SpecificEntropy from MegajoulesPerKilogramKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromMegajoulesPerKilogramKelvin(double megajoulesperkilogramkelvin) diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 0bf0c2a59c..2e2a36831c 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static SpecificVolume() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static SpecificVolume() if(unit == SpecificVolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -149,6 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificVolume from CubicFeetPerPound. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificVolume FromCubicFeetPerPound(double cubicfeetperpound) @@ -163,6 +166,7 @@ public static SpecificVolume FromCubicFeetPerPound(QuantityValue cubicfeetperpou /// /// Get SpecificVolume from CubicMetersPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificVolume FromCubicMetersPerKilogram(double cubicmetersperkilogram) diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 976d3902b6..7c6102ff5b 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static SpecificWeight() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static SpecificWeight() if(unit == SpecificWeightUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -224,6 +226,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificWeight from KilogramsForcePerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilogramsForcePerCubicCentimeter(double kilogramsforcepercubiccentimeter) @@ -238,6 +241,7 @@ public static SpecificWeight FromKilogramsForcePerCubicCentimeter(QuantityValue /// /// Get SpecificWeight from KilogramsForcePerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilogramsForcePerCubicMeter(double kilogramsforcepercubicmeter) @@ -252,6 +256,7 @@ public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilog /// /// Get SpecificWeight from KilogramsForcePerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilogramsForcePerCubicMillimeter(double kilogramsforcepercubicmillimeter) @@ -266,6 +271,7 @@ public static SpecificWeight FromKilogramsForcePerCubicMillimeter(QuantityValue /// /// Get SpecificWeight from KilonewtonsPerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicCentimeter(double kilonewtonspercubiccentimeter) @@ -280,6 +286,7 @@ public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kil /// /// Get SpecificWeight from KilonewtonsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicMeter(double kilonewtonspercubicmeter) @@ -294,6 +301,7 @@ public static SpecificWeight FromKilonewtonsPerCubicMeter(QuantityValue kilonewt /// /// Get SpecificWeight from KilonewtonsPerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicMillimeter(double kilonewtonspercubicmillimeter) @@ -308,6 +316,7 @@ public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kil /// /// Get SpecificWeight from KilopoundsForcePerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilopoundsForcePerCubicFoot(double kilopoundsforcepercubicfoot) @@ -322,6 +331,7 @@ public static SpecificWeight FromKilopoundsForcePerCubicFoot(QuantityValue kilop /// /// Get SpecificWeight from KilopoundsForcePerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilopoundsForcePerCubicInch(double kilopoundsforcepercubicinch) @@ -336,6 +346,7 @@ public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilop /// /// Get SpecificWeight from MeganewtonsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromMeganewtonsPerCubicMeter(double meganewtonspercubicmeter) @@ -350,6 +361,7 @@ public static SpecificWeight FromMeganewtonsPerCubicMeter(QuantityValue meganewt /// /// Get SpecificWeight from NewtonsPerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicCentimeter(double newtonspercubiccentimeter) @@ -364,6 +376,7 @@ public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtons /// /// Get SpecificWeight from NewtonsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicMeter(double newtonspercubicmeter) @@ -378,6 +391,7 @@ public static SpecificWeight FromNewtonsPerCubicMeter(QuantityValue newtonspercu /// /// Get SpecificWeight from NewtonsPerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicMillimeter(double newtonspercubicmillimeter) @@ -392,6 +406,7 @@ public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtons /// /// Get SpecificWeight from PoundsForcePerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromPoundsForcePerCubicFoot(double poundsforcepercubicfoot) @@ -406,6 +421,7 @@ public static SpecificWeight FromPoundsForcePerCubicFoot(QuantityValue poundsfor /// /// Get SpecificWeight from PoundsForcePerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromPoundsForcePerCubicInch(double poundsforcepercubicinch) @@ -420,6 +436,7 @@ public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsfor /// /// Get SpecificWeight from TonnesForcePerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromTonnesForcePerCubicCentimeter(double tonnesforcepercubiccentimeter) @@ -434,6 +451,7 @@ public static SpecificWeight FromTonnesForcePerCubicCentimeter(QuantityValue ton /// /// Get SpecificWeight from TonnesForcePerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromTonnesForcePerCubicMeter(double tonnesforcepercubicmeter) @@ -448,6 +466,7 @@ public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesfo /// /// Get SpecificWeight from TonnesForcePerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromTonnesForcePerCubicMillimeter(double tonnesforcepercubicmillimeter) diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 9c5f5665d6..6ded617e3f 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Speed() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Speed() if(unit == SpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -299,6 +301,7 @@ public static BaseDimensions BaseDimensions /// /// Get Speed from CentimetersPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromCentimetersPerHour(double centimetersperhour) @@ -313,6 +316,7 @@ public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) /// /// Get Speed from CentimetersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromCentimetersPerMinutes(double centimetersperminutes) @@ -327,6 +331,7 @@ public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminute /// /// Get Speed from CentimetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromCentimetersPerSecond(double centimeterspersecond) @@ -341,6 +346,7 @@ public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) /// /// Get Speed from DecimetersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromDecimetersPerMinutes(double decimetersperminutes) @@ -355,6 +361,7 @@ public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) /// /// Get Speed from DecimetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromDecimetersPerSecond(double decimeterspersecond) @@ -369,6 +376,7 @@ public static Speed FromDecimetersPerSecond(QuantityValue decimeterspersecond) /// /// Get Speed from FeetPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerHour(double feetperhour) @@ -383,6 +391,7 @@ public static Speed FromFeetPerHour(QuantityValue feetperhour) /// /// Get Speed from FeetPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerMinute(double feetperminute) @@ -397,6 +406,7 @@ public static Speed FromFeetPerMinute(QuantityValue feetperminute) /// /// Get Speed from FeetPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerSecond(double feetpersecond) @@ -411,6 +421,7 @@ public static Speed FromFeetPerSecond(QuantityValue feetpersecond) /// /// Get Speed from InchesPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromInchesPerHour(double inchesperhour) @@ -425,6 +436,7 @@ public static Speed FromInchesPerHour(QuantityValue inchesperhour) /// /// Get Speed from InchesPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromInchesPerMinute(double inchesperminute) @@ -439,6 +451,7 @@ public static Speed FromInchesPerMinute(QuantityValue inchesperminute) /// /// Get Speed from InchesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromInchesPerSecond(double inchespersecond) @@ -453,6 +466,7 @@ public static Speed FromInchesPerSecond(QuantityValue inchespersecond) /// /// Get Speed from KilometersPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerHour(double kilometersperhour) @@ -467,6 +481,7 @@ public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) /// /// Get Speed from KilometersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerMinutes(double kilometersperminutes) @@ -481,6 +496,7 @@ public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) /// /// Get Speed from KilometersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerSecond(double kilometerspersecond) @@ -495,6 +511,7 @@ public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) /// /// Get Speed from Knots. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKnots(double knots) @@ -509,6 +526,7 @@ public static Speed FromKnots(QuantityValue knots) /// /// Get Speed from MetersPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerHour(double metersperhour) @@ -523,6 +541,7 @@ public static Speed FromMetersPerHour(QuantityValue metersperhour) /// /// Get Speed from MetersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerMinutes(double metersperminutes) @@ -537,6 +556,7 @@ public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) /// /// Get Speed from MetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerSecond(double meterspersecond) @@ -551,6 +571,7 @@ public static Speed FromMetersPerSecond(QuantityValue meterspersecond) /// /// Get Speed from MicrometersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMicrometersPerMinutes(double micrometersperminutes) @@ -565,6 +586,7 @@ public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminute /// /// Get Speed from MicrometersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMicrometersPerSecond(double micrometerspersecond) @@ -579,6 +601,7 @@ public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) /// /// Get Speed from MilesPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMilesPerHour(double milesperhour) @@ -593,6 +616,7 @@ public static Speed FromMilesPerHour(QuantityValue milesperhour) /// /// Get Speed from MillimetersPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerHour(double millimetersperhour) @@ -607,6 +631,7 @@ public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) /// /// Get Speed from MillimetersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerMinutes(double millimetersperminutes) @@ -621,6 +646,7 @@ public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminute /// /// Get Speed from MillimetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerSecond(double millimeterspersecond) @@ -635,6 +661,7 @@ public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) /// /// Get Speed from NanometersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromNanometersPerMinutes(double nanometersperminutes) @@ -649,6 +676,7 @@ public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) /// /// Get Speed from NanometersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromNanometersPerSecond(double nanometerspersecond) @@ -663,6 +691,7 @@ public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) /// /// Get Speed from UsSurveyFeetPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromUsSurveyFeetPerHour(double ussurveyfeetperhour) @@ -677,6 +706,7 @@ public static Speed FromUsSurveyFeetPerHour(QuantityValue ussurveyfeetperhour) /// /// Get Speed from UsSurveyFeetPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromUsSurveyFeetPerMinute(double ussurveyfeetperminute) @@ -691,6 +721,7 @@ public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminut /// /// Get Speed from UsSurveyFeetPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromUsSurveyFeetPerSecond(double ussurveyfeetpersecond) @@ -705,6 +736,7 @@ public static Speed FromUsSurveyFeetPerSecond(QuantityValue ussurveyfeetpersecon /// /// Get Speed from YardsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerHour(double yardsperhour) @@ -719,6 +751,7 @@ public static Speed FromYardsPerHour(QuantityValue yardsperhour) /// /// Get Speed from YardsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerMinute(double yardsperminute) @@ -733,6 +766,7 @@ public static Speed FromYardsPerMinute(QuantityValue yardsperminute) /// /// Get Speed from YardsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerSecond(double yardspersecond) diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 050bbc24f3..5d2447f2a0 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Temperature() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Temperature() if(unit == TemperatureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -179,6 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get Temperature from DegreesCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesCelsius(double degreescelsius) @@ -193,6 +196,7 @@ public static Temperature FromDegreesCelsius(QuantityValue degreescelsius) /// /// Get Temperature from DegreesDelisle. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesDelisle(double degreesdelisle) @@ -207,6 +211,7 @@ public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) /// /// Get Temperature from DegreesFahrenheit. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesFahrenheit(double degreesfahrenheit) @@ -221,6 +226,7 @@ public static Temperature FromDegreesFahrenheit(QuantityValue degreesfahrenheit) /// /// Get Temperature from DegreesNewton. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesNewton(double degreesnewton) @@ -235,6 +241,7 @@ public static Temperature FromDegreesNewton(QuantityValue degreesnewton) /// /// Get Temperature from DegreesRankine. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesRankine(double degreesrankine) @@ -249,6 +256,7 @@ public static Temperature FromDegreesRankine(QuantityValue degreesrankine) /// /// Get Temperature from DegreesReaumur. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesReaumur(double degreesreaumur) @@ -263,6 +271,7 @@ public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) /// /// Get Temperature from DegreesRoemer. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesRoemer(double degreesroemer) @@ -277,6 +286,7 @@ public static Temperature FromDegreesRoemer(QuantityValue degreesroemer) /// /// Get Temperature from Kelvins. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromKelvins(double kelvins) diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 49b9afafce..37f9778815 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static TemperatureChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static TemperatureChangeRate() if(unit == TemperatureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -189,6 +191,7 @@ public static BaseDimensions BaseDimensions /// /// Get TemperatureChangeRate from CentidegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(double centidegreescelsiuspersecond) @@ -203,6 +206,7 @@ public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from DecadegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(double decadegreescelsiuspersecond) @@ -217,6 +221,7 @@ public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValu /// /// Get TemperatureChangeRate from DecidegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(double decidegreescelsiuspersecond) @@ -231,6 +236,7 @@ public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(QuantityValu /// /// Get TemperatureChangeRate from DegreesCelsiusPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDegreesCelsiusPerMinute(double degreescelsiusperminute) @@ -245,6 +251,7 @@ public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue de /// /// Get TemperatureChangeRate from DegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDegreesCelsiusPerSecond(double degreescelsiuspersecond) @@ -259,6 +266,7 @@ public static TemperatureChangeRate FromDegreesCelsiusPerSecond(QuantityValue de /// /// Get TemperatureChangeRate from HectodegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(double hectodegreescelsiuspersecond) @@ -273,6 +281,7 @@ public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from KilodegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(double kilodegreescelsiuspersecond) @@ -287,6 +296,7 @@ public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(QuantityValu /// /// Get TemperatureChangeRate from MicrodegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(double microdegreescelsiuspersecond) @@ -301,6 +311,7 @@ public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from MillidegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(double millidegreescelsiuspersecond) @@ -315,6 +326,7 @@ public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from NanodegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(double nanodegreescelsiuspersecond) diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 0d3bfa2d7b..92107dc00b 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static TemperatureDelta() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static TemperatureDelta() if(unit == TemperatureDeltaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -178,6 +180,7 @@ public static BaseDimensions BaseDimensions /// /// Get TemperatureDelta from DegreesCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesCelsius(double degreescelsius) @@ -192,6 +195,7 @@ public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) /// /// Get TemperatureDelta from DegreesDelisle. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesDelisle(double degreesdelisle) @@ -206,6 +210,7 @@ public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) /// /// Get TemperatureDelta from DegreesFahrenheit. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesFahrenheit(double degreesfahrenheit) @@ -220,6 +225,7 @@ public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahren /// /// Get TemperatureDelta from DegreesNewton. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesNewton(double degreesnewton) @@ -234,6 +240,7 @@ public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) /// /// Get TemperatureDelta from DegreesRankine. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesRankine(double degreesrankine) @@ -248,6 +255,7 @@ public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) /// /// Get TemperatureDelta from DegreesReaumur. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesReaumur(double degreesreaumur) @@ -262,6 +270,7 @@ public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) /// /// Get TemperatureDelta from DegreesRoemer. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesRoemer(double degreesroemer) @@ -276,6 +285,7 @@ public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) /// /// Get TemperatureDelta from Kelvins. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromKelvins(double kelvins) diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index f2c943ea0d..d7c3926e7e 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ThermalConductivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ThermalConductivity() if(unit == ThermalConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -149,6 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get ThermalConductivity from BtusPerHourFootFahrenheit. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalConductivity FromBtusPerHourFootFahrenheit(double btusperhourfootfahrenheit) @@ -163,6 +166,7 @@ public static ThermalConductivity FromBtusPerHourFootFahrenheit(QuantityValue bt /// /// Get ThermalConductivity from WattsPerMeterKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalConductivity FromWattsPerMeterKelvin(double wattspermeterkelvin) diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 24ad6aa00f..091113d46a 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ThermalResistance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static ThermalResistance() if(unit == ThermalResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -164,6 +166,7 @@ public static BaseDimensions BaseDimensions /// /// Get ThermalResistance from HourSquareFeetDegreesFahrenheitPerBtu. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(double hoursquarefeetdegreesfahrenheitperbtu) @@ -178,6 +181,7 @@ public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(Quanti /// /// Get ThermalResistance from SquareCentimeterHourDegreesCelsiusPerKilocalorie. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(double squarecentimeterhourdegreescelsiusperkilocalorie) @@ -192,6 +196,7 @@ public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocal /// /// Get ThermalResistance from SquareCentimeterKelvinsPerWatt. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(double squarecentimeterkelvinsperwatt) @@ -206,6 +211,7 @@ public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(QuantityValue /// /// Get ThermalResistance from SquareMeterDegreesCelsiusPerWatt. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(double squaremeterdegreescelsiusperwatt) @@ -220,6 +226,7 @@ public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityVal /// /// Get ThermalResistance from SquareMeterKelvinsPerKilowatt. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(double squaremeterkelvinsperkilowatt) diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index c21a58e936..ba8f2958e8 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Torque() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Torque() if(unit == TorqueUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -244,6 +246,7 @@ public static BaseDimensions BaseDimensions /// /// Get Torque from KilogramForceCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilogramForceCentimeters(double kilogramforcecentimeters) @@ -258,6 +261,7 @@ public static Torque FromKilogramForceCentimeters(QuantityValue kilogramforcecen /// /// Get Torque from KilogramForceMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilogramForceMeters(double kilogramforcemeters) @@ -272,6 +276,7 @@ public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) /// /// Get Torque from KilogramForceMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilogramForceMillimeters(double kilogramforcemillimeters) @@ -286,6 +291,7 @@ public static Torque FromKilogramForceMillimeters(QuantityValue kilogramforcemil /// /// Get Torque from KilonewtonCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonCentimeters(double kilonewtoncentimeters) @@ -300,6 +306,7 @@ public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimete /// /// Get Torque from KilonewtonMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonMeters(double kilonewtonmeters) @@ -314,6 +321,7 @@ public static Torque FromKilonewtonMeters(QuantityValue kilonewtonmeters) /// /// Get Torque from KilonewtonMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonMillimeters(double kilonewtonmillimeters) @@ -328,6 +336,7 @@ public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimete /// /// Get Torque from KilopoundForceFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilopoundForceFeet(double kilopoundforcefeet) @@ -342,6 +351,7 @@ public static Torque FromKilopoundForceFeet(QuantityValue kilopoundforcefeet) /// /// Get Torque from KilopoundForceInches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilopoundForceInches(double kilopoundforceinches) @@ -356,6 +366,7 @@ public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches /// /// Get Torque from MeganewtonCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMeganewtonCentimeters(double meganewtoncentimeters) @@ -370,6 +381,7 @@ public static Torque FromMeganewtonCentimeters(QuantityValue meganewtoncentimete /// /// Get Torque from MeganewtonMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMeganewtonMeters(double meganewtonmeters) @@ -384,6 +396,7 @@ public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) /// /// Get Torque from MeganewtonMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMeganewtonMillimeters(double meganewtonmillimeters) @@ -398,6 +411,7 @@ public static Torque FromMeganewtonMillimeters(QuantityValue meganewtonmillimete /// /// Get Torque from MegapoundForceFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMegapoundForceFeet(double megapoundforcefeet) @@ -412,6 +426,7 @@ public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) /// /// Get Torque from MegapoundForceInches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMegapoundForceInches(double megapoundforceinches) @@ -426,6 +441,7 @@ public static Torque FromMegapoundForceInches(QuantityValue megapoundforceinches /// /// Get Torque from NewtonCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonCentimeters(double newtoncentimeters) @@ -440,6 +456,7 @@ public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) /// /// Get Torque from NewtonMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonMeters(double newtonmeters) @@ -454,6 +471,7 @@ public static Torque FromNewtonMeters(QuantityValue newtonmeters) /// /// Get Torque from NewtonMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonMillimeters(double newtonmillimeters) @@ -468,6 +486,7 @@ public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) /// /// Get Torque from PoundForceFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromPoundForceFeet(double poundforcefeet) @@ -482,6 +501,7 @@ public static Torque FromPoundForceFeet(QuantityValue poundforcefeet) /// /// Get Torque from PoundForceInches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromPoundForceInches(double poundforceinches) @@ -496,6 +516,7 @@ public static Torque FromPoundForceInches(QuantityValue poundforceinches) /// /// Get Torque from TonneForceCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromTonneForceCentimeters(double tonneforcecentimeters) @@ -510,6 +531,7 @@ public static Torque FromTonneForceCentimeters(QuantityValue tonneforcecentimete /// /// Get Torque from TonneForceMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromTonneForceMeters(double tonneforcemeters) @@ -524,6 +546,7 @@ public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) /// /// Get Torque from TonneForceMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromTonneForceMillimeters(double tonneforcemillimeters) diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 1df049ea0a..abf8b640ac 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static VitaminA() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -97,7 +99,7 @@ static VitaminA() if(unit == VitaminAUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -143,6 +145,7 @@ public static BaseDimensions BaseDimensions /// /// Get VitaminA from InternationalUnits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VitaminA FromInternationalUnits(double internationalunits) diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 33fcc4ecd0..fae05ffe42 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Volume() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static Volume() if(unit == VolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -349,6 +351,7 @@ public static BaseDimensions BaseDimensions /// /// Get Volume from AuTablespoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromAuTablespoons(double autablespoons) @@ -363,6 +366,7 @@ public static Volume FromAuTablespoons(QuantityValue autablespoons) /// /// Get Volume from Centiliters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCentiliters(double centiliters) @@ -377,6 +381,7 @@ public static Volume FromCentiliters(QuantityValue centiliters) /// /// Get Volume from CubicCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicCentimeters(double cubiccentimeters) @@ -391,6 +396,7 @@ public static Volume FromCubicCentimeters(QuantityValue cubiccentimeters) /// /// Get Volume from CubicDecimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicDecimeters(double cubicdecimeters) @@ -405,6 +411,7 @@ public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) /// /// Get Volume from CubicFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicFeet(double cubicfeet) @@ -419,6 +426,7 @@ public static Volume FromCubicFeet(QuantityValue cubicfeet) /// /// Get Volume from CubicInches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicInches(double cubicinches) @@ -433,6 +441,7 @@ public static Volume FromCubicInches(QuantityValue cubicinches) /// /// Get Volume from CubicKilometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicKilometers(double cubickilometers) @@ -447,6 +456,7 @@ public static Volume FromCubicKilometers(QuantityValue cubickilometers) /// /// Get Volume from CubicMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMeters(double cubicmeters) @@ -461,6 +471,7 @@ public static Volume FromCubicMeters(QuantityValue cubicmeters) /// /// Get Volume from CubicMicrometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMicrometers(double cubicmicrometers) @@ -475,6 +486,7 @@ public static Volume FromCubicMicrometers(QuantityValue cubicmicrometers) /// /// Get Volume from CubicMiles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMiles(double cubicmiles) @@ -489,6 +501,7 @@ public static Volume FromCubicMiles(QuantityValue cubicmiles) /// /// Get Volume from CubicMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMillimeters(double cubicmillimeters) @@ -503,6 +516,7 @@ public static Volume FromCubicMillimeters(QuantityValue cubicmillimeters) /// /// Get Volume from CubicYards. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicYards(double cubicyards) @@ -517,6 +531,7 @@ public static Volume FromCubicYards(QuantityValue cubicyards) /// /// Get Volume from Deciliters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromDeciliters(double deciliters) @@ -531,6 +546,7 @@ public static Volume FromDeciliters(QuantityValue deciliters) /// /// Get Volume from HectocubicFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectocubicFeet(double hectocubicfeet) @@ -545,6 +561,7 @@ public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) /// /// Get Volume from HectocubicMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectocubicMeters(double hectocubicmeters) @@ -559,6 +576,7 @@ public static Volume FromHectocubicMeters(QuantityValue hectocubicmeters) /// /// Get Volume from Hectoliters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectoliters(double hectoliters) @@ -573,6 +591,7 @@ public static Volume FromHectoliters(QuantityValue hectoliters) /// /// Get Volume from ImperialBeerBarrels. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromImperialBeerBarrels(double imperialbeerbarrels) @@ -587,6 +606,7 @@ public static Volume FromImperialBeerBarrels(QuantityValue imperialbeerbarrels) /// /// Get Volume from ImperialGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromImperialGallons(double imperialgallons) @@ -601,6 +621,7 @@ public static Volume FromImperialGallons(QuantityValue imperialgallons) /// /// Get Volume from ImperialOunces. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromImperialOunces(double imperialounces) @@ -615,6 +636,7 @@ public static Volume FromImperialOunces(QuantityValue imperialounces) /// /// Get Volume from KilocubicFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKilocubicFeet(double kilocubicfeet) @@ -629,6 +651,7 @@ public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) /// /// Get Volume from KilocubicMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKilocubicMeters(double kilocubicmeters) @@ -643,6 +666,7 @@ public static Volume FromKilocubicMeters(QuantityValue kilocubicmeters) /// /// Get Volume from KiloimperialGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKiloimperialGallons(double kiloimperialgallons) @@ -657,6 +681,7 @@ public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) /// /// Get Volume from KilousGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKilousGallons(double kilousgallons) @@ -671,6 +696,7 @@ public static Volume FromKilousGallons(QuantityValue kilousgallons) /// /// Get Volume from Liters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromLiters(double liters) @@ -685,6 +711,7 @@ public static Volume FromLiters(QuantityValue liters) /// /// Get Volume from MegacubicFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMegacubicFeet(double megacubicfeet) @@ -699,6 +726,7 @@ public static Volume FromMegacubicFeet(QuantityValue megacubicfeet) /// /// Get Volume from MegaimperialGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMegaimperialGallons(double megaimperialgallons) @@ -713,6 +741,7 @@ public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) /// /// Get Volume from MegausGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMegausGallons(double megausgallons) @@ -727,6 +756,7 @@ public static Volume FromMegausGallons(QuantityValue megausgallons) /// /// Get Volume from MetricCups. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMetricCups(double metriccups) @@ -741,6 +771,7 @@ public static Volume FromMetricCups(QuantityValue metriccups) /// /// Get Volume from MetricTeaspoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMetricTeaspoons(double metricteaspoons) @@ -755,6 +786,7 @@ public static Volume FromMetricTeaspoons(QuantityValue metricteaspoons) /// /// Get Volume from Microliters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMicroliters(double microliters) @@ -769,6 +801,7 @@ public static Volume FromMicroliters(QuantityValue microliters) /// /// Get Volume from Milliliters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMilliliters(double milliliters) @@ -783,6 +816,7 @@ public static Volume FromMilliliters(QuantityValue milliliters) /// /// Get Volume from OilBarrels. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromOilBarrels(double oilbarrels) @@ -797,6 +831,7 @@ public static Volume FromOilBarrels(QuantityValue oilbarrels) /// /// Get Volume from UkTablespoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUkTablespoons(double uktablespoons) @@ -811,6 +846,7 @@ public static Volume FromUkTablespoons(QuantityValue uktablespoons) /// /// Get Volume from UsBeerBarrels. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsBeerBarrels(double usbeerbarrels) @@ -825,6 +861,7 @@ public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) /// /// Get Volume from UsCustomaryCups. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsCustomaryCups(double uscustomarycups) @@ -839,6 +876,7 @@ public static Volume FromUsCustomaryCups(QuantityValue uscustomarycups) /// /// Get Volume from UsGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsGallons(double usgallons) @@ -853,6 +891,7 @@ public static Volume FromUsGallons(QuantityValue usgallons) /// /// Get Volume from UsLegalCups. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsLegalCups(double uslegalcups) @@ -867,6 +906,7 @@ public static Volume FromUsLegalCups(QuantityValue uslegalcups) /// /// Get Volume from UsOunces. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsOunces(double usounces) @@ -881,6 +921,7 @@ public static Volume FromUsOunces(QuantityValue usounces) /// /// Get Volume from UsPints. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsPints(double uspints) @@ -895,6 +936,7 @@ public static Volume FromUsPints(QuantityValue uspints) /// /// Get Volume from UsQuarts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsQuarts(double usquarts) @@ -909,6 +951,7 @@ public static Volume FromUsQuarts(QuantityValue usquarts) /// /// Get Volume from UsTablespoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsTablespoons(double ustablespoons) @@ -923,6 +966,7 @@ public static Volume FromUsTablespoons(QuantityValue ustablespoons) /// /// Get Volume from UsTeaspoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsTeaspoons(double usteaspoons) diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index b89e54f5a6..103e01bdb5 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static VolumeFlow() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -98,7 +100,7 @@ static VolumeFlow() if(unit == VolumeFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - _value = numericValue; + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); _unit = unit; } @@ -269,6 +271,7 @@ public static BaseDimensions BaseDimensions /// /// Get VolumeFlow from CentilitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCentilitersPerMinute(double centilitersperminute) @@ -283,6 +286,7 @@ public static VolumeFlow FromCentilitersPerMinute(QuantityValue centiliterspermi /// /// Get VolumeFlow from CubicDecimetersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) @@ -297,6 +301,7 @@ public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimet /// /// Get VolumeFlow from CubicFeetPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicFeetPerHour(double cubicfeetperhour) @@ -311,6 +316,7 @@ public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) /// /// Get VolumeFlow from CubicFeetPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicFeetPerMinute(double cubicfeetperminute) @@ -325,6 +331,7 @@ public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute /// /// Get VolumeFlow from CubicFeetPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicFeetPerSecond(double cubicfeetpersecond) @@ -339,6 +346,7 @@ public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond /// /// Get VolumeFlow from CubicMetersPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerHour(double cubicmetersperhour) @@ -353,6 +361,7 @@ public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour /// /// Get VolumeFlow from CubicMetersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerMinute(double cubicmetersperminute) @@ -367,6 +376,7 @@ public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmeterspermi /// /// Get VolumeFlow from CubicMetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerSecond(double cubicmeterspersecond) @@ -381,6 +391,7 @@ public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmetersperse /// /// Get VolumeFlow from CubicYardsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicYardsPerHour(double cubicyardsperhour) @@ -395,6 +406,7 @@ public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) /// /// Get VolumeFlow from CubicYardsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicYardsPerMinute(double cubicyardsperminute) @@ -409,6 +421,7 @@ public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminu /// /// Get VolumeFlow from CubicYardsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicYardsPerSecond(double cubicyardspersecond) @@ -423,6 +436,7 @@ public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardsperseco /// /// Get VolumeFlow from DecilitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromDecilitersPerMinute(double decilitersperminute) @@ -437,6 +451,7 @@ public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminu /// /// Get VolumeFlow from KilolitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromKilolitersPerMinute(double kilolitersperminute) @@ -451,6 +466,7 @@ public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminu /// /// Get VolumeFlow from LitersPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerHour(double litersperhour) @@ -465,6 +481,7 @@ public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) /// /// Get VolumeFlow from LitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerMinute(double litersperminute) @@ -479,6 +496,7 @@ public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) /// /// Get VolumeFlow from LitersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerSecond(double literspersecond) @@ -493,6 +511,7 @@ public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) /// /// Get VolumeFlow from MicrolitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromMicrolitersPerMinute(double microlitersperminute) @@ -507,6 +526,7 @@ public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microliterspermi /// /// Get VolumeFlow from MillilitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromMillilitersPerMinute(double millilitersperminute) @@ -521,6 +541,7 @@ public static VolumeFlow FromMillilitersPerMinute(QuantityValue milliliterspermi /// /// Get VolumeFlow from MillionUsGallonsPerDay. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromMillionUsGallonsPerDay(double millionusgallonsperday) @@ -535,6 +556,7 @@ public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallo /// /// Get VolumeFlow from NanolitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromNanolitersPerMinute(double nanolitersperminute) @@ -549,6 +571,7 @@ public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminu /// /// Get VolumeFlow from OilBarrelsPerDay. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromOilBarrelsPerDay(double oilbarrelsperday) @@ -563,6 +586,7 @@ public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) /// /// Get VolumeFlow from OilBarrelsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromOilBarrelsPerHour(double oilbarrelsperhour) @@ -577,6 +601,7 @@ public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) /// /// Get VolumeFlow from OilBarrelsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromOilBarrelsPerMinute(double oilbarrelsperminute) @@ -591,6 +616,7 @@ public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminu /// /// Get VolumeFlow from UsGallonsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerHour(double usgallonsperhour) @@ -605,6 +631,7 @@ public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) /// /// Get VolumeFlow from UsGallonsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerMinute(double usgallonsperminute) @@ -619,6 +646,7 @@ public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute /// /// Get VolumeFlow from UsGallonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerSecond(double usgallonspersecond) diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index ba2c5b5060..7b18a64aed 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -84,11 +84,24 @@ public abstract partial class AccelerationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Acceleration((double)0.0, AccelerationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Acceleration(double.PositiveInfinity, AccelerationUnit.MeterPerSecondSquared)); + Assert.Throws(() => new Acceleration(double.NegativeInfinity, AccelerationUnit.MeterPerSecondSquared)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Acceleration(double.NaN, AccelerationUnit.MeterPerSecondSquared)); + } + [Fact] public void MeterPerSecondSquaredToAccelerationUnits() { @@ -126,6 +139,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.StandardGravity).StandardGravity, StandardGravityTolerance); } + [Fact] + public void FromMetersPerSecondSquared_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.PositiveInfinity)); + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NegativeInfinity)); + } + + [Fact] + public void FromMetersPerSecondSquared_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index fde1d52585..4cf9ee0468 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -86,11 +86,24 @@ public abstract partial class AmountOfSubstanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AmountOfSubstance((double)0.0, AmountOfSubstanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmountOfSubstance(double.PositiveInfinity, AmountOfSubstanceUnit.Mole)); + Assert.Throws(() => new AmountOfSubstance(double.NegativeInfinity, AmountOfSubstanceUnit.Mole)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmountOfSubstance(double.NaN, AmountOfSubstanceUnit.Mole)); + } + [Fact] public void MoleToAmountOfSubstanceUnits() { @@ -130,6 +143,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.PoundMole).PoundMoles, PoundMolesTolerance); } + [Fact] + public void FromMoles_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AmountOfSubstance.FromMoles(double.PositiveInfinity)); + Assert.Throws(() => AmountOfSubstance.FromMoles(double.NegativeInfinity)); + } + + [Fact] + public void FromMoles_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AmountOfSubstance.FromMoles(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 7bd0e75139..5c422ba55c 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class AmplitudeRatioTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AmplitudeRatio((double)0.0, AmplitudeRatioUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmplitudeRatio(double.PositiveInfinity, AmplitudeRatioUnit.DecibelVolt)); + Assert.Throws(() => new AmplitudeRatio(double.NegativeInfinity, AmplitudeRatioUnit.DecibelVolt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmplitudeRatio(double.NaN, AmplitudeRatioUnit.DecibelVolt)); + } + [Fact] public void DecibelVoltToAmplitudeRatioUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelVolt).DecibelVolts, DecibelVoltsTolerance); } + [Fact] + public void FromDecibelVolts_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.PositiveInfinity)); + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NegativeInfinity)); + } + + [Fact] + public void FromDecibelVolts_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index f8e6959e4f..46ea30e6b0 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -86,11 +86,24 @@ public abstract partial class AngleTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Angle((double)0.0, AngleUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Angle(double.PositiveInfinity, AngleUnit.Degree)); + Assert.Throws(() => new Angle(double.NegativeInfinity, AngleUnit.Degree)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Angle(double.NaN, AngleUnit.Degree)); + } + [Fact] public void DegreeToAngleUnits() { @@ -130,6 +143,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Revolution).Revolutions, RevolutionsTolerance); } + [Fact] + public void FromDegrees_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Angle.FromDegrees(double.PositiveInfinity)); + Assert.Throws(() => Angle.FromDegrees(double.NegativeInfinity)); + } + + [Fact] + public void FromDegrees_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Angle.FromDegrees(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index a7b21d9922..c2a2b63781 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class ApparentEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ApparentEnergy((double)0.0, ApparentEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentEnergy(double.PositiveInfinity, ApparentEnergyUnit.VoltampereHour)); + Assert.Throws(() => new ApparentEnergy(double.NegativeInfinity, ApparentEnergyUnit.VoltampereHour)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentEnergy(double.NaN, ApparentEnergyUnit.VoltampereHour)); + } + [Fact] public void VoltampereHourToApparentEnergyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.VoltampereHour).VoltampereHours, VoltampereHoursTolerance); } + [Fact] + public void FromVoltampereHours_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.PositiveInfinity)); + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltampereHours_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index 8a46336a98..18946640ac 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ApparentPowerTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ApparentPower((double)0.0, ApparentPowerUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentPower(double.PositiveInfinity, ApparentPowerUnit.Voltampere)); + Assert.Throws(() => new ApparentPower(double.NegativeInfinity, ApparentPowerUnit.Voltampere)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentPower(double.NaN, ApparentPowerUnit.Voltampere)); + } + [Fact] public void VoltampereToApparentPowerUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Voltampere).Voltamperes, VoltamperesTolerance); } + [Fact] + public void FromVoltamperes_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentPower.FromVoltamperes(double.PositiveInfinity)); + Assert.Throws(() => ApparentPower.FromVoltamperes(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltamperes_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentPower.FromVoltamperes(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index 07df5efd07..5cedc1a4dc 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class AreaDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AreaDensity((double)0.0, AreaDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaDensity(double.PositiveInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + Assert.Throws(() => new AreaDensity(double.NegativeInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaDensity(double.NaN, AreaDensityUnit.KilogramPerSquareMeter)); + } + [Fact] public void KilogramPerSquareMeterToAreaDensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AreaDensity.From(1, AreaDensityUnit.KilogramPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); } + [Fact] + public void FromKilogramsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index 19253d24cd..d8a0e19d48 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -70,11 +70,24 @@ public abstract partial class AreaMomentOfInertiaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AreaMomentOfInertia((double)0.0, AreaMomentOfInertiaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaMomentOfInertia(double.PositiveInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + Assert.Throws(() => new AreaMomentOfInertia(double.NegativeInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaMomentOfInertia(double.NaN, AreaMomentOfInertiaUnit.MeterToTheFourth)); + } + [Fact] public void MeterToTheFourthToAreaMomentOfInertiaUnits() { @@ -98,6 +111,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MillimeterToTheFourth).MillimetersToTheFourth, MillimetersToTheFourthTolerance); } + [Fact] + public void FromMetersToTheFourth_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity)); + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity)); + } + + [Fact] + public void FromMetersToTheFourth_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index 229f2a8862..bbff05e91b 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -84,11 +84,24 @@ public abstract partial class AreaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Area((double)0.0, AreaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Area(double.PositiveInfinity, AreaUnit.SquareMeter)); + Assert.Throws(() => new Area(double.NegativeInfinity, AreaUnit.SquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Area(double.NaN, AreaUnit.SquareMeter)); + } + [Fact] public void SquareMeterToAreaUnits() { @@ -126,6 +139,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.UsSurveySquareFoot).UsSurveySquareFeet, UsSurveySquareFeetTolerance); } + [Fact] + public void FromSquareMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Area.FromSquareMeters(double.PositiveInfinity)); + Assert.Throws(() => Area.FromSquareMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromSquareMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Area.FromSquareMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index 12d6add74c..3d6e1b5d08 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -110,11 +110,12 @@ public abstract partial class BitRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new BitRate((decimal)0.0, BitRateUnit.Undefined)); } + [Fact] public void BitPerSecondToBitRateUnits() { @@ -178,6 +179,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabytePerSecond).TerabytesPerSecond, TerabytesPerSecondTolerance); } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index 07bc6fd165..7b39afd362 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class BrakeSpecificFuelConsumptionTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new BrakeSpecificFuelConsumption((double)0.0, BrakeSpecificFuelConsumptionUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.PositiveInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NegativeInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NaN, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + } + [Fact] public void KilogramPerJouleToBrakeSpecificFuelConsumptionUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour).PoundsPerMechanicalHorsepowerHour, PoundsPerMechanicalHorsepowerHourTolerance); } + [Fact] + public void FromKilogramsPerJoule_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerJoule_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index e0b8ea9f19..f7aae142a9 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class CapacitanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Capacitance((double)0.0, CapacitanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Capacitance(double.PositiveInfinity, CapacitanceUnit.Farad)); + Assert.Throws(() => new Capacitance(double.NegativeInfinity, CapacitanceUnit.Farad)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Capacitance(double.NaN, CapacitanceUnit.Farad)); + } + [Fact] public void FaradToCapacitanceUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Farad).Farads, FaradsTolerance); } + [Fact] + public void FromFarads_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Capacitance.FromFarads(double.PositiveInfinity)); + Assert.Throws(() => Capacitance.FromFarads(double.NegativeInfinity)); + } + + [Fact] + public void FromFarads_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Capacitance.FromFarads(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index c638a5da1c..eb815b3870 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -134,11 +134,24 @@ public abstract partial class DensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Density((double)0.0, DensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Density(double.PositiveInfinity, DensityUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new Density(double.NegativeInfinity, DensityUnit.KilogramPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Density(double.NaN, DensityUnit.KilogramPerCubicMeter)); + } + [Fact] public void KilogramPerCubicMeterToDensityUnits() { @@ -226,6 +239,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMillimeter).TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); } + [Fact] + public void FromKilogramsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index f806a5304f..26d57866ab 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -78,11 +78,24 @@ public abstract partial class DurationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Duration((double)0.0, DurationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Duration(double.PositiveInfinity, DurationUnit.Second)); + Assert.Throws(() => new Duration(double.NegativeInfinity, DurationUnit.Second)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Duration(double.NaN, DurationUnit.Second)); + } + [Fact] public void SecondToDurationUnits() { @@ -114,6 +127,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Year365).Years365, Years365Tolerance); } + [Fact] + public void FromSeconds_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Duration.FromSeconds(double.PositiveInfinity)); + Assert.Throws(() => Duration.FromSeconds(double.NegativeInfinity)); + } + + [Fact] + public void FromSeconds_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Duration.FromSeconds(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index be764da352..89975d0345 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -70,11 +70,24 @@ public abstract partial class DynamicViscosityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new DynamicViscosity((double)0.0, DynamicViscosityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new DynamicViscosity(double.PositiveInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + Assert.Throws(() => new DynamicViscosity(double.NegativeInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new DynamicViscosity(double.NaN, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + } + [Fact] public void NewtonSecondPerMeterSquaredToDynamicViscosityUnits() { @@ -98,6 +111,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Poise).Poise, PoiseTolerance); } + [Fact] + public void FromNewtonSecondsPerMeterSquared_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.PositiveInfinity)); + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonSecondsPerMeterSquared_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index 96dedd353c..d785668635 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ElectricAdmittanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricAdmittance((double)0.0, ElectricAdmittanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricAdmittance(double.PositiveInfinity, ElectricAdmittanceUnit.Siemens)); + Assert.Throws(() => new ElectricAdmittance(double.NegativeInfinity, ElectricAdmittanceUnit.Siemens)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricAdmittance(double.NaN, ElectricAdmittanceUnit.Siemens)); + } + [Fact] public void SiemensToElectricAdmittanceUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Siemens).Siemens, SiemensTolerance); } + [Fact] + public void FromSiemens_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.PositiveInfinity)); + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NegativeInfinity)); + } + + [Fact] + public void FromSiemens_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index dbb00507bd..494ae2e6a2 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricChargeDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricChargeDensity((double)0.0, ElectricChargeDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricChargeDensity(double.PositiveInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + Assert.Throws(() => new ElectricChargeDensity(double.NegativeInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricChargeDensity(double.NaN, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + } + [Fact] public void CoulombPerCubicMeterToElectricChargeDensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricChargeDensity.From(1, ElectricChargeDensityUnit.CoulombPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); } + [Fact] + public void FromCoulombsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromCoulombsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index f29eb270ae..117118a2e7 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricChargeTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCharge((double)0.0, ElectricChargeUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCharge(double.PositiveInfinity, ElectricChargeUnit.Coulomb)); + Assert.Throws(() => new ElectricCharge(double.NegativeInfinity, ElectricChargeUnit.Coulomb)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCharge(double.NaN, ElectricChargeUnit.Coulomb)); + } + [Fact] public void CoulombToElectricChargeUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.Coulomb).Coulombs, CoulombsTolerance); } + [Fact] + public void FromCoulombs_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCharge.FromCoulombs(double.PositiveInfinity)); + Assert.Throws(() => ElectricCharge.FromCoulombs(double.NegativeInfinity)); + } + + [Fact] + public void FromCoulombs_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCharge.FromCoulombs(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index 2da4b3b45d..84f5d077a7 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class ElectricConductanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricConductance((double)0.0, ElectricConductanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductance(double.PositiveInfinity, ElectricConductanceUnit.Siemens)); + Assert.Throws(() => new ElectricConductance(double.NegativeInfinity, ElectricConductanceUnit.Siemens)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductance(double.NaN, ElectricConductanceUnit.Siemens)); + } + [Fact] public void SiemensToElectricConductanceUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Siemens).Siemens, SiemensTolerance); } + [Fact] + public void FromSiemens_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductance.FromSiemens(double.PositiveInfinity)); + Assert.Throws(() => ElectricConductance.FromSiemens(double.NegativeInfinity)); + } + + [Fact] + public void FromSiemens_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductance.FromSiemens(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index 30448d33a6..54f544901f 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricConductivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricConductivity((double)0.0, ElectricConductivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductivity(double.PositiveInfinity, ElectricConductivityUnit.SiemensPerMeter)); + Assert.Throws(() => new ElectricConductivity(double.NegativeInfinity, ElectricConductivityUnit.SiemensPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductivity(double.NaN, ElectricConductivityUnit.SiemensPerMeter)); + } + [Fact] public void SiemensPerMeterToElectricConductivityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); } + [Fact] + public void FromSiemensPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromSiemensPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index 5d27add425..3b9a125a06 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricCurrentDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCurrentDensity((double)0.0, ElectricCurrentDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentDensity(double.PositiveInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + Assert.Throws(() => new ElectricCurrentDensity(double.NegativeInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentDensity(double.NaN, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + } + [Fact] public void AmperePerSquareMeterToElectricCurrentDensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); } + [Fact] + public void FromAmperesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperesPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 2b10f1c8e2..6367b5468d 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricCurrentGradientTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCurrentGradient((double)0.0, ElectricCurrentGradientUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentGradient(double.PositiveInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + Assert.Throws(() => new ElectricCurrentGradient(double.NegativeInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentGradient(double.NaN, ElectricCurrentGradientUnit.AmperePerSecond)); + } + [Fact] public void AmperePerSecondToElectricCurrentGradientUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCurrentGradient.From(1, ElectricCurrentGradientUnit.AmperePerSecond).AmperesPerSecond, AmperesPerSecondTolerance); } + [Fact] + public void FromAmperesPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperesPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index 593380c1e0..849c84bf48 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class ElectricCurrentTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCurrent((double)0.0, ElectricCurrentUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrent(double.PositiveInfinity, ElectricCurrentUnit.Ampere)); + Assert.Throws(() => new ElectricCurrent(double.NegativeInfinity, ElectricCurrentUnit.Ampere)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrent(double.NaN, ElectricCurrentUnit.Ampere)); + } + [Fact] public void AmpereToElectricCurrentUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Picoampere).Picoamperes, PicoamperesTolerance); } + [Fact] + public void FromAmperes_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperes_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrent.FromAmperes(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index ec025d2ebe..8fd41e31ee 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricFieldTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricField((double)0.0, ElectricFieldUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricField(double.PositiveInfinity, ElectricFieldUnit.VoltPerMeter)); + Assert.Throws(() => new ElectricField(double.NegativeInfinity, ElectricFieldUnit.VoltPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricField(double.NaN, ElectricFieldUnit.VoltPerMeter)); + } + [Fact] public void VoltPerMeterToElectricFieldUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricField.From(1, ElectricFieldUnit.VoltPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); } + [Fact] + public void FromVoltsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index da5260e825..c58c40cac1 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricInductanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricInductance((double)0.0, ElectricInductanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricInductance(double.PositiveInfinity, ElectricInductanceUnit.Henry)); + Assert.Throws(() => new ElectricInductance(double.NegativeInfinity, ElectricInductanceUnit.Henry)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricInductance(double.NaN, ElectricInductanceUnit.Henry)); + } + [Fact] public void HenryToElectricInductanceUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Henry).Henries, HenriesTolerance); } + [Fact] + public void FromHenries_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricInductance.FromHenries(double.PositiveInfinity)); + Assert.Throws(() => ElectricInductance.FromHenries(double.NegativeInfinity)); + } + + [Fact] + public void FromHenries_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricInductance.FromHenries(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index 6135c12ca4..6b45e51e6c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ElectricPotentialAcTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricPotentialAc((double)0.0, ElectricPotentialAcUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialAc(double.PositiveInfinity, ElectricPotentialAcUnit.VoltAc)); + Assert.Throws(() => new ElectricPotentialAc(double.NegativeInfinity, ElectricPotentialAcUnit.VoltAc)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialAc(double.NaN, ElectricPotentialAcUnit.VoltAc)); + } + [Fact] public void VoltAcToElectricPotentialAcUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.VoltAc).VoltsAc, VoltsAcTolerance); } + [Fact] + public void FromVoltsAc_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltsAc_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index abdb8e516f..173ce57a76 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ElectricPotentialDcTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricPotentialDc((double)0.0, ElectricPotentialDcUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialDc(double.PositiveInfinity, ElectricPotentialDcUnit.VoltDc)); + Assert.Throws(() => new ElectricPotentialDc(double.NegativeInfinity, ElectricPotentialDcUnit.VoltDc)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialDc(double.NaN, ElectricPotentialDcUnit.VoltDc)); + } + [Fact] public void VoltDcToElectricPotentialDcUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.VoltDc).VoltsDc, VoltsDcTolerance); } + [Fact] + public void FromVoltsDc_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltsDc_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index ef42925c11..91bfc02e4a 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ElectricPotentialTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricPotential((double)0.0, ElectricPotentialUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotential(double.PositiveInfinity, ElectricPotentialUnit.Volt)); + Assert.Throws(() => new ElectricPotential(double.NegativeInfinity, ElectricPotentialUnit.Volt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotential(double.NaN, ElectricPotentialUnit.Volt)); + } + [Fact] public void VoltToElectricPotentialUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Volt).Volts, VoltsTolerance); } + [Fact] + public void FromVolts_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotential.FromVolts(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotential.FromVolts(double.NegativeInfinity)); + } + + [Fact] + public void FromVolts_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotential.FromVolts(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index 4ab6ca465b..cc2955db23 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ElectricResistanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricResistance((double)0.0, ElectricResistanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistance(double.PositiveInfinity, ElectricResistanceUnit.Ohm)); + Assert.Throws(() => new ElectricResistance(double.NegativeInfinity, ElectricResistanceUnit.Ohm)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistance(double.NaN, ElectricResistanceUnit.Ohm)); + } + [Fact] public void OhmToElectricResistanceUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Ohm).Ohms, OhmsTolerance); } + [Fact] + public void FromOhms_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistance.FromOhms(double.PositiveInfinity)); + Assert.Throws(() => ElectricResistance.FromOhms(double.NegativeInfinity)); + } + + [Fact] + public void FromOhms_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistance.FromOhms(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index 93f601197c..5e3a728fd1 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ElectricResistivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricResistivity((double)0.0, ElectricResistivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistivity(double.PositiveInfinity, ElectricResistivityUnit.OhmMeter)); + Assert.Throws(() => new ElectricResistivity(double.NegativeInfinity, ElectricResistivityUnit.OhmMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistivity(double.NaN, ElectricResistivityUnit.OhmMeter)); + } + [Fact] public void OhmMeterToElectricResistivityUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.OhmMeter).OhmMeters, OhmMetersTolerance); } + [Fact] + public void FromOhmMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.PositiveInfinity)); + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromOhmMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 973c61ae6c..c9d444df67 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -102,11 +102,24 @@ public abstract partial class EnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Energy((double)0.0, EnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Energy(double.PositiveInfinity, EnergyUnit.Joule)); + Assert.Throws(() => new Energy(double.NegativeInfinity, EnergyUnit.Joule)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Energy(double.NaN, EnergyUnit.Joule)); + } + [Fact] public void JouleToEnergyUnits() { @@ -162,6 +175,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.WattHour).WattHours, WattHoursTolerance); } + [Fact] + public void FromJoules_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Energy.FromJoules(double.PositiveInfinity)); + Assert.Throws(() => Energy.FromJoules(double.NegativeInfinity)); + } + + [Fact] + public void FromJoules_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Energy.FromJoules(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index b1e00b640f..0b99099f16 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -72,11 +72,24 @@ public abstract partial class EntropyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Entropy((double)0.0, EntropyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Entropy(double.PositiveInfinity, EntropyUnit.JoulePerKelvin)); + Assert.Throws(() => new Entropy(double.NegativeInfinity, EntropyUnit.JoulePerKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Entropy(double.NaN, EntropyUnit.JoulePerKelvin)); + } + [Fact] public void JoulePerKelvinToEntropyUnits() { @@ -102,6 +115,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.MegajoulePerKelvin).MegajoulesPerKelvin, MegajoulesPerKelvinTolerance); } + [Fact] + public void FromJoulesPerKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.PositiveInfinity)); + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index c87b6b2446..675ee4bfac 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -80,11 +80,24 @@ public abstract partial class ForceChangeRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ForceChangeRate((double)0.0, ForceChangeRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForceChangeRate(double.PositiveInfinity, ForceChangeRateUnit.NewtonPerSecond)); + Assert.Throws(() => new ForceChangeRate(double.NegativeInfinity, ForceChangeRateUnit.NewtonPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForceChangeRate(double.NaN, ForceChangeRateUnit.NewtonPerSecond)); + } + [Fact] public void NewtonPerSecondToForceChangeRateUnits() { @@ -118,6 +131,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); } + [Fact] + public void FromNewtonsPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonsPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index 3971157664..5d06b028f1 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -76,11 +76,24 @@ public abstract partial class ForcePerLengthTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ForcePerLength((double)0.0, ForcePerLengthUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForcePerLength(double.PositiveInfinity, ForcePerLengthUnit.NewtonPerMeter)); + Assert.Throws(() => new ForcePerLength(double.NegativeInfinity, ForcePerLengthUnit.NewtonPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForcePerLength(double.NaN, ForcePerLengthUnit.NewtonPerMeter)); + } + [Fact] public void NewtonPerMeterToForcePerLengthUnits() { @@ -110,6 +123,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); } + [Fact] + public void FromNewtonsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 6ddcd62956..f2e05bbe08 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -78,11 +78,24 @@ public abstract partial class ForceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Force((double)0.0, ForceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Force(double.PositiveInfinity, ForceUnit.Newton)); + Assert.Throws(() => new Force(double.NegativeInfinity, ForceUnit.Newton)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Force(double.NaN, ForceUnit.Newton)); + } + [Fact] public void NewtonToForceUnits() { @@ -114,6 +127,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.TonneForce).TonnesForce, TonnesForceTolerance); } + [Fact] + public void FromNewtons_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Force.FromNewtons(double.PositiveInfinity)); + Assert.Throws(() => Force.FromNewtons(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtons_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Force.FromNewtons(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index f691f536d3..5c2cdc4e26 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class FrequencyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Frequency((double)0.0, FrequencyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Frequency(double.PositiveInfinity, FrequencyUnit.Hertz)); + Assert.Throws(() => new Frequency(double.NegativeInfinity, FrequencyUnit.Hertz)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Frequency(double.NaN, FrequencyUnit.Hertz)); + } + [Fact] public void HertzToFrequencyUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Terahertz).Terahertz, TerahertzTolerance); } + [Fact] + public void FromHertz_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Frequency.FromHertz(double.PositiveInfinity)); + Assert.Throws(() => Frequency.FromHertz(double.NegativeInfinity)); + } + + [Fact] + public void FromHertz_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Frequency.FromHertz(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index c2af4c817f..b7c744d95c 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -90,11 +90,24 @@ public abstract partial class HeatFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new HeatFlux((double)0.0, HeatFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatFlux(double.PositiveInfinity, HeatFluxUnit.WattPerSquareMeter)); + Assert.Throws(() => new HeatFlux(double.NegativeInfinity, HeatFluxUnit.WattPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatFlux(double.NaN, HeatFluxUnit.WattPerSquareMeter)); + } + [Fact] public void WattPerSquareMeterToHeatFluxUnits() { @@ -138,6 +151,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } + [Fact] + public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index 34b0b8f95a..f94c2693f0 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class HeatTransferCoefficientTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new HeatTransferCoefficient((double)0.0, HeatTransferCoefficientUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatTransferCoefficient(double.PositiveInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + Assert.Throws(() => new HeatTransferCoefficient(double.NegativeInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatTransferCoefficient(double.NaN, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + } + [Fact] public void WattPerSquareMeterKelvinToHeatTransferCoefficientUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); } + [Fact] + public void FromWattsPerSquareMeterKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.PositiveInfinity)); + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerSquareMeterKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index 1c6f6800ea..22d7ca8dfc 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class IlluminanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Illuminance((double)0.0, IlluminanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Illuminance(double.PositiveInfinity, IlluminanceUnit.Lux)); + Assert.Throws(() => new Illuminance(double.NegativeInfinity, IlluminanceUnit.Lux)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Illuminance(double.NaN, IlluminanceUnit.Lux)); + } + [Fact] public void LuxToIlluminanceUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Millilux).Millilux, MilliluxTolerance); } + [Fact] + public void FromLux_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Illuminance.FromLux(double.PositiveInfinity)); + Assert.Throws(() => Illuminance.FromLux(double.NegativeInfinity)); + } + + [Fact] + public void FromLux_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Illuminance.FromLux(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 421a6f0a72..c4278ad1c4 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -110,11 +110,12 @@ public abstract partial class InformationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Information((decimal)0.0, InformationUnit.Undefined)); } + [Fact] public void BitToInformationUnits() { @@ -178,6 +179,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Terabyte).Terabytes, TerabytesTolerance); } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index 02d02ab401..9a934b5337 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class IrradianceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Irradiance((double)0.0, IrradianceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiance(double.PositiveInfinity, IrradianceUnit.WattPerSquareMeter)); + Assert.Throws(() => new Irradiance(double.NegativeInfinity, IrradianceUnit.WattPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiance(double.NaN, IrradianceUnit.WattPerSquareMeter)); + } + [Fact] public void WattPerSquareMeterToIrradianceUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } + [Fact] + public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index 9ca8965d52..f78cce335b 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class IrradiationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Irradiation((double)0.0, IrradiationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiation(double.PositiveInfinity, IrradiationUnit.JoulePerSquareMeter)); + Assert.Throws(() => new Irradiation(double.NegativeInfinity, IrradiationUnit.JoulePerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiation(double.NaN, IrradiationUnit.JoulePerSquareMeter)); + } + [Fact] public void JoulePerSquareMeterToIrradiationUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.WattHourPerSquareMeter).WattHoursPerSquareMeter, WattHoursPerSquareMeterTolerance); } + [Fact] + public void FromJoulesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 92f9a6a96d..84360b2c9f 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class KinematicViscosityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new KinematicViscosity((double)0.0, KinematicViscosityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new KinematicViscosity(double.PositiveInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + Assert.Throws(() => new KinematicViscosity(double.NegativeInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new KinematicViscosity(double.NaN, KinematicViscosityUnit.SquareMeterPerSecond)); + } + [Fact] public void SquareMeterPerSecondToKinematicViscosityUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Stokes).Stokes, StokesTolerance); } + [Fact] + public void FromSquareMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromSquareMetersPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 41a859da8e..452f0871cf 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class LapseRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LapseRate((double)0.0, LapseRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LapseRate(double.PositiveInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); + Assert.Throws(() => new LapseRate(double.NegativeInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LapseRate(double.NaN, LapseRateUnit.DegreeCelsiusPerKilometer)); + } + [Fact] public void DegreeCelsiusPerKilometerToLapseRateUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LapseRate.From(1, LapseRateUnit.DegreeCelsiusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); } + [Fact] + public void FromDegreesCelciusPerKilometer_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.PositiveInfinity)); + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NegativeInfinity)); + } + + [Fact] + public void FromDegreesCelciusPerKilometer_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index a758944098..49991bdce6 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -102,11 +102,24 @@ public abstract partial class LengthTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Length((double)0.0, LengthUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Length(double.PositiveInfinity, LengthUnit.Meter)); + Assert.Throws(() => new Length(double.NegativeInfinity, LengthUnit.Meter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Length(double.NaN, LengthUnit.Meter)); + } + [Fact] public void MeterToLengthUnits() { @@ -162,6 +175,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Yard).Yards, YardsTolerance); } + [Fact] + public void FromMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Length.FromMeters(double.PositiveInfinity)); + Assert.Throws(() => Length.FromMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Length.FromMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 9e936cd71b..5dbdf5b200 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class LevelTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Level((double)0.0, LevelUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Level(double.PositiveInfinity, LevelUnit.Decibel)); + Assert.Throws(() => new Level(double.NegativeInfinity, LevelUnit.Decibel)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Level(double.NaN, LevelUnit.Decibel)); + } + [Fact] public void DecibelToLevelUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Level.From(1, LevelUnit.Neper).Nepers, NepersTolerance); } + [Fact] + public void FromDecibels_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Level.FromDecibels(double.PositiveInfinity)); + Assert.Throws(() => Level.FromDecibels(double.NegativeInfinity)); + } + + [Fact] + public void FromDecibels_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Level.FromDecibels(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index 42d59694cc..5008bfd430 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class LinearDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LinearDensity((double)0.0, LinearDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LinearDensity(double.PositiveInfinity, LinearDensityUnit.KilogramPerMeter)); + Assert.Throws(() => new LinearDensity(double.NegativeInfinity, LinearDensityUnit.KilogramPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LinearDensity(double.NaN, LinearDensityUnit.KilogramPerMeter)); + } + [Fact] public void KilogramPerMeterToLinearDensityUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.PoundPerFoot).PoundsPerFoot, PoundsPerFootTolerance); } + [Fact] + public void FromKilogramsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index 0e7f2ffc33..e8a1ab1366 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class LuminousFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LuminousFlux((double)0.0, LuminousFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousFlux(double.PositiveInfinity, LuminousFluxUnit.Lumen)); + Assert.Throws(() => new LuminousFlux(double.NegativeInfinity, LuminousFluxUnit.Lumen)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousFlux(double.NaN, LuminousFluxUnit.Lumen)); + } + [Fact] public void LumenToLuminousFluxUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LuminousFlux.From(1, LuminousFluxUnit.Lumen).Lumens, LumensTolerance); } + [Fact] + public void FromLumens_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousFlux.FromLumens(double.PositiveInfinity)); + Assert.Throws(() => LuminousFlux.FromLumens(double.NegativeInfinity)); + } + + [Fact] + public void FromLumens_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousFlux.FromLumens(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index 291b37b47f..b9fb9c5467 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class LuminousIntensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LuminousIntensity((double)0.0, LuminousIntensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousIntensity(double.PositiveInfinity, LuminousIntensityUnit.Candela)); + Assert.Throws(() => new LuminousIntensity(double.NegativeInfinity, LuminousIntensityUnit.Candela)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousIntensity(double.NaN, LuminousIntensityUnit.Candela)); + } + [Fact] public void CandelaToLuminousIntensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LuminousIntensity.From(1, LuminousIntensityUnit.Candela).Candela, CandelaTolerance); } + [Fact] + public void FromCandela_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousIntensity.FromCandela(double.PositiveInfinity)); + Assert.Throws(() => LuminousIntensity.FromCandela(double.NegativeInfinity)); + } + + [Fact] + public void FromCandela_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousIntensity.FromCandela(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index 28eba96a39..0d6062b97e 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class MagneticFieldTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MagneticField((double)0.0, MagneticFieldUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticField(double.PositiveInfinity, MagneticFieldUnit.Tesla)); + Assert.Throws(() => new MagneticField(double.NegativeInfinity, MagneticFieldUnit.Tesla)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticField(double.NaN, MagneticFieldUnit.Tesla)); + } + [Fact] public void TeslaToMagneticFieldUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Tesla).Teslas, TeslasTolerance); } + [Fact] + public void FromTeslas_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticField.FromTeslas(double.PositiveInfinity)); + Assert.Throws(() => MagneticField.FromTeslas(double.NegativeInfinity)); + } + + [Fact] + public void FromTeslas_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticField.FromTeslas(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index ef47677788..be8ee57bee 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class MagneticFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MagneticFlux((double)0.0, MagneticFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticFlux(double.PositiveInfinity, MagneticFluxUnit.Weber)); + Assert.Throws(() => new MagneticFlux(double.NegativeInfinity, MagneticFluxUnit.Weber)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticFlux(double.NaN, MagneticFluxUnit.Weber)); + } + [Fact] public void WeberToMagneticFluxUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MagneticFlux.From(1, MagneticFluxUnit.Weber).Webers, WebersTolerance); } + [Fact] + public void FromWebers_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticFlux.FromWebers(double.PositiveInfinity)); + Assert.Throws(() => MagneticFlux.FromWebers(double.NegativeInfinity)); + } + + [Fact] + public void FromWebers_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticFlux.FromWebers(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index f2cf6b5e78..d22a725500 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class MagnetizationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Magnetization((double)0.0, MagnetizationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Magnetization(double.PositiveInfinity, MagnetizationUnit.AmperePerMeter)); + Assert.Throws(() => new Magnetization(double.NegativeInfinity, MagnetizationUnit.AmperePerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Magnetization(double.NaN, MagnetizationUnit.AmperePerMeter)); + } + [Fact] public void AmperePerMeterToMagnetizationUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Magnetization.From(1, MagnetizationUnit.AmperePerMeter).AmperesPerMeter, AmperesPerMeterTolerance); } + [Fact] + public void FromAmperesPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperesPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 072cd491cd..2643a81f73 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -88,11 +88,24 @@ public abstract partial class MassFlowTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MassFlow((double)0.0, MassFlowUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlow(double.PositiveInfinity, MassFlowUnit.GramPerSecond)); + Assert.Throws(() => new MassFlow(double.NegativeInfinity, MassFlowUnit.GramPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlow(double.NaN, MassFlowUnit.GramPerSecond)); + } + [Fact] public void GramPerSecondToMassFlowUnits() { @@ -134,6 +147,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerHour).TonnesPerHour, TonnesPerHourTolerance); } + [Fact] + public void FromGramsPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromGramsPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index 2f4868ad6c..a80ad1086d 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class MassFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MassFlux((double)0.0, MassFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlux(double.PositiveInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + Assert.Throws(() => new MassFlux(double.NegativeInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlux(double.NaN, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + } + [Fact] public void KilogramPerSecondPerSquareMeterToMassFluxUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.KilogramPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); } + [Fact] + public void FromKilogramsPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index 8177a148a0..a1001c2cf4 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -110,11 +110,24 @@ public abstract partial class MassMomentOfInertiaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MassMomentOfInertia((double)0.0, MassMomentOfInertiaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassMomentOfInertia(double.PositiveInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + Assert.Throws(() => new MassMomentOfInertia(double.NegativeInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassMomentOfInertia(double.NaN, MassMomentOfInertiaUnit.KilogramSquareMeter)); + } + [Fact] public void KilogramSquareMeterToMassMomentOfInertiaUnits() { @@ -178,6 +191,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMilimeter).TonneSquareMilimeters, TonneSquareMilimetersTolerance); } + [Fact] + public void FromKilogramSquareMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.PositiveInfinity)); + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramSquareMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index 03d53b92f2..e9fef6fe84 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -100,11 +100,24 @@ public abstract partial class MassTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Mass((double)0.0, MassUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Mass(double.PositiveInfinity, MassUnit.Kilogram)); + Assert.Throws(() => new Mass(double.NegativeInfinity, MassUnit.Kilogram)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Mass(double.NaN, MassUnit.Kilogram)); + } + [Fact] public void KilogramToMassUnits() { @@ -158,6 +171,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Tonne).Tonnes, TonnesTolerance); } + [Fact] + public void FromKilograms_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Mass.FromKilograms(double.PositiveInfinity)); + Assert.Throws(() => Mass.FromKilograms(double.NegativeInfinity)); + } + + [Fact] + public void FromKilograms_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Mass.FromKilograms(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index 63fdc2a981..1da87494a1 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class MolarEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MolarEnergy((double)0.0, MolarEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEnergy(double.PositiveInfinity, MolarEnergyUnit.JoulePerMole)); + Assert.Throws(() => new MolarEnergy(double.NegativeInfinity, MolarEnergyUnit.JoulePerMole)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEnergy(double.NaN, MolarEnergyUnit.JoulePerMole)); + } + [Fact] public void JoulePerMoleToMolarEnergyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.MegajoulePerMole).MegajoulesPerMole, MegajoulesPerMoleTolerance); } + [Fact] + public void FromJoulesPerMole_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerMole_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index 1fc4cbf18e..0d55e75664 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class MolarEntropyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MolarEntropy((double)0.0, MolarEntropyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEntropy(double.PositiveInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + Assert.Throws(() => new MolarEntropy(double.NegativeInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin)); + } + [Fact] public void JoulePerMoleKelvinToMolarEntropyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.MegajoulePerMoleKelvin).MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); } + [Fact] + public void FromJoulesPerMoleKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerMoleKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index 2816dbc406..bb35d0fdb5 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -82,11 +82,24 @@ public abstract partial class MolarMassTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MolarMass((double)0.0, MolarMassUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarMass(double.PositiveInfinity, MolarMassUnit.KilogramPerMole)); + Assert.Throws(() => new MolarMass(double.NegativeInfinity, MolarMassUnit.KilogramPerMole)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarMass(double.NaN, MolarMassUnit.KilogramPerMole)); + } + [Fact] public void KilogramPerMoleToMolarMassUnits() { @@ -122,6 +135,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.PoundPerMole).PoundsPerMole, PoundsPerMoleTolerance); } + [Fact] + public void FromKilogramsPerMole_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.PositiveInfinity)); + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerMole_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index 05fbb01ed6..fd08d90e38 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class MolarityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Molarity((double)0.0, MolarityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Molarity(double.PositiveInfinity, MolarityUnit.MolesPerCubicMeter)); + Assert.Throws(() => new Molarity(double.NegativeInfinity, MolarityUnit.MolesPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Molarity(double.NaN, MolarityUnit.MolesPerCubicMeter)); + } + [Fact] public void MolesPerCubicMeterToMolarityUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.PicomolesPerLiter).PicomolesPerLiter, PicomolesPerLiterTolerance); } + [Fact] + public void FromMolesPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromMolesPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index 4891e3888d..ea63a72d15 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class PermeabilityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Permeability((double)0.0, PermeabilityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permeability(double.PositiveInfinity, PermeabilityUnit.HenryPerMeter)); + Assert.Throws(() => new Permeability(double.NegativeInfinity, PermeabilityUnit.HenryPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permeability(double.NaN, PermeabilityUnit.HenryPerMeter)); + } + [Fact] public void HenryPerMeterToPermeabilityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Permeability.From(1, PermeabilityUnit.HenryPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); } + [Fact] + public void FromHenriesPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromHenriesPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index 43a78f4d07..b49b0cc95a 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class PermittivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Permittivity((double)0.0, PermittivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permittivity(double.PositiveInfinity, PermittivityUnit.FaradPerMeter)); + Assert.Throws(() => new Permittivity(double.NegativeInfinity, PermittivityUnit.FaradPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permittivity(double.NaN, PermittivityUnit.FaradPerMeter)); + } + [Fact] public void FaradPerMeterToPermittivityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Permittivity.From(1, PermittivityUnit.FaradPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); } + [Fact] + public void FromFaradsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromFaradsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 814290401b..426bced7ce 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -146,11 +146,24 @@ public abstract partial class PowerDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new PowerDensity((double)0.0, PowerDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerDensity(double.PositiveInfinity, PowerDensityUnit.WattPerCubicMeter)); + Assert.Throws(() => new PowerDensity(double.NegativeInfinity, PowerDensityUnit.WattPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerDensity(double.NaN, PowerDensityUnit.WattPerCubicMeter)); + } + [Fact] public void WattPerCubicMeterToPowerDensityUnits() { @@ -250,6 +263,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerLiter).WattsPerLiter, WattsPerLiterTolerance); } + [Fact] + public void FromWattsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index d680f2a4be..ffffca4554 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class PowerRatioTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new PowerRatio((double)0.0, PowerRatioUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerRatio(double.PositiveInfinity, PowerRatioUnit.DecibelWatt)); + Assert.Throws(() => new PowerRatio(double.NegativeInfinity, PowerRatioUnit.DecibelWatt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerRatio(double.NaN, PowerRatioUnit.DecibelWatt)); + } + [Fact] public void DecibelWattToPowerRatioUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelWatt).DecibelWatts, DecibelWattsTolerance); } + [Fact] + public void FromDecibelWatts_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.PositiveInfinity)); + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NegativeInfinity)); + } + + [Fact] + public void FromDecibelWatts_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index e8a5d7314b..54ccd97f4d 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -98,11 +98,12 @@ public abstract partial class PowerTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Power((decimal)0.0, PowerUnit.Undefined)); } + [Fact] public void WattToPowerUnits() { @@ -154,6 +155,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Watt).Watts, WattsTolerance); } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index 709037cb5b..6e07c3765c 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class PressureChangeRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new PressureChangeRate((double)0.0, PressureChangeRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new PressureChangeRate(double.PositiveInfinity, PressureChangeRateUnit.PascalPerSecond)); + Assert.Throws(() => new PressureChangeRate(double.NegativeInfinity, PressureChangeRateUnit.PascalPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new PressureChangeRate(double.NaN, PressureChangeRateUnit.PascalPerSecond)); + } + [Fact] public void PascalPerSecondToPressureChangeRateUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.PascalPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); } + [Fact] + public void FromPascalsPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromPascalsPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index 3272a3b016..88357133c9 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -132,11 +132,24 @@ public abstract partial class PressureTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Pressure((double)0.0, PressureUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Pressure(double.PositiveInfinity, PressureUnit.Pascal)); + Assert.Throws(() => new Pressure(double.NegativeInfinity, PressureUnit.Pascal)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Pressure(double.NaN, PressureUnit.Pascal)); + } + [Fact] public void PascalToPressureUnits() { @@ -222,6 +235,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Torr).Torrs, TorrsTolerance); } + [Fact] + public void FromPascals_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Pressure.FromPascals(double.PositiveInfinity)); + Assert.Throws(() => Pressure.FromPascals(double.NegativeInfinity)); + } + + [Fact] + public void FromPascals_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Pressure.FromPascals(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index eb06b07354..1fe1c27335 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -70,11 +70,24 @@ public abstract partial class RatioTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Ratio((double)0.0, RatioUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Ratio(double.PositiveInfinity, RatioUnit.DecimalFraction)); + Assert.Throws(() => new Ratio(double.NegativeInfinity, RatioUnit.DecimalFraction)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Ratio(double.NaN, RatioUnit.DecimalFraction)); + } + [Fact] public void DecimalFractionToRatioUnits() { @@ -98,6 +111,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.Percent).Percent, PercentTolerance); } + [Fact] + public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Ratio.FromDecimalFractions(double.PositiveInfinity)); + Assert.Throws(() => Ratio.FromDecimalFractions(double.NegativeInfinity)); + } + + [Fact] + public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Ratio.FromDecimalFractions(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index 576d61d7d8..80e88fcc3c 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class ReactiveEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ReactiveEnergy((double)0.0, ReactiveEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactiveEnergy(double.PositiveInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + Assert.Throws(() => new ReactiveEnergy(double.NegativeInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactiveEnergy(double.NaN, ReactiveEnergyUnit.VoltampereReactiveHour)); + } + [Fact] public void VoltampereReactiveHourToReactiveEnergyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.VoltampereReactiveHour).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); } + [Fact] + public void FromVoltampereReactiveHours_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.PositiveInfinity)); + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltampereReactiveHours_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index 4d148a5aea..7b4aa25e4e 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ReactivePowerTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ReactivePower((double)0.0, ReactivePowerUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactivePower(double.PositiveInfinity, ReactivePowerUnit.VoltampereReactive)); + Assert.Throws(() => new ReactivePower(double.NegativeInfinity, ReactivePowerUnit.VoltampereReactive)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactivePower(double.NaN, ReactivePowerUnit.VoltampereReactive)); + } + [Fact] public void VoltampereReactiveToReactivePowerUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.VoltampereReactive).VoltamperesReactive, VoltamperesReactiveTolerance); } + [Fact] + public void FromVoltamperesReactive_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity)); + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltamperesReactive_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index 8fdfcf9640..7f6a67fba4 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class RotationalAccelerationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalAcceleration((double)0.0, RotationalAccelerationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalAcceleration(double.PositiveInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + Assert.Throws(() => new RotationalAcceleration(double.NegativeInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalAcceleration(double.NaN, RotationalAccelerationUnit.RadianPerSecondSquared)); + } + [Fact] public void RadianPerSecondSquaredToRotationalAccelerationUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RevolutionPerMinutePerSecond).RevolutionsPerMinutePerSecond, RevolutionsPerMinutePerSecondTolerance); } + [Fact] + public void FromRadiansPerSecondSquared_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity)); + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity)); + } + + [Fact] + public void FromRadiansPerSecondSquared_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index 4da0c2a40f..4fa2fb3306 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -84,11 +84,24 @@ public abstract partial class RotationalSpeedTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalSpeed((double)0.0, RotationalSpeedUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalSpeed(double.PositiveInfinity, RotationalSpeedUnit.RadianPerSecond)); + Assert.Throws(() => new RotationalSpeed(double.NegativeInfinity, RotationalSpeedUnit.RadianPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalSpeed(double.NaN, RotationalSpeedUnit.RadianPerSecond)); + } + [Fact] public void RadianPerSecondToRotationalSpeedUnits() { @@ -126,6 +139,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerSecond).RevolutionsPerSecond, RevolutionsPerSecondTolerance); } + [Fact] + public void FromRadiansPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.PositiveInfinity)); + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromRadiansPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 6ddb83a45d..6cc08e489b 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class RotationalStiffnessPerLengthTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalStiffnessPerLength((double)0.0, RotationalStiffnessPerLengthUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffnessPerLength(double.PositiveInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + Assert.Throws(() => new RotationalStiffnessPerLength(double.NegativeInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffnessPerLength(double.NaN, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + } + [Fact] public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); } + [Fact] + public void FromNewtonMetersPerRadianPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.PositiveInfinity)); + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonMetersPerRadianPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index f780416a16..d8f7be14f2 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class RotationalStiffnessTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalStiffness((double)0.0, RotationalStiffnessUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffness(double.PositiveInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + Assert.Throws(() => new RotationalStiffness(double.NegativeInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffness(double.NaN, RotationalStiffnessUnit.NewtonMeterPerRadian)); + } + [Fact] public void NewtonMeterPerRadianToRotationalStiffnessUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.NewtonMeterPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); } + [Fact] + public void FromNewtonMetersPerRadian_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.PositiveInfinity)); + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonMetersPerRadian_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index fd7eaa5e7e..874043dcad 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class SolidAngleTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SolidAngle((double)0.0, SolidAngleUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SolidAngle(double.PositiveInfinity, SolidAngleUnit.Steradian)); + Assert.Throws(() => new SolidAngle(double.NegativeInfinity, SolidAngleUnit.Steradian)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SolidAngle(double.NaN, SolidAngleUnit.Steradian)); + } + [Fact] public void SteradianToSolidAngleUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SolidAngle.From(1, SolidAngleUnit.Steradian).Steradians, SteradiansTolerance); } + [Fact] + public void FromSteradians_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SolidAngle.FromSteradians(double.PositiveInfinity)); + Assert.Throws(() => SolidAngle.FromSteradians(double.NegativeInfinity)); + } + + [Fact] + public void FromSteradians_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SolidAngle.FromSteradians(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index 46c74ab544..f0971fb50c 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class SpecificEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificEnergy((double)0.0, SpecificEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEnergy(double.PositiveInfinity, SpecificEnergyUnit.JoulePerKilogram)); + Assert.Throws(() => new SpecificEnergy(double.NegativeInfinity, SpecificEnergyUnit.JoulePerKilogram)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEnergy(double.NaN, SpecificEnergyUnit.JoulePerKilogram)); + } + [Fact] public void JoulePerKilogramToSpecificEnergyUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.WattHourPerKilogram).WattHoursPerKilogram, WattHoursPerKilogramTolerance); } + [Fact] + public void FromJoulesPerKilogram_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.PositiveInfinity)); + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerKilogram_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 824d0434ff..45608cd8b2 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class SpecificEntropyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificEntropy((double)0.0, SpecificEntropyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEntropy(double.PositiveInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + Assert.Throws(() => new SpecificEntropy(double.NegativeInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEntropy(double.NaN, SpecificEntropyUnit.JoulePerKilogramKelvin)); + } + [Fact] public void JoulePerKilogramKelvinToSpecificEntropyUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramKelvin).MegajoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); } + [Fact] + public void FromJoulesPerKilogramKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.PositiveInfinity)); + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerKilogramKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 9b0c7d3f3a..0229fb2026 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class SpecificVolumeTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificVolume((double)0.0, SpecificVolumeUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificVolume(double.PositiveInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + Assert.Throws(() => new SpecificVolume(double.NegativeInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificVolume(double.NaN, SpecificVolumeUnit.CubicMeterPerKilogram)); + } + [Fact] public void CubicMeterPerKilogramToSpecificVolumeUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicMeterPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); } + [Fact] + public void FromCubicMetersPerKilogram_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.PositiveInfinity)); + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NegativeInfinity)); + } + + [Fact] + public void FromCubicMetersPerKilogram_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index 2a1e87bdf5..c0711185df 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -92,11 +92,24 @@ public abstract partial class SpecificWeightTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificWeight((double)0.0, SpecificWeightUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificWeight(double.PositiveInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + Assert.Throws(() => new SpecificWeight(double.NegativeInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificWeight(double.NaN, SpecificWeightUnit.NewtonPerCubicMeter)); + } + [Fact] public void NewtonPerCubicMeterToSpecificWeightUnits() { @@ -142,6 +155,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMillimeter).TonnesForcePerCubicMillimeter, TonnesForcePerCubicMillimeterTolerance); } + [Fact] + public void FromNewtonsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index 186d6cd018..fc710bd753 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -122,11 +122,24 @@ public abstract partial class SpeedTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Speed((double)0.0, SpeedUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Speed(double.PositiveInfinity, SpeedUnit.MeterPerSecond)); + Assert.Throws(() => new Speed(double.NegativeInfinity, SpeedUnit.MeterPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Speed(double.NaN, SpeedUnit.MeterPerSecond)); + } + [Fact] public void MeterPerSecondToSpeedUnits() { @@ -202,6 +215,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerSecond).YardsPerSecond, YardsPerSecondTolerance); } + [Fact] + public void FromMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Speed.FromMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => Speed.FromMetersPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromMetersPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Speed.FromMetersPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index 7d5e999225..b67ce8681e 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -78,11 +78,24 @@ public abstract partial class TemperatureChangeRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new TemperatureChangeRate((double)0.0, TemperatureChangeRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureChangeRate(double.PositiveInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + Assert.Throws(() => new TemperatureChangeRate(double.NegativeInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureChangeRate(double.NaN, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + } + [Fact] public void DegreeCelsiusPerSecondToTemperatureChangeRateUnits() { @@ -114,6 +127,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond).NanodegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); } + [Fact] + public void FromDegreesCelsiusPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.PositiveInfinity)); + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromDegreesCelsiusPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index 3266bb7e50..2328b0d091 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class TemperatureDeltaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new TemperatureDelta((double)0.0, TemperatureDeltaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureDelta(double.PositiveInfinity, TemperatureDeltaUnit.Kelvin)); + Assert.Throws(() => new TemperatureDelta(double.NegativeInfinity, TemperatureDeltaUnit.Kelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureDelta(double.NaN, TemperatureDeltaUnit.Kelvin)); + } + [Fact] public void KelvinToTemperatureDeltaUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance); } + [Fact] + public void FromKelvins_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureDelta.FromKelvins(double.PositiveInfinity)); + Assert.Throws(() => TemperatureDelta.FromKelvins(double.NegativeInfinity)); + } + + [Fact] + public void FromKelvins_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureDelta.FromKelvins(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 4c2bf7e7db..47bd0cd872 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class TemperatureTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Temperature((double)0.0, TemperatureUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Temperature(double.PositiveInfinity, TemperatureUnit.Kelvin)); + Assert.Throws(() => new Temperature(double.NegativeInfinity, TemperatureUnit.Kelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Temperature(double.NaN, TemperatureUnit.Kelvin)); + } + [Fact] public void KelvinToTemperatureUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.Kelvin).Kelvins, KelvinsTolerance); } + [Fact] + public void FromKelvins_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Temperature.FromKelvins(double.PositiveInfinity)); + Assert.Throws(() => Temperature.FromKelvins(double.NegativeInfinity)); + } + + [Fact] + public void FromKelvins_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Temperature.FromKelvins(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index 83373ac345..d592216369 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class ThermalConductivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ThermalConductivity((double)0.0, ThermalConductivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalConductivity(double.PositiveInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + Assert.Throws(() => new ThermalConductivity(double.NegativeInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalConductivity(double.NaN, ThermalConductivityUnit.WattPerMeterKelvin)); + } + [Fact] public void WattPerMeterKelvinToThermalConductivityUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.WattPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); } + [Fact] + public void FromWattsPerMeterKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.PositiveInfinity)); + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerMeterKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index c9402bb963..9119cb1719 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ThermalResistanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ThermalResistance((double)0.0, ThermalResistanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalResistance(double.PositiveInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + Assert.Throws(() => new ThermalResistance(double.NegativeInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalResistance(double.NaN, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + } + [Fact] public void SquareMeterKelvinPerKilowattToThermalResistanceUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); } + [Fact] + public void FromSquareMeterKelvinsPerKilowatt_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.PositiveInfinity)); + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NegativeInfinity)); + } + + [Fact] + public void FromSquareMeterKelvinsPerKilowatt_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index e698b9395d..b1ae59349f 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -100,11 +100,24 @@ public abstract partial class TorqueTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Torque((double)0.0, TorqueUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Torque(double.PositiveInfinity, TorqueUnit.NewtonMeter)); + Assert.Throws(() => new Torque(double.NegativeInfinity, TorqueUnit.NewtonMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Torque(double.NaN, TorqueUnit.NewtonMeter)); + } + [Fact] public void NewtonMeterToTorqueUnits() { @@ -158,6 +171,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMillimeter).TonneForceMillimeters, TonneForceMillimetersTolerance); } + [Fact] + public void FromNewtonMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Torque.FromNewtonMeters(double.PositiveInfinity)); + Assert.Throws(() => Torque.FromNewtonMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Torque.FromNewtonMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index d3c8577c7c..e1fc3be467 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class VitaminATestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new VitaminA((double)0.0, VitaminAUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new VitaminA(double.PositiveInfinity, VitaminAUnit.InternationalUnit)); + Assert.Throws(() => new VitaminA(double.NegativeInfinity, VitaminAUnit.InternationalUnit)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new VitaminA(double.NaN, VitaminAUnit.InternationalUnit)); + } + [Fact] public void InternationalUnitToVitaminAUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, VitaminA.From(1, VitaminAUnit.InternationalUnit).InternationalUnits, InternationalUnitsTolerance); } + [Fact] + public void FromInternationalUnits_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => VitaminA.FromInternationalUnits(double.PositiveInfinity)); + Assert.Throws(() => VitaminA.FromInternationalUnits(double.NegativeInfinity)); + } + + [Fact] + public void FromInternationalUnits_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => VitaminA.FromInternationalUnits(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index bd35c2aed0..d12c99c555 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -110,11 +110,24 @@ public abstract partial class VolumeFlowTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new VolumeFlow((double)0.0, VolumeFlowUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new VolumeFlow(double.PositiveInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + Assert.Throws(() => new VolumeFlow(double.NegativeInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new VolumeFlow(double.NaN, VolumeFlowUnit.CubicMeterPerSecond)); + } + [Fact] public void CubicMeterPerSecondToVolumeFlowUnits() { @@ -178,6 +191,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); } + [Fact] + public void FromCubicMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromCubicMetersPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 572660d5ae..d4bdc9c534 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -142,11 +142,24 @@ public abstract partial class VolumeTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Volume((double)0.0, VolumeUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Volume(double.PositiveInfinity, VolumeUnit.CubicMeter)); + Assert.Throws(() => new Volume(double.NegativeInfinity, VolumeUnit.CubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Volume(double.NaN, VolumeUnit.CubicMeter)); + } + [Fact] public void CubicMeterToVolumeUnits() { @@ -242,6 +255,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTeaspoon).UsTeaspoons, UsTeaspoonsTolerance); } + [Fact] + public void FromCubicMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Volume.FromCubicMeters(double.PositiveInfinity)); + Assert.Throws(() => Volume.FromCubicMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromCubicMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Volume.FromCubicMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index 3a040d7343..002c691134 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -277,7 +277,7 @@ public void ShouldUseCorrectMicroSign() Assert.Equal(VolumeUnit.CubicMicrometer, Volume.ParseUnit("\u00b5m³")); Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, VolumeFlow.ParseUnit("\u00b5LPM")); - // "\u03bc" = Lower case greek letter 'Mu' + // "\u03bc" = Lower case greek letter 'Mu' Assert.Throws(() => Acceleration.ParseUnit("\u03bcm/s²")); Assert.Throws(() => AmplitudeRatio.ParseUnit("dB\u03bcV")); Assert.Throws(() => Angle.ParseUnit("\u03bc°")); @@ -328,7 +328,7 @@ public void AllUnitAbbreviationsImplemented(string cultureName) .ToList(); // We want to flag if any localizations are missing, but not break the build - // or flag an error for pull requests. For now they are not considered + // or flag an error for pull requests. For now they are not considered // critical and it is cumbersome to have a third person review the pull request // and add in any translations before merging it in. if (unitValuesMissingAbbreviations.Any()) @@ -410,7 +410,7 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() CultureInfo oldCurrentCulture = CultureInfo.CurrentCulture; CultureInfo oldCurrentUICulture = CultureInfo.CurrentUICulture; - try + try { // CurrentCulture affects number formatting, such as comma or dot as decimal separator. // CurrentUICulture affects localization, in this case the abbreviation. @@ -428,7 +428,7 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() // Assert Assert.Equal("US english abbreviation for Unit1", abbreviation); } - finally + finally { CultureInfo.CurrentCulture = oldCurrentCulture; CultureInfo.CurrentUICulture = oldCurrentUICulture; @@ -444,18 +444,6 @@ public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviati Assert.Equal("m²", unitSystem.GetDefaultAbbreviation(AreaUnit.SquareMeter)); } - [Fact] - public void NegativeInfinityFormatting() - { - Assert.Equal("-Infinity m", Length.FromMeters(double.NegativeInfinity).ToString(LengthUnit.Meter, CultureInfo.InvariantCulture)); - } - - [Fact] - public void NotANumberFormatting() - { - Assert.Equal("NaN m", Length.FromMeters(double.NaN).ToString()); - } - [Fact] public void Parse_AmbiguousUnitsThrowsException() { @@ -480,12 +468,6 @@ public void Parse_UnambiguousUnitsDoesNotThrow() Assert.Equal(Volume.FromLiters(1), unit); } - [Fact] - public void PositiveInfinityFormatting() - { - Assert.Equal("Infinity m", Length.FromMeters(double.PositiveInfinity).ToString(LengthUnit.Meter, CultureInfo.InvariantCulture)); - } - /// /// Convenience method to the proper culture parameter type. /// diff --git a/UnitsNet/InternalHelpers/Guard.cs b/UnitsNet/InternalHelpers/Guard.cs new file mode 100644 index 0000000000..9a30d55ecc --- /dev/null +++ b/UnitsNet/InternalHelpers/Guard.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using JetBrains.Annotations; + +namespace UnitsNet.InternalHelpers +{ + /// + /// Guard methods to ensure parameter values satisfy pre-conditions and use a consistent exception message. + /// + internal static class Guard + { + /// + /// Throws if value is , + /// or . + /// + /// The value to check. + /// Name of parameter in calling method. + /// The given if valid. + /// If is invalid. + internal static double EnsureValidNumber(double value, [InvokerParameterName] string paramName) + { + if (double.IsNaN(value)) throw new ArgumentException("NaN is not a valid number.", paramName); + if (double.IsInfinity(value)) throw new ArgumentException("PositiveInfinity or NegativeInfinity is not a valid number.", paramName); + return value; + } + } +} diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index d05598705c..2838e37c50 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -21,6 +21,8 @@ // Operator overloads not supported in Windows Runtime Components, we use 'double' type instead +using UnitsNet.InternalHelpers; + #if !WINDOWS_UWP namespace UnitsNet { @@ -55,7 +57,7 @@ public struct QuantityValue private QuantityValue(double val) { - _value = val; + _value = Guard.EnsureValidNumber(val, nameof(val)); _valueDecimal = null; } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 5205ca1ff0..f4a9a1a28c 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -62,6 +62,7 @@ using System.Globalization; using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -122,6 +123,7 @@ if ($obsoleteAttribute) /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -132,7 +134,11 @@ if ($obsoleteAttribute) if(unit == $unitEnumName.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); +"@; if ($quantity.BaseType -eq "double") {@" + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); +"@; } else {@" _value = numericValue; +"@; }@" _unit = unit; } @@ -196,6 +202,7 @@ if ($obsoleteAttribute) /// /// Get $quantityName from $($unit.PluralName). /// $($obsoleteAttribute) + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static $quantityName From$($unit.PluralName)(double $valueParamName) diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index 75f3f21644..bfa0e781df 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -75,11 +75,26 @@ namespace UnitsNet.Tests // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new $quantityName(($baseType)0.0, $unitEnumName.Undefined)); } +"@; if ($quantity.BaseType -eq "double") {@" + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new $quantityName(double.PositiveInfinity, $unitEnumName.$($baseUnit.SingularName))); + Assert.Throws(() => new $quantityName(double.NegativeInfinity, $unitEnumName.$($baseUnit.SingularName))); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new $quantityName(double.NaN, $unitEnumName.$($baseUnit.SingularName))); + } +"@; }@" + [Fact] public void $($baseUnit.SingularName)To$($quantityName)Units() { @@ -97,6 +112,21 @@ namespace UnitsNet.Tests "@; }@" } +"@; if ($quantity.BaseType -eq "double") {@" + [Fact] + public void From$($baseUnit.PluralName)_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => $quantityName.From$($baseUnit.PluralName)(double.PositiveInfinity)); + Assert.Throws(() => $quantityName.From$($baseUnit.PluralName)(double.NegativeInfinity)); + } + + [Fact] + public void From$($baseUnit.PluralName)_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => $quantityName.From$($baseUnit.PluralName)(double.NaN)); + } +"@; }@" + [Fact] public void As() {