diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 2875f84eff..38504033e5 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -211,10 +211,7 @@ private void GenerateInstanceConstructors() /// If value is NaN or Infinity. public {_quantity.Name}({_quantity.ValueType} value, {_unitEnumName} unit) {{"); - Writer.WL(_quantity.ValueType == "double" - ? @" - _value = Guard.EnsureValidNumber(value, nameof(value));" - : @" + Writer.WL(@" _value = value;"); Writer.WL($@" _unit = unit; @@ -236,10 +233,7 @@ private void GenerateInstanceConstructors() var firstUnitInfo = unitInfos.FirstOrDefault(); "); - Writer.WL(_quantity.ValueType == "double" - ? @" - _value = Guard.EnsureValidNumber(value, nameof(value));" - : @" + Writer.WL(@" _value = value;"); Writer.WL($@" _unit = firstUnitInfo?.Value ?? throw new ArgumentException(""No units were found for the given UnitSystem."", nameof(unitSystem)); diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs index 02313ea6dd..1c39c9824f 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs @@ -171,16 +171,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() "); if (_quantity.ValueType == "double") Writer.WL($@" [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() {{ - Assert.Throws(() => new {_quantity.Name}(double.PositiveInfinity, {_baseUnitFullName})); - Assert.Throws(() => new {_quantity.Name}(double.NegativeInfinity, {_baseUnitFullName})); + var exception1 = Record.Exception(() => new {_quantity.Name}(double.PositiveInfinity, {_baseUnitFullName})); + var exception2 = Record.Exception(() => new {_quantity.Name}(double.NegativeInfinity, {_baseUnitFullName})); + + Assert.Null(exception1); + Assert.Null(exception2); }} [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() {{ - Assert.Throws(() => new {_quantity.Name}(double.NaN, {_baseUnitFullName})); + var exception = Record.Exception(() => new {_quantity.Name}(double.NaN, {_baseUnitFullName})); + + Assert.Null(exception); }} "); Writer.WL($@" @@ -248,16 +253,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() "); if (_quantity.ValueType == "double") Writer.WL($@" [Fact] - public void From{_baseUnit.PluralName}_WithInfinityValue_ThrowsArgumentException() + public void From{_baseUnit.PluralName}_WithInfinityValue_DoNotThrowsArgumentException() {{ - Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.PositiveInfinity)); - Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NegativeInfinity)); + var exception1 = Record.Exception(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.PositiveInfinity)); + var exception2 = Record.Exception(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); }} [Fact] - public void From{_baseUnit.PluralName}_WithNanValue_ThrowsArgumentException() + public void From{_baseUnit.PluralName}_WithNanValue_DoNotThrowsArgumentException() {{ - Assert.Throws(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NaN)); + var exception = Record.Exception(() => {_quantity.Name}.From{_baseUnit.PluralName}(double.NaN)); + + Assert.Null(exception); }} "); Writer.WL($@" diff --git a/Common/UnitDefinitions/Density.json b/Common/UnitDefinitions/Density.json index 997c3c05a5..c0b6c4997e 100644 --- a/Common/UnitDefinitions/Density.json +++ b/Common/UnitDefinitions/Density.json @@ -197,7 +197,7 @@ }, { "SingularName": "GramPerDeciliter", - "PluralName": "GramsPerDeciLiter", + "PluralName": "GramsPerDeciliter", "FromUnitToBaseFunc": "{x} / 1e-1", "FromBaseToUnitFunc": "{x} * 1e-1", "Prefixes": [ "Femto", "Pico", "Nano", "Micro", "Milli", "Centi", "Deci" ], diff --git a/Common/UnitDefinitions/ElectricPotentialChangeRate.json b/Common/UnitDefinitions/ElectricPotentialChangeRate.json index ed81c5aa1d..9e7a1916a8 100644 --- a/Common/UnitDefinitions/ElectricPotentialChangeRate.json +++ b/Common/UnitDefinitions/ElectricPotentialChangeRate.json @@ -11,7 +11,7 @@ "Units": [ { "SingularName": "VoltPerSecond", - "PluralName": "VoltsPerSeconds", + "PluralName": "VoltsPerSecond", "BaseUnits": { "L": "Meter", "M": "Kilogram", @@ -30,7 +30,7 @@ }, { "SingularName": "VoltPerMicrosecond", - "PluralName": "VoltsPerMicroseconds", + "PluralName": "VoltsPerMicrosecond", "BaseUnits": { "L": "Meter", "M": "Kilogram", @@ -49,7 +49,7 @@ }, { "SingularName": "VoltPerMinute", - "PluralName": "VoltsPerMinutes", + "PluralName": "VoltsPerMinute", "BaseUnits": { "L": "Meter", "M": "Kilogram", @@ -68,7 +68,7 @@ }, { "SingularName": "VoltPerHour", - "PluralName": "VoltsPerHours", + "PluralName": "VoltsPerHour", "BaseUnits": { "L": "Meter", "M": "Kilogram", diff --git a/Common/UnitDefinitions/FuelEfficiency.json b/Common/UnitDefinitions/FuelEfficiency.json index d0a27ce366..a32e9cd959 100644 --- a/Common/UnitDefinitions/FuelEfficiency.json +++ b/Common/UnitDefinitions/FuelEfficiency.json @@ -41,7 +41,7 @@ }, { "SingularName": "KilometerPerLiter", - "PluralName": "KilometersPerLiters", + "PluralName": "KilometersPerLiter", "FromUnitToBaseFunc": "100 / {x}", "FromBaseToUnitFunc": "100 / {x}", "Localization": [{ diff --git a/Common/UnitDefinitions/Speed.json b/Common/UnitDefinitions/Speed.json index f17f8a321c..6a127121e5 100644 --- a/Common/UnitDefinitions/Speed.json +++ b/Common/UnitDefinitions/Speed.json @@ -30,7 +30,7 @@ }, { "SingularName": "MeterPerMinute", - "PluralName": "MetersPerMinutes", + "PluralName": "MetersPerMinute", "BaseUnits": { "L": "Meter", "T": "Minute" diff --git a/Common/UnitDefinitions/TemperatureGradient.json b/Common/UnitDefinitions/TemperatureGradient.json index d0cf566fc1..d2c9d5f5bd 100644 --- a/Common/UnitDefinitions/TemperatureGradient.json +++ b/Common/UnitDefinitions/TemperatureGradient.json @@ -25,7 +25,7 @@ }, { "SingularName": "DegreeCelsiusPerMeter", - "PluralName": "DegreesCelciusPerMeter", + "PluralName": "DegreesCelsiusPerMeter", "BaseUnits": { "L": "Meter", "Θ": "DegreeCelsius" @@ -57,7 +57,7 @@ }, { "SingularName": "DegreeCelsiusPerKilometer", - "PluralName": "DegreesCelciusPerKilometer", + "PluralName": "DegreesCelsiusPerKilometer", "BaseUnits": { "L": "Kilometer", "Θ": "DegreeCelsius" diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs index 55431e6bab..7fc366dd8d 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs @@ -85,7 +85,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); + public double CentigramsPerDeciliter => As(DensityUnit.CentigramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -100,7 +100,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); + public double DecigramsPerDeciliter => As(DensityUnit.DecigramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -115,7 +115,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double FemtogramsPerDeciLiter => As(DensityUnit.FemtogramPerDeciliter); + public double FemtogramsPerDeciliter => As(DensityUnit.FemtogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -155,7 +155,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); + public double GramsPerDeciliter => As(DensityUnit.GramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -210,7 +210,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); + public double MicrogramsPerDeciliter => As(DensityUnit.MicrogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -230,7 +230,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); + public double MilligramsPerDeciliter => As(DensityUnit.MilligramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -245,7 +245,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); + public double NanogramsPerDeciliter => As(DensityUnit.NanogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -260,7 +260,7 @@ public Density(double value, DensityUnit unit) /// /// Gets a value of this quantity converted into /// - public double PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); + public double PicogramsPerDeciliter => As(DensityUnit.PicogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -370,7 +370,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerDeciLiter(double centigramsperdeciliter) => new Density(centigramsperdeciliter, DensityUnit.CentigramPerDeciliter); + public static Density FromCentigramsPerDeciliter(double centigramsperdeciliter) => new Density(centigramsperdeciliter, DensityUnit.CentigramPerDeciliter); /// /// Creates a from . @@ -388,7 +388,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerDeciLiter(double decigramsperdeciliter) => new Density(decigramsperdeciliter, DensityUnit.DecigramPerDeciliter); + public static Density FromDecigramsPerDeciliter(double decigramsperdeciliter) => new Density(decigramsperdeciliter, DensityUnit.DecigramPerDeciliter); /// /// Creates a from . @@ -406,7 +406,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromFemtogramsPerDeciLiter(double femtogramsperdeciliter) => new Density(femtogramsperdeciliter, DensityUnit.FemtogramPerDeciliter); + public static Density FromFemtogramsPerDeciliter(double femtogramsperdeciliter) => new Density(femtogramsperdeciliter, DensityUnit.FemtogramPerDeciliter); /// /// Creates a from . @@ -454,7 +454,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromGramsPerDeciLiter(double gramsperdeciliter) => new Density(gramsperdeciliter, DensityUnit.GramPerDeciliter); + public static Density FromGramsPerDeciliter(double gramsperdeciliter) => new Density(gramsperdeciliter, DensityUnit.GramPerDeciliter); /// /// Creates a from . @@ -520,7 +520,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerDeciLiter(double microgramsperdeciliter) => new Density(microgramsperdeciliter, DensityUnit.MicrogramPerDeciliter); + public static Density FromMicrogramsPerDeciliter(double microgramsperdeciliter) => new Density(microgramsperdeciliter, DensityUnit.MicrogramPerDeciliter); /// /// Creates a from . @@ -544,7 +544,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerDeciLiter(double milligramsperdeciliter) => new Density(milligramsperdeciliter, DensityUnit.MilligramPerDeciliter); + public static Density FromMilligramsPerDeciliter(double milligramsperdeciliter) => new Density(milligramsperdeciliter, DensityUnit.MilligramPerDeciliter); /// /// Creates a from . @@ -562,7 +562,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerDeciLiter(double nanogramsperdeciliter) => new Density(nanogramsperdeciliter, DensityUnit.NanogramPerDeciliter); + public static Density FromNanogramsPerDeciliter(double nanogramsperdeciliter) => new Density(nanogramsperdeciliter, DensityUnit.NanogramPerDeciliter); /// /// Creates a from . @@ -580,7 +580,7 @@ public Density(double value, DensityUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerDeciLiter(double picogramsperdeciliter) => new Density(picogramsperdeciliter, DensityUnit.PicogramPerDeciliter); + public static Density FromPicogramsPerDeciliter(double picogramsperdeciliter) => new Density(picogramsperdeciliter, DensityUnit.PicogramPerDeciliter); /// /// Creates a from . diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 1ce4ce0ecc..75d8f1efe5 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -82,102 +82,102 @@ public ElectricPotentialChangeRate(double value, ElectricPotentialChangeRateUnit /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerHours => As(ElectricPotentialChangeRateUnit.KilovoltPerHour); + public double KilovoltsPerHour => As(ElectricPotentialChangeRateUnit.KilovoltPerHour); /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); + public double KilovoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerMinutes => As(ElectricPotentialChangeRateUnit.KilovoltPerMinute); + public double KilovoltsPerMinute => As(ElectricPotentialChangeRateUnit.KilovoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerSeconds => As(ElectricPotentialChangeRateUnit.KilovoltPerSecond); + public double KilovoltsPerSecond => As(ElectricPotentialChangeRateUnit.KilovoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerHours => As(ElectricPotentialChangeRateUnit.MegavoltPerHour); + public double MegavoltsPerHour => As(ElectricPotentialChangeRateUnit.MegavoltPerHour); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); + public double MegavoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerMinutes => As(ElectricPotentialChangeRateUnit.MegavoltPerMinute); + public double MegavoltsPerMinute => As(ElectricPotentialChangeRateUnit.MegavoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerSeconds => As(ElectricPotentialChangeRateUnit.MegavoltPerSecond); + public double MegavoltsPerSecond => As(ElectricPotentialChangeRateUnit.MegavoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerHours => As(ElectricPotentialChangeRateUnit.MicrovoltPerHour); + public double MicrovoltsPerHour => As(ElectricPotentialChangeRateUnit.MicrovoltPerHour); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); + public double MicrovoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerMinutes => As(ElectricPotentialChangeRateUnit.MicrovoltPerMinute); + public double MicrovoltsPerMinute => As(ElectricPotentialChangeRateUnit.MicrovoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerSeconds => As(ElectricPotentialChangeRateUnit.MicrovoltPerSecond); + public double MicrovoltsPerSecond => As(ElectricPotentialChangeRateUnit.MicrovoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerHours => As(ElectricPotentialChangeRateUnit.MillivoltPerHour); + public double MillivoltsPerHour => As(ElectricPotentialChangeRateUnit.MillivoltPerHour); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); + public double MillivoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerMinutes => As(ElectricPotentialChangeRateUnit.MillivoltPerMinute); + public double MillivoltsPerMinute => As(ElectricPotentialChangeRateUnit.MillivoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerSeconds => As(ElectricPotentialChangeRateUnit.MillivoltPerSecond); + public double MillivoltsPerSecond => As(ElectricPotentialChangeRateUnit.MillivoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double VoltsPerHours => As(ElectricPotentialChangeRateUnit.VoltPerHour); + public double VoltsPerHour => As(ElectricPotentialChangeRateUnit.VoltPerHour); /// /// Gets a value of this quantity converted into /// - public double VoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.VoltPerMicrosecond); + public double VoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.VoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double VoltsPerMinutes => As(ElectricPotentialChangeRateUnit.VoltPerMinute); + public double VoltsPerMinute => As(ElectricPotentialChangeRateUnit.VoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double VoltsPerSeconds => As(ElectricPotentialChangeRateUnit.VoltPerSecond); + public double VoltsPerSecond => As(ElectricPotentialChangeRateUnit.VoltPerSecond); #endregion @@ -187,121 +187,121 @@ public ElectricPotentialChangeRate(double value, ElectricPotentialChangeRateUnit /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerHours(double kilovoltsperhours) => new ElectricPotentialChangeRate(kilovoltsperhours, ElectricPotentialChangeRateUnit.KilovoltPerHour); + public static ElectricPotentialChangeRate FromKilovoltsPerHour(double kilovoltsperhour) => new ElectricPotentialChangeRate(kilovoltsperhour, ElectricPotentialChangeRateUnit.KilovoltPerHour); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerMicroseconds(double kilovoltspermicroseconds) => new ElectricPotentialChangeRate(kilovoltspermicroseconds, ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); + public static ElectricPotentialChangeRate FromKilovoltsPerMicrosecond(double kilovoltspermicrosecond) => new ElectricPotentialChangeRate(kilovoltspermicrosecond, ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerMinutes(double kilovoltsperminutes) => new ElectricPotentialChangeRate(kilovoltsperminutes, ElectricPotentialChangeRateUnit.KilovoltPerMinute); + public static ElectricPotentialChangeRate FromKilovoltsPerMinute(double kilovoltsperminute) => new ElectricPotentialChangeRate(kilovoltsperminute, ElectricPotentialChangeRateUnit.KilovoltPerMinute); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerSeconds(double kilovoltsperseconds) => new ElectricPotentialChangeRate(kilovoltsperseconds, ElectricPotentialChangeRateUnit.KilovoltPerSecond); + public static ElectricPotentialChangeRate FromKilovoltsPerSecond(double kilovoltspersecond) => new ElectricPotentialChangeRate(kilovoltspersecond, ElectricPotentialChangeRateUnit.KilovoltPerSecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerHours(double megavoltsperhours) => new ElectricPotentialChangeRate(megavoltsperhours, ElectricPotentialChangeRateUnit.MegavoltPerHour); + public static ElectricPotentialChangeRate FromMegavoltsPerHour(double megavoltsperhour) => new ElectricPotentialChangeRate(megavoltsperhour, ElectricPotentialChangeRateUnit.MegavoltPerHour); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerMicroseconds(double megavoltspermicroseconds) => new ElectricPotentialChangeRate(megavoltspermicroseconds, ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); + public static ElectricPotentialChangeRate FromMegavoltsPerMicrosecond(double megavoltspermicrosecond) => new ElectricPotentialChangeRate(megavoltspermicrosecond, ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerMinutes(double megavoltsperminutes) => new ElectricPotentialChangeRate(megavoltsperminutes, ElectricPotentialChangeRateUnit.MegavoltPerMinute); + public static ElectricPotentialChangeRate FromMegavoltsPerMinute(double megavoltsperminute) => new ElectricPotentialChangeRate(megavoltsperminute, ElectricPotentialChangeRateUnit.MegavoltPerMinute); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerSeconds(double megavoltsperseconds) => new ElectricPotentialChangeRate(megavoltsperseconds, ElectricPotentialChangeRateUnit.MegavoltPerSecond); + public static ElectricPotentialChangeRate FromMegavoltsPerSecond(double megavoltspersecond) => new ElectricPotentialChangeRate(megavoltspersecond, ElectricPotentialChangeRateUnit.MegavoltPerSecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerHours(double microvoltsperhours) => new ElectricPotentialChangeRate(microvoltsperhours, ElectricPotentialChangeRateUnit.MicrovoltPerHour); + public static ElectricPotentialChangeRate FromMicrovoltsPerHour(double microvoltsperhour) => new ElectricPotentialChangeRate(microvoltsperhour, ElectricPotentialChangeRateUnit.MicrovoltPerHour); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerMicroseconds(double microvoltspermicroseconds) => new ElectricPotentialChangeRate(microvoltspermicroseconds, ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); + public static ElectricPotentialChangeRate FromMicrovoltsPerMicrosecond(double microvoltspermicrosecond) => new ElectricPotentialChangeRate(microvoltspermicrosecond, ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerMinutes(double microvoltsperminutes) => new ElectricPotentialChangeRate(microvoltsperminutes, ElectricPotentialChangeRateUnit.MicrovoltPerMinute); + public static ElectricPotentialChangeRate FromMicrovoltsPerMinute(double microvoltsperminute) => new ElectricPotentialChangeRate(microvoltsperminute, ElectricPotentialChangeRateUnit.MicrovoltPerMinute); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerSeconds(double microvoltsperseconds) => new ElectricPotentialChangeRate(microvoltsperseconds, ElectricPotentialChangeRateUnit.MicrovoltPerSecond); + public static ElectricPotentialChangeRate FromMicrovoltsPerSecond(double microvoltspersecond) => new ElectricPotentialChangeRate(microvoltspersecond, ElectricPotentialChangeRateUnit.MicrovoltPerSecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerHours(double millivoltsperhours) => new ElectricPotentialChangeRate(millivoltsperhours, ElectricPotentialChangeRateUnit.MillivoltPerHour); + public static ElectricPotentialChangeRate FromMillivoltsPerHour(double millivoltsperhour) => new ElectricPotentialChangeRate(millivoltsperhour, ElectricPotentialChangeRateUnit.MillivoltPerHour); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerMicroseconds(double millivoltspermicroseconds) => new ElectricPotentialChangeRate(millivoltspermicroseconds, ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); + public static ElectricPotentialChangeRate FromMillivoltsPerMicrosecond(double millivoltspermicrosecond) => new ElectricPotentialChangeRate(millivoltspermicrosecond, ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerMinutes(double millivoltsperminutes) => new ElectricPotentialChangeRate(millivoltsperminutes, ElectricPotentialChangeRateUnit.MillivoltPerMinute); + public static ElectricPotentialChangeRate FromMillivoltsPerMinute(double millivoltsperminute) => new ElectricPotentialChangeRate(millivoltsperminute, ElectricPotentialChangeRateUnit.MillivoltPerMinute); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerSeconds(double millivoltsperseconds) => new ElectricPotentialChangeRate(millivoltsperseconds, ElectricPotentialChangeRateUnit.MillivoltPerSecond); + public static ElectricPotentialChangeRate FromMillivoltsPerSecond(double millivoltspersecond) => new ElectricPotentialChangeRate(millivoltspersecond, ElectricPotentialChangeRateUnit.MillivoltPerSecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerHours(double voltsperhours) => new ElectricPotentialChangeRate(voltsperhours, ElectricPotentialChangeRateUnit.VoltPerHour); + public static ElectricPotentialChangeRate FromVoltsPerHour(double voltsperhour) => new ElectricPotentialChangeRate(voltsperhour, ElectricPotentialChangeRateUnit.VoltPerHour); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerMicroseconds(double voltspermicroseconds) => new ElectricPotentialChangeRate(voltspermicroseconds, ElectricPotentialChangeRateUnit.VoltPerMicrosecond); + public static ElectricPotentialChangeRate FromVoltsPerMicrosecond(double voltspermicrosecond) => new ElectricPotentialChangeRate(voltspermicrosecond, ElectricPotentialChangeRateUnit.VoltPerMicrosecond); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerMinutes(double voltsperminutes) => new ElectricPotentialChangeRate(voltsperminutes, ElectricPotentialChangeRateUnit.VoltPerMinute); + public static ElectricPotentialChangeRate FromVoltsPerMinute(double voltsperminute) => new ElectricPotentialChangeRate(voltsperminute, ElectricPotentialChangeRateUnit.VoltPerMinute); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerSeconds(double voltsperseconds) => new ElectricPotentialChangeRate(voltsperseconds, ElectricPotentialChangeRateUnit.VoltPerSecond); + public static ElectricPotentialChangeRate FromVoltsPerSecond(double voltspersecond) => new ElectricPotentialChangeRate(voltspersecond, ElectricPotentialChangeRateUnit.VoltPerSecond); /// /// Dynamically convert from value and unit enum to . diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs index e1ff33660e..381e3e29c1 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -85,7 +85,7 @@ public FuelEfficiency(double value, FuelEfficiencyUnit unit) /// /// Gets a value of this quantity converted into /// - public double KilometersPerLiters => As(FuelEfficiencyUnit.KilometerPerLiter); + public double KilometersPerLiter => As(FuelEfficiencyUnit.KilometerPerLiter); /// /// Gets a value of this quantity converted into @@ -110,7 +110,7 @@ public FuelEfficiency(double value, FuelEfficiencyUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static FuelEfficiency FromKilometersPerLiters(double kilometersperliters) => new FuelEfficiency(kilometersperliters, FuelEfficiencyUnit.KilometerPerLiter); + public static FuelEfficiency FromKilometersPerLiter(double kilometersperliter) => new FuelEfficiency(kilometersperliter, FuelEfficiencyUnit.KilometerPerLiter); /// /// Creates a from . diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs index 6dc39a4e37..b8ebe48855 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs @@ -87,7 +87,7 @@ public Speed(double value, SpeedUnit unit) /// /// Gets a value of this quantity converted into /// - public double CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); + public double CentimetersPerMinute => As(SpeedUnit.CentimeterPerMinute); /// /// Gets a value of this quantity converted into @@ -97,7 +97,7 @@ public Speed(double value, SpeedUnit unit) /// /// Gets a value of this quantity converted into /// - public double DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); + public double DecimetersPerMinute => As(SpeedUnit.DecimeterPerMinute); /// /// Gets a value of this quantity converted into @@ -142,7 +142,7 @@ public Speed(double value, SpeedUnit unit) /// /// Gets a value of this quantity converted into /// - public double KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); + public double KilometersPerMinute => As(SpeedUnit.KilometerPerMinute); /// /// Gets a value of this quantity converted into @@ -167,7 +167,7 @@ public Speed(double value, SpeedUnit unit) /// /// Gets a value of this quantity converted into /// - public double MetersPerMinutes => As(SpeedUnit.MeterPerMinute); + public double MetersPerMinute => As(SpeedUnit.MeterPerMinute); /// /// Gets a value of this quantity converted into @@ -177,7 +177,7 @@ public Speed(double value, SpeedUnit unit) /// /// Gets a value of this quantity converted into /// - public double MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); + public double MicrometersPerMinute => As(SpeedUnit.MicrometerPerMinute); /// /// Gets a value of this quantity converted into @@ -197,7 +197,7 @@ public Speed(double value, SpeedUnit unit) /// /// Gets a value of this quantity converted into /// - public double MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); + public double MillimetersPerMinute => As(SpeedUnit.MillimeterPerMinute); /// /// Gets a value of this quantity converted into @@ -207,7 +207,7 @@ public Speed(double value, SpeedUnit unit) /// /// Gets a value of this quantity converted into /// - public double NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); + public double NanometersPerMinute => As(SpeedUnit.NanometerPerMinute); /// /// Gets a value of this quantity converted into @@ -258,7 +258,7 @@ public Speed(double value, SpeedUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerMinutes(double centimetersperminutes) => new Speed(centimetersperminutes, SpeedUnit.CentimeterPerMinute); + public static Speed FromCentimetersPerMinute(double centimetersperminute) => new Speed(centimetersperminute, SpeedUnit.CentimeterPerMinute); /// /// Creates a from . @@ -270,7 +270,7 @@ public Speed(double value, SpeedUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromDecimetersPerMinutes(double decimetersperminutes) => new Speed(decimetersperminutes, SpeedUnit.DecimeterPerMinute); + public static Speed FromDecimetersPerMinute(double decimetersperminute) => new Speed(decimetersperminute, SpeedUnit.DecimeterPerMinute); /// /// Creates a from . @@ -324,7 +324,7 @@ public Speed(double value, SpeedUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerMinutes(double kilometersperminutes) => new Speed(kilometersperminutes, SpeedUnit.KilometerPerMinute); + public static Speed FromKilometersPerMinute(double kilometersperminute) => new Speed(kilometersperminute, SpeedUnit.KilometerPerMinute); /// /// Creates a from . @@ -354,7 +354,7 @@ public Speed(double value, SpeedUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromMetersPerMinutes(double metersperminutes) => new Speed(metersperminutes, SpeedUnit.MeterPerMinute); + public static Speed FromMetersPerMinute(double metersperminute) => new Speed(metersperminute, SpeedUnit.MeterPerMinute); /// /// Creates a from . @@ -366,7 +366,7 @@ public Speed(double value, SpeedUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromMicrometersPerMinutes(double micrometersperminutes) => new Speed(micrometersperminutes, SpeedUnit.MicrometerPerMinute); + public static Speed FromMicrometersPerMinute(double micrometersperminute) => new Speed(micrometersperminute, SpeedUnit.MicrometerPerMinute); /// /// Creates a from . @@ -390,7 +390,7 @@ public Speed(double value, SpeedUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerMinutes(double millimetersperminutes) => new Speed(millimetersperminutes, SpeedUnit.MillimeterPerMinute); + public static Speed FromMillimetersPerMinute(double millimetersperminute) => new Speed(millimetersperminute, SpeedUnit.MillimeterPerMinute); /// /// Creates a from . @@ -402,7 +402,7 @@ public Speed(double value, SpeedUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromNanometersPerMinutes(double nanometersperminutes) => new Speed(nanometersperminutes, SpeedUnit.NanometerPerMinute); + public static Speed FromNanometersPerMinute(double nanometersperminute) => new Speed(nanometersperminute, SpeedUnit.NanometerPerMinute); /// /// Creates a from . diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs index 2f2283f3af..9946644fa7 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -82,12 +82,12 @@ public TemperatureGradient(double value, TemperatureGradientUnit unit) /// /// Gets a value of this quantity converted into /// - public double DegreesCelciusPerKilometer => As(TemperatureGradientUnit.DegreeCelsiusPerKilometer); + public double DegreesCelsiusPerKilometer => As(TemperatureGradientUnit.DegreeCelsiusPerKilometer); /// /// Gets a value of this quantity converted into /// - public double DegreesCelciusPerMeter => As(TemperatureGradientUnit.DegreeCelsiusPerMeter); + public double DegreesCelsiusPerMeter => As(TemperatureGradientUnit.DegreeCelsiusPerMeter); /// /// Gets a value of this quantity converted into @@ -107,13 +107,13 @@ public TemperatureGradient(double value, TemperatureGradientUnit unit) /// Creates a from . /// /// If value is NaN or Infinity. - public static TemperatureGradient FromDegreesCelciusPerKilometer(double degreescelciusperkilometer) => new TemperatureGradient(degreescelciusperkilometer, TemperatureGradientUnit.DegreeCelsiusPerKilometer); + public static TemperatureGradient FromDegreesCelsiusPerKilometer(double degreescelsiusperkilometer) => new TemperatureGradient(degreescelsiusperkilometer, TemperatureGradientUnit.DegreeCelsiusPerKilometer); /// /// Creates a from . /// /// If value is NaN or Infinity. - public static TemperatureGradient FromDegreesCelciusPerMeter(double degreescelciuspermeter) => new TemperatureGradient(degreescelciuspermeter, TemperatureGradientUnit.DegreeCelsiusPerMeter); + public static TemperatureGradient FromDegreesCelsiusPerMeter(double degreescelsiuspermeter) => new TemperatureGradient(degreescelsiuspermeter, TemperatureGradientUnit.DegreeCelsiusPerMeter); /// /// Creates a from . diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs index f61c2cf329..4df840f2f8 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs @@ -25,8 +25,8 @@ namespace UnitsNet.Tests public class NumberToDensityExtensionsTests { [Fact] - public void NumberToCentigramsPerDeciLiterTest() => - Assert.Equal(Density.FromCentigramsPerDeciLiter(2), 2.CentigramsPerDeciLiter()); + public void NumberToCentigramsPerDeciliterTest() => + Assert.Equal(Density.FromCentigramsPerDeciliter(2), 2.CentigramsPerDeciliter()); [Fact] public void NumberToCentigramsPerLiterTest() => @@ -37,8 +37,8 @@ public void NumberToCentigramsPerMilliliterTest() => Assert.Equal(Density.FromCentigramsPerMilliliter(2), 2.CentigramsPerMilliliter()); [Fact] - public void NumberToDecigramsPerDeciLiterTest() => - Assert.Equal(Density.FromDecigramsPerDeciLiter(2), 2.DecigramsPerDeciLiter()); + public void NumberToDecigramsPerDeciliterTest() => + Assert.Equal(Density.FromDecigramsPerDeciliter(2), 2.DecigramsPerDeciliter()); [Fact] public void NumberToDecigramsPerLiterTest() => @@ -49,8 +49,8 @@ public void NumberToDecigramsPerMilliliterTest() => Assert.Equal(Density.FromDecigramsPerMilliliter(2), 2.DecigramsPerMilliliter()); [Fact] - public void NumberToFemtogramsPerDeciLiterTest() => - Assert.Equal(Density.FromFemtogramsPerDeciLiter(2), 2.FemtogramsPerDeciLiter()); + public void NumberToFemtogramsPerDeciliterTest() => + Assert.Equal(Density.FromFemtogramsPerDeciliter(2), 2.FemtogramsPerDeciliter()); [Fact] public void NumberToFemtogramsPerLiterTest() => @@ -81,8 +81,8 @@ public void NumberToGramsPerCubicMillimeterTest() => Assert.Equal(Density.FromGramsPerCubicMillimeter(2), 2.GramsPerCubicMillimeter()); [Fact] - public void NumberToGramsPerDeciLiterTest() => - Assert.Equal(Density.FromGramsPerDeciLiter(2), 2.GramsPerDeciLiter()); + public void NumberToGramsPerDeciliterTest() => + Assert.Equal(Density.FromGramsPerDeciliter(2), 2.GramsPerDeciliter()); [Fact] public void NumberToGramsPerLiterTest() => @@ -125,8 +125,8 @@ public void NumberToMicrogramsPerCubicMeterTest() => Assert.Equal(Density.FromMicrogramsPerCubicMeter(2), 2.MicrogramsPerCubicMeter()); [Fact] - public void NumberToMicrogramsPerDeciLiterTest() => - Assert.Equal(Density.FromMicrogramsPerDeciLiter(2), 2.MicrogramsPerDeciLiter()); + public void NumberToMicrogramsPerDeciliterTest() => + Assert.Equal(Density.FromMicrogramsPerDeciliter(2), 2.MicrogramsPerDeciliter()); [Fact] public void NumberToMicrogramsPerLiterTest() => @@ -141,8 +141,8 @@ public void NumberToMilligramsPerCubicMeterTest() => Assert.Equal(Density.FromMilligramsPerCubicMeter(2), 2.MilligramsPerCubicMeter()); [Fact] - public void NumberToMilligramsPerDeciLiterTest() => - Assert.Equal(Density.FromMilligramsPerDeciLiter(2), 2.MilligramsPerDeciLiter()); + public void NumberToMilligramsPerDeciliterTest() => + Assert.Equal(Density.FromMilligramsPerDeciliter(2), 2.MilligramsPerDeciliter()); [Fact] public void NumberToMilligramsPerLiterTest() => @@ -153,8 +153,8 @@ public void NumberToMilligramsPerMilliliterTest() => Assert.Equal(Density.FromMilligramsPerMilliliter(2), 2.MilligramsPerMilliliter()); [Fact] - public void NumberToNanogramsPerDeciLiterTest() => - Assert.Equal(Density.FromNanogramsPerDeciLiter(2), 2.NanogramsPerDeciLiter()); + public void NumberToNanogramsPerDeciliterTest() => + Assert.Equal(Density.FromNanogramsPerDeciliter(2), 2.NanogramsPerDeciliter()); [Fact] public void NumberToNanogramsPerLiterTest() => @@ -165,8 +165,8 @@ public void NumberToNanogramsPerMilliliterTest() => Assert.Equal(Density.FromNanogramsPerMilliliter(2), 2.NanogramsPerMilliliter()); [Fact] - public void NumberToPicogramsPerDeciLiterTest() => - Assert.Equal(Density.FromPicogramsPerDeciLiter(2), 2.PicogramsPerDeciLiter()); + public void NumberToPicogramsPerDeciliterTest() => + Assert.Equal(Density.FromPicogramsPerDeciliter(2), 2.PicogramsPerDeciliter()); [Fact] public void NumberToPicogramsPerLiterTest() => diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs index da8acffcc6..dda5ae8b63 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToElectricPotentialChangeRateExtensionsTest.g.cs @@ -25,84 +25,84 @@ namespace UnitsNet.Tests public class NumberToElectricPotentialChangeRateExtensionsTests { [Fact] - public void NumberToKilovoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerHours(2), 2.KilovoltsPerHours()); + public void NumberToKilovoltsPerHourTest() => + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerHour(2), 2.KilovoltsPerHour()); [Fact] - public void NumberToKilovoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMicroseconds(2), 2.KilovoltsPerMicroseconds()); + public void NumberToKilovoltsPerMicrosecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMicrosecond(2), 2.KilovoltsPerMicrosecond()); [Fact] - public void NumberToKilovoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMinutes(2), 2.KilovoltsPerMinutes()); + public void NumberToKilovoltsPerMinuteTest() => + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerMinute(2), 2.KilovoltsPerMinute()); [Fact] - public void NumberToKilovoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerSeconds(2), 2.KilovoltsPerSeconds()); + public void NumberToKilovoltsPerSecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromKilovoltsPerSecond(2), 2.KilovoltsPerSecond()); [Fact] - public void NumberToMegavoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerHours(2), 2.MegavoltsPerHours()); + public void NumberToMegavoltsPerHourTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerHour(2), 2.MegavoltsPerHour()); [Fact] - public void NumberToMegavoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMicroseconds(2), 2.MegavoltsPerMicroseconds()); + public void NumberToMegavoltsPerMicrosecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMicrosecond(2), 2.MegavoltsPerMicrosecond()); [Fact] - public void NumberToMegavoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMinutes(2), 2.MegavoltsPerMinutes()); + public void NumberToMegavoltsPerMinuteTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerMinute(2), 2.MegavoltsPerMinute()); [Fact] - public void NumberToMegavoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerSeconds(2), 2.MegavoltsPerSeconds()); + public void NumberToMegavoltsPerSecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMegavoltsPerSecond(2), 2.MegavoltsPerSecond()); [Fact] - public void NumberToMicrovoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerHours(2), 2.MicrovoltsPerHours()); + public void NumberToMicrovoltsPerHourTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerHour(2), 2.MicrovoltsPerHour()); [Fact] - public void NumberToMicrovoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMicroseconds(2), 2.MicrovoltsPerMicroseconds()); + public void NumberToMicrovoltsPerMicrosecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMicrosecond(2), 2.MicrovoltsPerMicrosecond()); [Fact] - public void NumberToMicrovoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMinutes(2), 2.MicrovoltsPerMinutes()); + public void NumberToMicrovoltsPerMinuteTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerMinute(2), 2.MicrovoltsPerMinute()); [Fact] - public void NumberToMicrovoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerSeconds(2), 2.MicrovoltsPerSeconds()); + public void NumberToMicrovoltsPerSecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMicrovoltsPerSecond(2), 2.MicrovoltsPerSecond()); [Fact] - public void NumberToMillivoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerHours(2), 2.MillivoltsPerHours()); + public void NumberToMillivoltsPerHourTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerHour(2), 2.MillivoltsPerHour()); [Fact] - public void NumberToMillivoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMicroseconds(2), 2.MillivoltsPerMicroseconds()); + public void NumberToMillivoltsPerMicrosecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMicrosecond(2), 2.MillivoltsPerMicrosecond()); [Fact] - public void NumberToMillivoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMinutes(2), 2.MillivoltsPerMinutes()); + public void NumberToMillivoltsPerMinuteTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerMinute(2), 2.MillivoltsPerMinute()); [Fact] - public void NumberToMillivoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerSeconds(2), 2.MillivoltsPerSeconds()); + public void NumberToMillivoltsPerSecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromMillivoltsPerSecond(2), 2.MillivoltsPerSecond()); [Fact] - public void NumberToVoltsPerHoursTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerHours(2), 2.VoltsPerHours()); + public void NumberToVoltsPerHourTest() => + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerHour(2), 2.VoltsPerHour()); [Fact] - public void NumberToVoltsPerMicrosecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMicroseconds(2), 2.VoltsPerMicroseconds()); + public void NumberToVoltsPerMicrosecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMicrosecond(2), 2.VoltsPerMicrosecond()); [Fact] - public void NumberToVoltsPerMinutesTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMinutes(2), 2.VoltsPerMinutes()); + public void NumberToVoltsPerMinuteTest() => + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerMinute(2), 2.VoltsPerMinute()); [Fact] - public void NumberToVoltsPerSecondsTest() => - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerSeconds(2), 2.VoltsPerSeconds()); + public void NumberToVoltsPerSecondTest() => + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerSecond(2), 2.VoltsPerSecond()); } } diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs index 1a82f80799..c721dbcb09 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToFuelEfficiencyExtensionsTest.g.cs @@ -25,8 +25,8 @@ namespace UnitsNet.Tests public class NumberToFuelEfficiencyExtensionsTests { [Fact] - public void NumberToKilometersPerLitersTest() => - Assert.Equal(FuelEfficiency.FromKilometersPerLiters(2), 2.KilometersPerLiters()); + public void NumberToKilometersPerLiterTest() => + Assert.Equal(FuelEfficiency.FromKilometersPerLiter(2), 2.KilometersPerLiter()); [Fact] public void NumberToLitersPer100KilometersTest() => diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs index 7ce9151a80..770b924b14 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToSpeedExtensionsTest.g.cs @@ -29,16 +29,16 @@ public void NumberToCentimetersPerHourTest() => Assert.Equal(Speed.FromCentimetersPerHour(2), 2.CentimetersPerHour()); [Fact] - public void NumberToCentimetersPerMinutesTest() => - Assert.Equal(Speed.FromCentimetersPerMinutes(2), 2.CentimetersPerMinutes()); + public void NumberToCentimetersPerMinuteTest() => + Assert.Equal(Speed.FromCentimetersPerMinute(2), 2.CentimetersPerMinute()); [Fact] public void NumberToCentimetersPerSecondTest() => Assert.Equal(Speed.FromCentimetersPerSecond(2), 2.CentimetersPerSecond()); [Fact] - public void NumberToDecimetersPerMinutesTest() => - Assert.Equal(Speed.FromDecimetersPerMinutes(2), 2.DecimetersPerMinutes()); + public void NumberToDecimetersPerMinuteTest() => + Assert.Equal(Speed.FromDecimetersPerMinute(2), 2.DecimetersPerMinute()); [Fact] public void NumberToDecimetersPerSecondTest() => @@ -73,8 +73,8 @@ public void NumberToKilometersPerHourTest() => Assert.Equal(Speed.FromKilometersPerHour(2), 2.KilometersPerHour()); [Fact] - public void NumberToKilometersPerMinutesTest() => - Assert.Equal(Speed.FromKilometersPerMinutes(2), 2.KilometersPerMinutes()); + public void NumberToKilometersPerMinuteTest() => + Assert.Equal(Speed.FromKilometersPerMinute(2), 2.KilometersPerMinute()); [Fact] public void NumberToKilometersPerSecondTest() => @@ -93,16 +93,16 @@ public void NumberToMetersPerHourTest() => Assert.Equal(Speed.FromMetersPerHour(2), 2.MetersPerHour()); [Fact] - public void NumberToMetersPerMinutesTest() => - Assert.Equal(Speed.FromMetersPerMinutes(2), 2.MetersPerMinutes()); + public void NumberToMetersPerMinuteTest() => + Assert.Equal(Speed.FromMetersPerMinute(2), 2.MetersPerMinute()); [Fact] public void NumberToMetersPerSecondTest() => Assert.Equal(Speed.FromMetersPerSecond(2), 2.MetersPerSecond()); [Fact] - public void NumberToMicrometersPerMinutesTest() => - Assert.Equal(Speed.FromMicrometersPerMinutes(2), 2.MicrometersPerMinutes()); + public void NumberToMicrometersPerMinuteTest() => + Assert.Equal(Speed.FromMicrometersPerMinute(2), 2.MicrometersPerMinute()); [Fact] public void NumberToMicrometersPerSecondTest() => @@ -117,16 +117,16 @@ public void NumberToMillimetersPerHourTest() => Assert.Equal(Speed.FromMillimetersPerHour(2), 2.MillimetersPerHour()); [Fact] - public void NumberToMillimetersPerMinutesTest() => - Assert.Equal(Speed.FromMillimetersPerMinutes(2), 2.MillimetersPerMinutes()); + public void NumberToMillimetersPerMinuteTest() => + Assert.Equal(Speed.FromMillimetersPerMinute(2), 2.MillimetersPerMinute()); [Fact] public void NumberToMillimetersPerSecondTest() => Assert.Equal(Speed.FromMillimetersPerSecond(2), 2.MillimetersPerSecond()); [Fact] - public void NumberToNanometersPerMinutesTest() => - Assert.Equal(Speed.FromNanometersPerMinutes(2), 2.NanometersPerMinutes()); + public void NumberToNanometersPerMinuteTest() => + Assert.Equal(Speed.FromNanometersPerMinute(2), 2.NanometersPerMinute()); [Fact] public void NumberToNanometersPerSecondTest() => diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureGradientExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureGradientExtensionsTest.g.cs index 4062ea3754..ae4c204e70 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureGradientExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureGradientExtensionsTest.g.cs @@ -25,12 +25,12 @@ namespace UnitsNet.Tests public class NumberToTemperatureGradientExtensionsTests { [Fact] - public void NumberToDegreesCelciusPerKilometerTest() => - Assert.Equal(TemperatureGradient.FromDegreesCelciusPerKilometer(2), 2.DegreesCelciusPerKilometer()); + public void NumberToDegreesCelsiusPerKilometerTest() => + Assert.Equal(TemperatureGradient.FromDegreesCelsiusPerKilometer(2), 2.DegreesCelsiusPerKilometer()); [Fact] - public void NumberToDegreesCelciusPerMeterTest() => - Assert.Equal(TemperatureGradient.FromDegreesCelciusPerMeter(2), 2.DegreesCelciusPerMeter()); + public void NumberToDegreesCelsiusPerMeterTest() => + Assert.Equal(TemperatureGradient.FromDegreesCelsiusPerMeter(2), 2.DegreesCelsiusPerMeter()); [Fact] public void NumberToDegreesFahrenheitPerFootTest() => diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs index 2ef9a7e913..fab19c64b9 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs @@ -32,13 +32,13 @@ namespace UnitsNet.NumberExtensions.NumberToDensity /// public static class NumberToDensityExtensions { - /// - public static Density CentigramsPerDeciLiter(this T value) + /// + public static Density CentigramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromCentigramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromCentigramsPerDeciliter(Convert.ToDouble(value)); /// public static Density CentigramsPerLiter(this T value) @@ -56,13 +56,13 @@ public static Density CentigramsPerMilliliter(this T value) #endif => Density.FromCentigramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density DecigramsPerDeciLiter(this T value) + /// + public static Density DecigramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromDecigramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromDecigramsPerDeciliter(Convert.ToDouble(value)); /// public static Density DecigramsPerLiter(this T value) @@ -80,13 +80,13 @@ public static Density DecigramsPerMilliliter(this T value) #endif => Density.FromDecigramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density FemtogramsPerDeciLiter(this T value) + /// + public static Density FemtogramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromFemtogramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromFemtogramsPerDeciliter(Convert.ToDouble(value)); /// public static Density FemtogramsPerLiter(this T value) @@ -144,13 +144,13 @@ public static Density GramsPerCubicMillimeter(this T value) #endif => Density.FromGramsPerCubicMillimeter(Convert.ToDouble(value)); - /// - public static Density GramsPerDeciLiter(this T value) + /// + public static Density GramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromGramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromGramsPerDeciliter(Convert.ToDouble(value)); /// public static Density GramsPerLiter(this T value) @@ -232,13 +232,13 @@ public static Density MicrogramsPerCubicMeter(this T value) #endif => Density.FromMicrogramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static Density MicrogramsPerDeciLiter(this T value) + /// + public static Density MicrogramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromMicrogramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromMicrogramsPerDeciliter(Convert.ToDouble(value)); /// public static Density MicrogramsPerLiter(this T value) @@ -264,13 +264,13 @@ public static Density MilligramsPerCubicMeter(this T value) #endif => Density.FromMilligramsPerCubicMeter(Convert.ToDouble(value)); - /// - public static Density MilligramsPerDeciLiter(this T value) + /// + public static Density MilligramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromMilligramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromMilligramsPerDeciliter(Convert.ToDouble(value)); /// public static Density MilligramsPerLiter(this T value) @@ -288,13 +288,13 @@ public static Density MilligramsPerMilliliter(this T value) #endif => Density.FromMilligramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density NanogramsPerDeciLiter(this T value) + /// + public static Density NanogramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromNanogramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromNanogramsPerDeciliter(Convert.ToDouble(value)); /// public static Density NanogramsPerLiter(this T value) @@ -312,13 +312,13 @@ public static Density NanogramsPerMilliliter(this T value) #endif => Density.FromNanogramsPerMilliliter(Convert.ToDouble(value)); - /// - public static Density PicogramsPerDeciLiter(this T value) + /// + public static Density PicogramsPerDeciliter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Density.FromPicogramsPerDeciLiter(Convert.ToDouble(value)); + => Density.FromPicogramsPerDeciliter(Convert.ToDouble(value)); /// public static Density PicogramsPerLiter(this T value) diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs index c277d4ab40..c41cfd13ba 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToElectricPotentialChangeRateExtensions.g.cs @@ -32,165 +32,165 @@ namespace UnitsNet.NumberExtensions.NumberToElectricPotentialChangeRate /// public static class NumberToElectricPotentialChangeRateExtensions { - /// - public static ElectricPotentialChangeRate KilovoltsPerHours(this T value) + /// + public static ElectricPotentialChangeRate KilovoltsPerHour(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromKilovoltsPerHours(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromKilovoltsPerHour(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate KilovoltsPerMicroseconds(this T value) + /// + public static ElectricPotentialChangeRate KilovoltsPerMicrosecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromKilovoltsPerMicroseconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromKilovoltsPerMicrosecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate KilovoltsPerMinutes(this T value) + /// + public static ElectricPotentialChangeRate KilovoltsPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromKilovoltsPerMinutes(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromKilovoltsPerMinute(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate KilovoltsPerSeconds(this T value) + /// + public static ElectricPotentialChangeRate KilovoltsPerSecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromKilovoltsPerSeconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromKilovoltsPerSecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerHours(this T value) + /// + public static ElectricPotentialChangeRate MegavoltsPerHour(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMegavoltsPerHours(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMegavoltsPerHour(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerMicroseconds(this T value) + /// + public static ElectricPotentialChangeRate MegavoltsPerMicrosecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMegavoltsPerMicroseconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMegavoltsPerMicrosecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerMinutes(this T value) + /// + public static ElectricPotentialChangeRate MegavoltsPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMegavoltsPerMinutes(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMegavoltsPerMinute(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MegavoltsPerSeconds(this T value) + /// + public static ElectricPotentialChangeRate MegavoltsPerSecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMegavoltsPerSeconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMegavoltsPerSecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerHours(this T value) + /// + public static ElectricPotentialChangeRate MicrovoltsPerHour(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMicrovoltsPerHours(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMicrovoltsPerHour(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerMicroseconds(this T value) + /// + public static ElectricPotentialChangeRate MicrovoltsPerMicrosecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMicrovoltsPerMicroseconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMicrovoltsPerMicrosecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerMinutes(this T value) + /// + public static ElectricPotentialChangeRate MicrovoltsPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMicrovoltsPerMinutes(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMicrovoltsPerMinute(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MicrovoltsPerSeconds(this T value) + /// + public static ElectricPotentialChangeRate MicrovoltsPerSecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMicrovoltsPerSeconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMicrovoltsPerSecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerHours(this T value) + /// + public static ElectricPotentialChangeRate MillivoltsPerHour(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMillivoltsPerHours(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMillivoltsPerHour(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerMicroseconds(this T value) + /// + public static ElectricPotentialChangeRate MillivoltsPerMicrosecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMillivoltsPerMicroseconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMillivoltsPerMicrosecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerMinutes(this T value) + /// + public static ElectricPotentialChangeRate MillivoltsPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMillivoltsPerMinutes(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMillivoltsPerMinute(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate MillivoltsPerSeconds(this T value) + /// + public static ElectricPotentialChangeRate MillivoltsPerSecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromMillivoltsPerSeconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromMillivoltsPerSecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerHours(this T value) + /// + public static ElectricPotentialChangeRate VoltsPerHour(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromVoltsPerHours(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromVoltsPerHour(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerMicroseconds(this T value) + /// + public static ElectricPotentialChangeRate VoltsPerMicrosecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromVoltsPerMicroseconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromVoltsPerMicrosecond(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerMinutes(this T value) + /// + public static ElectricPotentialChangeRate VoltsPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromVoltsPerMinutes(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromVoltsPerMinute(Convert.ToDouble(value)); - /// - public static ElectricPotentialChangeRate VoltsPerSeconds(this T value) + /// + public static ElectricPotentialChangeRate VoltsPerSecond(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => ElectricPotentialChangeRate.FromVoltsPerSeconds(Convert.ToDouble(value)); + => ElectricPotentialChangeRate.FromVoltsPerSecond(Convert.ToDouble(value)); } } diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs index da01bfdfcd..e7681b8ef9 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToFuelEfficiencyExtensions.g.cs @@ -32,13 +32,13 @@ namespace UnitsNet.NumberExtensions.NumberToFuelEfficiency /// public static class NumberToFuelEfficiencyExtensions { - /// - public static FuelEfficiency KilometersPerLiters(this T value) + /// + public static FuelEfficiency KilometersPerLiter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => FuelEfficiency.FromKilometersPerLiters(Convert.ToDouble(value)); + => FuelEfficiency.FromKilometersPerLiter(Convert.ToDouble(value)); /// public static FuelEfficiency LitersPer100Kilometers(this T value) diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs index ab0cfd99cb..956e9ae248 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToSpeedExtensions.g.cs @@ -40,13 +40,13 @@ public static Speed CentimetersPerHour(this T value) #endif => Speed.FromCentimetersPerHour(Convert.ToDouble(value)); - /// - public static Speed CentimetersPerMinutes(this T value) + /// + public static Speed CentimetersPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Speed.FromCentimetersPerMinutes(Convert.ToDouble(value)); + => Speed.FromCentimetersPerMinute(Convert.ToDouble(value)); /// public static Speed CentimetersPerSecond(this T value) @@ -56,13 +56,13 @@ public static Speed CentimetersPerSecond(this T value) #endif => Speed.FromCentimetersPerSecond(Convert.ToDouble(value)); - /// - public static Speed DecimetersPerMinutes(this T value) + /// + public static Speed DecimetersPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Speed.FromDecimetersPerMinutes(Convert.ToDouble(value)); + => Speed.FromDecimetersPerMinute(Convert.ToDouble(value)); /// public static Speed DecimetersPerSecond(this T value) @@ -128,13 +128,13 @@ public static Speed KilometersPerHour(this T value) #endif => Speed.FromKilometersPerHour(Convert.ToDouble(value)); - /// - public static Speed KilometersPerMinutes(this T value) + /// + public static Speed KilometersPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Speed.FromKilometersPerMinutes(Convert.ToDouble(value)); + => Speed.FromKilometersPerMinute(Convert.ToDouble(value)); /// public static Speed KilometersPerSecond(this T value) @@ -168,13 +168,13 @@ public static Speed MetersPerHour(this T value) #endif => Speed.FromMetersPerHour(Convert.ToDouble(value)); - /// - public static Speed MetersPerMinutes(this T value) + /// + public static Speed MetersPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Speed.FromMetersPerMinutes(Convert.ToDouble(value)); + => Speed.FromMetersPerMinute(Convert.ToDouble(value)); /// public static Speed MetersPerSecond(this T value) @@ -184,13 +184,13 @@ public static Speed MetersPerSecond(this T value) #endif => Speed.FromMetersPerSecond(Convert.ToDouble(value)); - /// - public static Speed MicrometersPerMinutes(this T value) + /// + public static Speed MicrometersPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Speed.FromMicrometersPerMinutes(Convert.ToDouble(value)); + => Speed.FromMicrometersPerMinute(Convert.ToDouble(value)); /// public static Speed MicrometersPerSecond(this T value) @@ -216,13 +216,13 @@ public static Speed MillimetersPerHour(this T value) #endif => Speed.FromMillimetersPerHour(Convert.ToDouble(value)); - /// - public static Speed MillimetersPerMinutes(this T value) + /// + public static Speed MillimetersPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Speed.FromMillimetersPerMinutes(Convert.ToDouble(value)); + => Speed.FromMillimetersPerMinute(Convert.ToDouble(value)); /// public static Speed MillimetersPerSecond(this T value) @@ -232,13 +232,13 @@ public static Speed MillimetersPerSecond(this T value) #endif => Speed.FromMillimetersPerSecond(Convert.ToDouble(value)); - /// - public static Speed NanometersPerMinutes(this T value) + /// + public static Speed NanometersPerMinute(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => Speed.FromNanometersPerMinutes(Convert.ToDouble(value)); + => Speed.FromNanometersPerMinute(Convert.ToDouble(value)); /// public static Speed NanometersPerSecond(this T value) diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureGradientExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureGradientExtensions.g.cs index e8ad22828c..b12ee6e3bb 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureGradientExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureGradientExtensions.g.cs @@ -32,21 +32,21 @@ namespace UnitsNet.NumberExtensions.NumberToTemperatureGradient /// public static class NumberToTemperatureGradientExtensions { - /// - public static TemperatureGradient DegreesCelciusPerKilometer(this T value) + /// + public static TemperatureGradient DegreesCelsiusPerKilometer(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => TemperatureGradient.FromDegreesCelciusPerKilometer(Convert.ToDouble(value)); + => TemperatureGradient.FromDegreesCelsiusPerKilometer(Convert.ToDouble(value)); - /// - public static TemperatureGradient DegreesCelciusPerMeter(this T value) + /// + public static TemperatureGradient DegreesCelsiusPerMeter(this T value) where T : notnull #if NET7_0_OR_GREATER , INumber #endif - => TemperatureGradient.FromDegreesCelciusPerMeter(Convert.ToDouble(value)); + => TemperatureGradient.FromDegreesCelsiusPerMeter(Convert.ToDouble(value)); /// public static TemperatureGradient DegreesFahrenheitPerFoot(this T value) diff --git a/UnitsNet.Tests/CustomCode/DensityTests.cs b/UnitsNet.Tests/CustomCode/DensityTests.cs index 1bec0dac10..0d5b42a287 100644 --- a/UnitsNet.Tests/CustomCode/DensityTests.cs +++ b/UnitsNet.Tests/CustomCode/DensityTests.cs @@ -47,45 +47,45 @@ public class DensityTests : DensityTestsBase protected override double SlugsPerCubicFootInOneKilogramPerCubicMeter => 0.00194032; - protected override double CentigramsPerDeciLiterInOneKilogramPerCubicMeter => 1e1; + protected override double CentigramsPerDeciliterInOneKilogramPerCubicMeter => 1e1; protected override double CentigramsPerLiterInOneKilogramPerCubicMeter => 1e2; protected override double CentigramsPerMilliliterInOneKilogramPerCubicMeter => 1e-1; - protected override double DecigramsPerDeciLiterInOneKilogramPerCubicMeter => 1; + protected override double DecigramsPerDeciliterInOneKilogramPerCubicMeter => 1; protected override double DecigramsPerLiterInOneKilogramPerCubicMeter => 1e1; protected override double DecigramsPerMilliliterInOneKilogramPerCubicMeter => 1e-2; - protected override double GramsPerDeciLiterInOneKilogramPerCubicMeter => 1e-1; + protected override double GramsPerDeciliterInOneKilogramPerCubicMeter => 1e-1; protected override double GramsPerLiterInOneKilogramPerCubicMeter => 1; protected override double GramsPerMilliliterInOneKilogramPerCubicMeter => 1e-3; - protected override double MicrogramsPerDeciLiterInOneKilogramPerCubicMeter => 1e5; + protected override double MicrogramsPerDeciliterInOneKilogramPerCubicMeter => 1e5; protected override double MicrogramsPerLiterInOneKilogramPerCubicMeter => 1e6; protected override double MicrogramsPerMilliliterInOneKilogramPerCubicMeter => 1e3; - protected override double MilligramsPerDeciLiterInOneKilogramPerCubicMeter => 1e2; + protected override double MilligramsPerDeciliterInOneKilogramPerCubicMeter => 1e2; protected override double MilligramsPerLiterInOneKilogramPerCubicMeter => 1e3; protected override double MilligramsPerMilliliterInOneKilogramPerCubicMeter => 1; - protected override double NanogramsPerDeciLiterInOneKilogramPerCubicMeter => 1e8; + protected override double NanogramsPerDeciliterInOneKilogramPerCubicMeter => 1e8; protected override double NanogramsPerLiterInOneKilogramPerCubicMeter => 1e9; protected override double NanogramsPerMilliliterInOneKilogramPerCubicMeter => 1e6; - protected override double PicogramsPerDeciLiterInOneKilogramPerCubicMeter => 1e11; + protected override double PicogramsPerDeciliterInOneKilogramPerCubicMeter => 1e11; - protected override double FemtogramsPerDeciLiterInOneKilogramPerCubicMeter => 1e14; + protected override double FemtogramsPerDeciliterInOneKilogramPerCubicMeter => 1e14; protected override double PicogramsPerLiterInOneKilogramPerCubicMeter => 1e12; diff --git a/UnitsNet.Tests/CustomCode/ElectricPotentialChangeRateTests.cs b/UnitsNet.Tests/CustomCode/ElectricPotentialChangeRateTests.cs index 478fe93087..80dd69de4d 100644 --- a/UnitsNet.Tests/CustomCode/ElectricPotentialChangeRateTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricPotentialChangeRateTests.cs @@ -24,25 +24,25 @@ namespace UnitsNet.Tests.CustomCode public class ElectricPotentialChangeRateTests : ElectricPotentialChangeRateTestsBase { protected override bool SupportsSIUnitSystem => true; - protected override double KilovoltsPerHoursInOneVoltPerSecond => 3.6; - protected override double KilovoltsPerMicrosecondsInOneVoltPerSecond => 1e-09; - protected override double KilovoltsPerMinutesInOneVoltPerSecond => 6e-2; - protected override double KilovoltsPerSecondsInOneVoltPerSecond => 0.001; - protected override double MegavoltsPerHoursInOneVoltPerSecond => 3.6e-3; - protected override double MegavoltsPerMicrosecondsInOneVoltPerSecond => 1e-12; - protected override double MegavoltsPerMinutesInOneVoltPerSecond => 6e-05; - protected override double MegavoltsPerSecondsInOneVoltPerSecond => 1e-06; - protected override double MicrovoltsPerHoursInOneVoltPerSecond => 3.6e9; - protected override double MicrovoltsPerMicrosecondsInOneVoltPerSecond => 1; - protected override double MicrovoltsPerMinutesInOneVoltPerSecond => 6e7; - protected override double MicrovoltsPerSecondsInOneVoltPerSecond => 1e6; - protected override double MillivoltsPerHoursInOneVoltPerSecond => 3.6e6; - protected override double MillivoltsPerMicrosecondsInOneVoltPerSecond => 0.001; - protected override double MillivoltsPerMinutesInOneVoltPerSecond => 6e4; - protected override double MillivoltsPerSecondsInOneVoltPerSecond => 1000; - protected override double VoltsPerHoursInOneVoltPerSecond => 3600; - protected override double VoltsPerMicrosecondsInOneVoltPerSecond => 1e-06; - protected override double VoltsPerMinutesInOneVoltPerSecond => 60; - protected override double VoltsPerSecondsInOneVoltPerSecond => 1; + protected override double KilovoltsPerHourInOneVoltPerSecond => 3.6; + protected override double KilovoltsPerMicrosecondInOneVoltPerSecond => 1e-09; + protected override double KilovoltsPerMinuteInOneVoltPerSecond => 6e-2; + protected override double KilovoltsPerSecondInOneVoltPerSecond => 0.001; + protected override double MegavoltsPerHourInOneVoltPerSecond => 3.6e-3; + protected override double MegavoltsPerMicrosecondInOneVoltPerSecond => 1e-12; + protected override double MegavoltsPerMinuteInOneVoltPerSecond => 6e-05; + protected override double MegavoltsPerSecondInOneVoltPerSecond => 1e-06; + protected override double MicrovoltsPerHourInOneVoltPerSecond => 3.6e9; + protected override double MicrovoltsPerMicrosecondInOneVoltPerSecond => 1; + protected override double MicrovoltsPerMinuteInOneVoltPerSecond => 6e7; + protected override double MicrovoltsPerSecondInOneVoltPerSecond => 1e6; + protected override double MillivoltsPerHourInOneVoltPerSecond => 3.6e6; + protected override double MillivoltsPerMicrosecondInOneVoltPerSecond => 0.001; + protected override double MillivoltsPerMinuteInOneVoltPerSecond => 6e4; + protected override double MillivoltsPerSecondInOneVoltPerSecond => 1000; + protected override double VoltsPerHourInOneVoltPerSecond => 3600; + protected override double VoltsPerMicrosecondInOneVoltPerSecond => 1e-06; + protected override double VoltsPerMinuteInOneVoltPerSecond => 60; + protected override double VoltsPerSecondInOneVoltPerSecond => 1; } } diff --git a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs index 3a131ba154..31da379824 100644 --- a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs +++ b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs @@ -26,7 +26,7 @@ namespace UnitsNet.Tests.CustomCode public class FuelEfficiencyTests : FuelEfficiencyTestsBase { protected override bool SupportsSIUnitSystem => false; - protected override double KilometersPerLitersInOneLiterPer100Kilometers => 100; + protected override double KilometersPerLiterInOneLiterPer100Kilometers => 100; protected override double LitersPer100KilometersInOneLiterPer100Kilometers => 1; protected override double MilesPerUkGallonInOneLiterPer100Kilometers => 282.4809363; protected override double MilesPerUsGallonInOneLiterPer100Kilometers => 235.2145833; diff --git a/UnitsNet.Tests/CustomCode/SpeedTests.cs b/UnitsNet.Tests/CustomCode/SpeedTests.cs index 70c4a569b6..629c61358e 100644 --- a/UnitsNet.Tests/CustomCode/SpeedTests.cs +++ b/UnitsNet.Tests/CustomCode/SpeedTests.cs @@ -33,19 +33,19 @@ public class SpeedTests : SpeedTestsBase protected override double MetersPerHourInOneMeterPerSecond => 3.6E3; - protected override double NanometersPerMinutesInOneMeterPerSecond => 6E10; + protected override double NanometersPerMinuteInOneMeterPerSecond => 6E10; - protected override double MicrometersPerMinutesInOneMeterPerSecond => 6E7; + protected override double MicrometersPerMinuteInOneMeterPerSecond => 6E7; - protected override double MillimetersPerMinutesInOneMeterPerSecond => 6E4; + protected override double MillimetersPerMinuteInOneMeterPerSecond => 6E4; - protected override double CentimetersPerMinutesInOneMeterPerSecond => 6E3; + protected override double CentimetersPerMinuteInOneMeterPerSecond => 6E3; - protected override double DecimetersPerMinutesInOneMeterPerSecond => 6E2; + protected override double DecimetersPerMinuteInOneMeterPerSecond => 6E2; - protected override double MetersPerMinutesInOneMeterPerSecond => 6E1; + protected override double MetersPerMinuteInOneMeterPerSecond => 6E1; - protected override double KilometersPerMinutesInOneMeterPerSecond => 6E-2; + protected override double KilometersPerMinuteInOneMeterPerSecond => 6E-2; protected override double CentimetersPerHourInOneMeterPerSecond => 3.6E5; diff --git a/UnitsNet.Tests/CustomCode/TemperatureGradientTests.cs b/UnitsNet.Tests/CustomCode/TemperatureGradientTests.cs index 1a8c34c1ec..6917ede410 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureGradientTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureGradientTests.cs @@ -26,9 +26,9 @@ public class TemperatureGradientTests : TemperatureGradientTestsBase { protected override bool SupportsSIUnitSystem => true; - protected override double DegreesCelciusPerKilometerInOneKelvinPerMeter => 1000; + protected override double DegreesCelsiusPerKilometerInOneKelvinPerMeter => 1000; - protected override double DegreesCelciusPerMeterInOneKelvinPerMeter => 1; + protected override double DegreesCelsiusPerMeterInOneKelvinPerMeter => 1; protected override double DegreesFahrenheitPerFootInOneKelvinPerMeter => 0.54864; @@ -37,7 +37,7 @@ public class TemperatureGradientTests : TemperatureGradientTestsBase [Fact] public void TemperatureDeltaDividedByTemperatureGradientEqualsLength() { - Length length = TemperatureDelta.FromDegreesCelsius(50) / TemperatureGradient.FromDegreesCelciusPerKilometer(5); + Length length = TemperatureDelta.FromDegreesCelsius(50) / TemperatureGradient.FromDegreesCelsiusPerKilometer(5); Assert.Equal(length, Length.FromKilometers(10)); } @@ -45,20 +45,20 @@ public void TemperatureDeltaDividedByTemperatureGradientEqualsLength() public void TemperatureDeltaDividedByLengthEqualsTemperatureGradient() { TemperatureGradient temperatureGradient = TemperatureDelta.FromDegreesCelsius(50) / Length.FromKilometers(10); - Assert.Equal(5, temperatureGradient.DegreesCelciusPerKilometer); + Assert.Equal(5, temperatureGradient.DegreesCelsiusPerKilometer); } [Fact] public void LengthMultipliedByTemperatureGradientEqualsTemperatureDelta() { - TemperatureDelta temperatureDelta = Length.FromKilometers(10) * TemperatureGradient.FromDegreesCelciusPerKilometer(5); + TemperatureDelta temperatureDelta = Length.FromKilometers(10) * TemperatureGradient.FromDegreesCelsiusPerKilometer(5); Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); } [Fact] public void TemperatureGradientMultipliedByLengthEqualsTemperatureDelta() { - TemperatureDelta temperatureDelta = TemperatureGradient.FromDegreesCelciusPerKilometer(5) * Length.FromKilometers(10); + TemperatureDelta temperatureDelta = TemperatureGradient.FromDegreesCelsiusPerKilometer(5) * Length.FromKilometers(10); Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); } } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs index 55c8e33bce..5a3a67b1db 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs @@ -127,16 +127,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AbsorbedDoseOfIonizingRadiation(double.PositiveInfinity, AbsorbedDoseOfIonizingRadiationUnit.Gray)); - Assert.Throws(() => new AbsorbedDoseOfIonizingRadiation(double.NegativeInfinity, AbsorbedDoseOfIonizingRadiationUnit.Gray)); + var exception1 = Record.Exception(() => new AbsorbedDoseOfIonizingRadiation(double.PositiveInfinity, AbsorbedDoseOfIonizingRadiationUnit.Gray)); + var exception2 = Record.Exception(() => new AbsorbedDoseOfIonizingRadiation(double.NegativeInfinity, AbsorbedDoseOfIonizingRadiationUnit.Gray)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AbsorbedDoseOfIonizingRadiation(double.NaN, AbsorbedDoseOfIonizingRadiationUnit.Gray)); + var exception = Record.Exception(() => new AbsorbedDoseOfIonizingRadiation(double.NaN, AbsorbedDoseOfIonizingRadiationUnit.Gray)); + + Assert.Null(exception); } [Fact] @@ -266,16 +271,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromGrays_WithInfinityValue_ThrowsArgumentException() + public void FromGrays_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AbsorbedDoseOfIonizingRadiation.FromGrays(double.PositiveInfinity)); - Assert.Throws(() => AbsorbedDoseOfIonizingRadiation.FromGrays(double.NegativeInfinity)); + var exception1 = Record.Exception(() => AbsorbedDoseOfIonizingRadiation.FromGrays(double.PositiveInfinity)); + var exception2 = Record.Exception(() => AbsorbedDoseOfIonizingRadiation.FromGrays(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromGrays_WithNanValue_ThrowsArgumentException() + public void FromGrays_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AbsorbedDoseOfIonizingRadiation.FromGrays(double.NaN)); + var exception = Record.Exception(() => AbsorbedDoseOfIonizingRadiation.FromGrays(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs index 8016edae40..6d511f82df 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs @@ -119,16 +119,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Acceleration(double.PositiveInfinity, AccelerationUnit.MeterPerSecondSquared)); - Assert.Throws(() => new Acceleration(double.NegativeInfinity, AccelerationUnit.MeterPerSecondSquared)); + var exception1 = Record.Exception(() => new Acceleration(double.PositiveInfinity, AccelerationUnit.MeterPerSecondSquared)); + var exception2 = Record.Exception(() => new Acceleration(double.NegativeInfinity, AccelerationUnit.MeterPerSecondSquared)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Acceleration(double.NaN, AccelerationUnit.MeterPerSecondSquared)); + var exception = Record.Exception(() => new Acceleration(double.NaN, AccelerationUnit.MeterPerSecondSquared)); + + Assert.Null(exception); } [Fact] @@ -248,16 +253,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMetersPerSecondSquared_WithInfinityValue_ThrowsArgumentException() + public void FromMetersPerSecondSquared_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.PositiveInfinity)); - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Acceleration.FromMetersPerSecondSquared(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Acceleration.FromMetersPerSecondSquared(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMetersPerSecondSquared_WithNanValue_ThrowsArgumentException() + public void FromMetersPerSecondSquared_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NaN)); + var exception = Record.Exception(() => Acceleration.FromMetersPerSecondSquared(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs index b32b6bcc56..b6ad678739 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs @@ -131,16 +131,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AmountOfSubstance(double.PositiveInfinity, AmountOfSubstanceUnit.Mole)); - Assert.Throws(() => new AmountOfSubstance(double.NegativeInfinity, AmountOfSubstanceUnit.Mole)); + var exception1 = Record.Exception(() => new AmountOfSubstance(double.PositiveInfinity, AmountOfSubstanceUnit.Mole)); + var exception2 = Record.Exception(() => new AmountOfSubstance(double.NegativeInfinity, AmountOfSubstanceUnit.Mole)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AmountOfSubstance(double.NaN, AmountOfSubstanceUnit.Mole)); + var exception = Record.Exception(() => new AmountOfSubstance(double.NaN, AmountOfSubstanceUnit.Mole)); + + Assert.Null(exception); } [Fact] @@ -275,16 +280,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMoles_WithInfinityValue_ThrowsArgumentException() + public void FromMoles_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AmountOfSubstance.FromMoles(double.PositiveInfinity)); - Assert.Throws(() => AmountOfSubstance.FromMoles(double.NegativeInfinity)); + var exception1 = Record.Exception(() => AmountOfSubstance.FromMoles(double.PositiveInfinity)); + var exception2 = Record.Exception(() => AmountOfSubstance.FromMoles(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMoles_WithNanValue_ThrowsArgumentException() + public void FromMoles_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AmountOfSubstance.FromMoles(double.NaN)); + var exception = Record.Exception(() => AmountOfSubstance.FromMoles(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs index 8c8d952df2..8d526e5e33 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AmplitudeRatio(double.PositiveInfinity, AmplitudeRatioUnit.DecibelVolt)); - Assert.Throws(() => new AmplitudeRatio(double.NegativeInfinity, AmplitudeRatioUnit.DecibelVolt)); + var exception1 = Record.Exception(() => new AmplitudeRatio(double.PositiveInfinity, AmplitudeRatioUnit.DecibelVolt)); + var exception2 = Record.Exception(() => new AmplitudeRatio(double.NegativeInfinity, AmplitudeRatioUnit.DecibelVolt)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AmplitudeRatio(double.NaN, AmplitudeRatioUnit.DecibelVolt)); + var exception = Record.Exception(() => new AmplitudeRatio(double.NaN, AmplitudeRatioUnit.DecibelVolt)); + + Assert.Null(exception); } [Fact] @@ -158,16 +163,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDecibelVolts_WithInfinityValue_ThrowsArgumentException() + public void FromDecibelVolts_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.PositiveInfinity)); - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NegativeInfinity)); + var exception1 = Record.Exception(() => AmplitudeRatio.FromDecibelVolts(double.PositiveInfinity)); + var exception2 = Record.Exception(() => AmplitudeRatio.FromDecibelVolts(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDecibelVolts_WithNanValue_ThrowsArgumentException() + public void FromDecibelVolts_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NaN)); + var exception = Record.Exception(() => AmplitudeRatio.FromDecibelVolts(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs index 41ad0ce776..53570ce564 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs @@ -127,16 +127,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Angle(double.PositiveInfinity, AngleUnit.Degree)); - Assert.Throws(() => new Angle(double.NegativeInfinity, AngleUnit.Degree)); + var exception1 = Record.Exception(() => new Angle(double.PositiveInfinity, AngleUnit.Degree)); + var exception2 = Record.Exception(() => new Angle(double.NegativeInfinity, AngleUnit.Degree)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Angle(double.NaN, AngleUnit.Degree)); + var exception = Record.Exception(() => new Angle(double.NaN, AngleUnit.Degree)); + + Assert.Null(exception); } [Fact] @@ -266,16 +271,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDegrees_WithInfinityValue_ThrowsArgumentException() + public void FromDegrees_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Angle.FromDegrees(double.PositiveInfinity)); - Assert.Throws(() => Angle.FromDegrees(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Angle.FromDegrees(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Angle.FromDegrees(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDegrees_WithNanValue_ThrowsArgumentException() + public void FromDegrees_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Angle.FromDegrees(double.NaN)); + var exception = Record.Exception(() => Angle.FromDegrees(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs index 517fd696e6..4a7469909b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ApparentEnergy(double.PositiveInfinity, ApparentEnergyUnit.VoltampereHour)); - Assert.Throws(() => new ApparentEnergy(double.NegativeInfinity, ApparentEnergyUnit.VoltampereHour)); + var exception1 = Record.Exception(() => new ApparentEnergy(double.PositiveInfinity, ApparentEnergyUnit.VoltampereHour)); + var exception2 = Record.Exception(() => new ApparentEnergy(double.NegativeInfinity, ApparentEnergyUnit.VoltampereHour)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ApparentEnergy(double.NaN, ApparentEnergyUnit.VoltampereHour)); + var exception = Record.Exception(() => new ApparentEnergy(double.NaN, ApparentEnergyUnit.VoltampereHour)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVoltampereHours_WithInfinityValue_ThrowsArgumentException() + public void FromVoltampereHours_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.PositiveInfinity)); - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ApparentEnergy.FromVoltampereHours(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ApparentEnergy.FromVoltampereHours(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltampereHours_WithNanValue_ThrowsArgumentException() + public void FromVoltampereHours_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NaN)); + var exception = Record.Exception(() => ApparentEnergy.FromVoltampereHours(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs index c837d97039..bf80b99a6c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ApparentPower(double.PositiveInfinity, ApparentPowerUnit.Voltampere)); - Assert.Throws(() => new ApparentPower(double.NegativeInfinity, ApparentPowerUnit.Voltampere)); + var exception1 = Record.Exception(() => new ApparentPower(double.PositiveInfinity, ApparentPowerUnit.Voltampere)); + var exception2 = Record.Exception(() => new ApparentPower(double.NegativeInfinity, ApparentPowerUnit.Voltampere)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ApparentPower(double.NaN, ApparentPowerUnit.Voltampere)); + var exception = Record.Exception(() => new ApparentPower(double.NaN, ApparentPowerUnit.Voltampere)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVoltamperes_WithInfinityValue_ThrowsArgumentException() + public void FromVoltamperes_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ApparentPower.FromVoltamperes(double.PositiveInfinity)); - Assert.Throws(() => ApparentPower.FromVoltamperes(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ApparentPower.FromVoltamperes(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ApparentPower.FromVoltamperes(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltamperes_WithNanValue_ThrowsArgumentException() + public void FromVoltamperes_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ApparentPower.FromVoltamperes(double.NaN)); + var exception = Record.Exception(() => ApparentPower.FromVoltamperes(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs index 7a52efb886..3a7fcb6528 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AreaDensity(double.PositiveInfinity, AreaDensityUnit.KilogramPerSquareMeter)); - Assert.Throws(() => new AreaDensity(double.NegativeInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + var exception1 = Record.Exception(() => new AreaDensity(double.PositiveInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + var exception2 = Record.Exception(() => new AreaDensity(double.NegativeInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AreaDensity(double.NaN, AreaDensityUnit.KilogramPerSquareMeter)); + var exception = Record.Exception(() => new AreaDensity(double.NaN, AreaDensityUnit.KilogramPerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramsPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => AreaDensity.FromKilogramsPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => AreaDensity.FromKilogramsPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramsPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromKilogramsPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => AreaDensity.FromKilogramsPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs index baad089fb2..d0e98f1051 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AreaMomentOfInertia(double.PositiveInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); - Assert.Throws(() => new AreaMomentOfInertia(double.NegativeInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + var exception1 = Record.Exception(() => new AreaMomentOfInertia(double.PositiveInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + var exception2 = Record.Exception(() => new AreaMomentOfInertia(double.NegativeInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new AreaMomentOfInertia(double.NaN, AreaMomentOfInertiaUnit.MeterToTheFourth)); + var exception = Record.Exception(() => new AreaMomentOfInertia(double.NaN, AreaMomentOfInertiaUnit.MeterToTheFourth)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMetersToTheFourth_WithInfinityValue_ThrowsArgumentException() + public void FromMetersToTheFourth_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity)); - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity)); + var exception1 = Record.Exception(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity)); + var exception2 = Record.Exception(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMetersToTheFourth_WithNanValue_ThrowsArgumentException() + public void FromMetersToTheFourth_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN)); + var exception = Record.Exception(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs index a03b6f082f..5c47527b56 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs @@ -119,16 +119,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Area(double.PositiveInfinity, AreaUnit.SquareMeter)); - Assert.Throws(() => new Area(double.NegativeInfinity, AreaUnit.SquareMeter)); + var exception1 = Record.Exception(() => new Area(double.PositiveInfinity, AreaUnit.SquareMeter)); + var exception2 = Record.Exception(() => new Area(double.NegativeInfinity, AreaUnit.SquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Area(double.NaN, AreaUnit.SquareMeter)); + var exception = Record.Exception(() => new Area(double.NaN, AreaUnit.SquareMeter)); + + Assert.Null(exception); } [Fact] @@ -248,16 +253,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSquareMeters_WithInfinityValue_ThrowsArgumentException() + public void FromSquareMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Area.FromSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => Area.FromSquareMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Area.FromSquareMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Area.FromSquareMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSquareMeters_WithNanValue_ThrowsArgumentException() + public void FromSquareMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Area.FromSquareMeters(double.NaN)); + var exception = Record.Exception(() => Area.FromSquareMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs index 48160ebe70..43cf8ecc6f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.PositiveInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NegativeInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + var exception1 = Record.Exception(() => new BrakeSpecificFuelConsumption(double.PositiveInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + var exception2 = Record.Exception(() => new BrakeSpecificFuelConsumption(double.NegativeInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NaN, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + var exception = Record.Exception(() => new BrakeSpecificFuelConsumption(double.NaN, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramsPerJoule_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramsPerJoule_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); + var exception1 = Record.Exception(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); + var exception2 = Record.Exception(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramsPerJoule_WithNanValue_ThrowsArgumentException() + public void FromKilogramsPerJoule_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); + var exception = Record.Exception(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs index f4c69001a6..a29bdaa0fc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs @@ -91,16 +91,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Capacitance(double.PositiveInfinity, CapacitanceUnit.Farad)); - Assert.Throws(() => new Capacitance(double.NegativeInfinity, CapacitanceUnit.Farad)); + var exception1 = Record.Exception(() => new Capacitance(double.PositiveInfinity, CapacitanceUnit.Farad)); + var exception2 = Record.Exception(() => new Capacitance(double.NegativeInfinity, CapacitanceUnit.Farad)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Capacitance(double.NaN, CapacitanceUnit.Farad)); + var exception = Record.Exception(() => new Capacitance(double.NaN, CapacitanceUnit.Farad)); + + Assert.Null(exception); } [Fact] @@ -185,16 +190,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromFarads_WithInfinityValue_ThrowsArgumentException() + public void FromFarads_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Capacitance.FromFarads(double.PositiveInfinity)); - Assert.Throws(() => Capacitance.FromFarads(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Capacitance.FromFarads(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Capacitance.FromFarads(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromFarads_WithNanValue_ThrowsArgumentException() + public void FromFarads_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Capacitance.FromFarads(double.NaN)); + var exception = Record.Exception(() => Capacitance.FromFarads(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs index eb9c8774ac..9f12014fbd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new CoefficientOfThermalExpansion(double.PositiveInfinity, CoefficientOfThermalExpansionUnit.PerKelvin)); - Assert.Throws(() => new CoefficientOfThermalExpansion(double.NegativeInfinity, CoefficientOfThermalExpansionUnit.PerKelvin)); + var exception1 = Record.Exception(() => new CoefficientOfThermalExpansion(double.PositiveInfinity, CoefficientOfThermalExpansionUnit.PerKelvin)); + var exception2 = Record.Exception(() => new CoefficientOfThermalExpansion(double.NegativeInfinity, CoefficientOfThermalExpansionUnit.PerKelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new CoefficientOfThermalExpansion(double.NaN, CoefficientOfThermalExpansionUnit.PerKelvin)); + var exception = Record.Exception(() => new CoefficientOfThermalExpansion(double.NaN, CoefficientOfThermalExpansionUnit.PerKelvin)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromPerKelvin_WithInfinityValue_ThrowsArgumentException() + public void FromPerKelvin_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => CoefficientOfThermalExpansion.FromPerKelvin(double.PositiveInfinity)); - Assert.Throws(() => CoefficientOfThermalExpansion.FromPerKelvin(double.NegativeInfinity)); + var exception1 = Record.Exception(() => CoefficientOfThermalExpansion.FromPerKelvin(double.PositiveInfinity)); + var exception2 = Record.Exception(() => CoefficientOfThermalExpansion.FromPerKelvin(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromPerKelvin_WithNanValue_ThrowsArgumentException() + public void FromPerKelvin_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => CoefficientOfThermalExpansion.FromPerKelvin(double.NaN)); + var exception = Record.Exception(() => CoefficientOfThermalExpansion.FromPerKelvin(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs index cd16c66174..aad597d478 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs @@ -91,16 +91,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Compressibility(double.PositiveInfinity, CompressibilityUnit.InversePascal)); - Assert.Throws(() => new Compressibility(double.NegativeInfinity, CompressibilityUnit.InversePascal)); + var exception1 = Record.Exception(() => new Compressibility(double.PositiveInfinity, CompressibilityUnit.InversePascal)); + var exception2 = Record.Exception(() => new Compressibility(double.NegativeInfinity, CompressibilityUnit.InversePascal)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Compressibility(double.NaN, CompressibilityUnit.InversePascal)); + var exception = Record.Exception(() => new Compressibility(double.NaN, CompressibilityUnit.InversePascal)); + + Assert.Null(exception); } [Fact] @@ -185,16 +190,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromInversePascals_WithInfinityValue_ThrowsArgumentException() + public void FromInversePascals_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Compressibility.FromInversePascals(double.PositiveInfinity)); - Assert.Throws(() => Compressibility.FromInversePascals(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Compressibility.FromInversePascals(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Compressibility.FromInversePascals(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromInversePascals_WithNanValue_ThrowsArgumentException() + public void FromInversePascals_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Compressibility.FromInversePascals(double.NaN)); + var exception = Record.Exception(() => Compressibility.FromInversePascals(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index 9d12072063..e7e3a06fa4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -38,13 +38,13 @@ namespace UnitsNet.Tests // ReSharper disable once PartialTypeWithSinglePart public abstract partial class DensityTestsBase : QuantityTestsBase { - protected abstract double CentigramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double CentigramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double CentigramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double CentigramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double DecigramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double DecigramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double DecigramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double DecigramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double FemtogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double FemtogramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double FemtogramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double FemtogramsPerMilliliterInOneKilogramPerCubicMeter { get; } protected abstract double GramsPerCubicCentimeterInOneKilogramPerCubicMeter { get; } @@ -52,7 +52,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected abstract double GramsPerCubicInchInOneKilogramPerCubicMeter { get; } protected abstract double GramsPerCubicMeterInOneKilogramPerCubicMeter { get; } protected abstract double GramsPerCubicMillimeterInOneKilogramPerCubicMeter { get; } - protected abstract double GramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double GramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double GramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double GramsPerMilliliterInOneKilogramPerCubicMeter { get; } protected abstract double KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter { get; } @@ -63,17 +63,17 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected abstract double KilopoundsPerCubicInchInOneKilogramPerCubicMeter { get; } protected abstract double KilopoundsPerCubicYardInOneKilogramPerCubicMeter { get; } protected abstract double MicrogramsPerCubicMeterInOneKilogramPerCubicMeter { get; } - protected abstract double MicrogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double MicrogramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double MicrogramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double MicrogramsPerMilliliterInOneKilogramPerCubicMeter { get; } protected abstract double MilligramsPerCubicMeterInOneKilogramPerCubicMeter { get; } - protected abstract double MilligramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double MilligramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double MilligramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double MilligramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double NanogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double NanogramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double NanogramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double NanogramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double PicogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } + protected abstract double PicogramsPerDeciliterInOneKilogramPerCubicMeter { get; } protected abstract double PicogramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double PicogramsPerMilliliterInOneKilogramPerCubicMeter { get; } protected abstract double PoundsPerCubicCentimeterInOneKilogramPerCubicMeter { get; } @@ -96,13 +96,13 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected abstract double TonnesPerCubicMillimeterInOneKilogramPerCubicMeter { get; } // ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentigramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double CentigramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double CentigramsPerLiterTolerance { get { return 1e-5; } } protected virtual double CentigramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double DecigramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double DecigramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double DecigramsPerLiterTolerance { get { return 1e-5; } } protected virtual double DecigramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double FemtogramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double FemtogramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double FemtogramsPerLiterTolerance { get { return 1e-5; } } protected virtual double FemtogramsPerMilliliterTolerance { get { return 1e-5; } } protected virtual double GramsPerCubicCentimeterTolerance { get { return 1e-5; } } @@ -110,7 +110,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected virtual double GramsPerCubicInchTolerance { get { return 1e-5; } } protected virtual double GramsPerCubicMeterTolerance { get { return 1e-5; } } protected virtual double GramsPerCubicMillimeterTolerance { get { return 1e-5; } } - protected virtual double GramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double GramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double GramsPerLiterTolerance { get { return 1e-5; } } protected virtual double GramsPerMilliliterTolerance { get { return 1e-5; } } protected virtual double KilogramsPerCubicCentimeterTolerance { get { return 1e-5; } } @@ -121,17 +121,17 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected virtual double KilopoundsPerCubicInchTolerance { get { return 1e-5; } } protected virtual double KilopoundsPerCubicYardTolerance { get { return 1e-5; } } protected virtual double MicrogramsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double MicrogramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double MicrogramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double MicrogramsPerLiterTolerance { get { return 1e-5; } } protected virtual double MicrogramsPerMilliliterTolerance { get { return 1e-5; } } protected virtual double MilligramsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double MilligramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double MilligramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double MilligramsPerLiterTolerance { get { return 1e-5; } } protected virtual double MilligramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double NanogramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double NanogramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double NanogramsPerLiterTolerance { get { return 1e-5; } } protected virtual double NanogramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double PicogramsPerDeciLiterTolerance { get { return 1e-5; } } + protected virtual double PicogramsPerDeciliterTolerance { get { return 1e-5; } } protected virtual double PicogramsPerLiterTolerance { get { return 1e-5; } } protected virtual double PicogramsPerMilliliterTolerance { get { return 1e-5; } } protected virtual double PoundsPerCubicCentimeterTolerance { get { return 1e-5; } } @@ -158,13 +158,13 @@ public abstract partial class DensityTestsBase : QuantityTestsBase { return unit switch { - DensityUnit.CentigramPerDeciliter => (CentigramsPerDeciLiterInOneKilogramPerCubicMeter, CentigramsPerDeciLiterTolerance), + DensityUnit.CentigramPerDeciliter => (CentigramsPerDeciliterInOneKilogramPerCubicMeter, CentigramsPerDeciliterTolerance), DensityUnit.CentigramPerLiter => (CentigramsPerLiterInOneKilogramPerCubicMeter, CentigramsPerLiterTolerance), DensityUnit.CentigramPerMilliliter => (CentigramsPerMilliliterInOneKilogramPerCubicMeter, CentigramsPerMilliliterTolerance), - DensityUnit.DecigramPerDeciliter => (DecigramsPerDeciLiterInOneKilogramPerCubicMeter, DecigramsPerDeciLiterTolerance), + DensityUnit.DecigramPerDeciliter => (DecigramsPerDeciliterInOneKilogramPerCubicMeter, DecigramsPerDeciliterTolerance), DensityUnit.DecigramPerLiter => (DecigramsPerLiterInOneKilogramPerCubicMeter, DecigramsPerLiterTolerance), DensityUnit.DecigramPerMilliliter => (DecigramsPerMilliliterInOneKilogramPerCubicMeter, DecigramsPerMilliliterTolerance), - DensityUnit.FemtogramPerDeciliter => (FemtogramsPerDeciLiterInOneKilogramPerCubicMeter, FemtogramsPerDeciLiterTolerance), + DensityUnit.FemtogramPerDeciliter => (FemtogramsPerDeciliterInOneKilogramPerCubicMeter, FemtogramsPerDeciliterTolerance), DensityUnit.FemtogramPerLiter => (FemtogramsPerLiterInOneKilogramPerCubicMeter, FemtogramsPerLiterTolerance), DensityUnit.FemtogramPerMilliliter => (FemtogramsPerMilliliterInOneKilogramPerCubicMeter, FemtogramsPerMilliliterTolerance), DensityUnit.GramPerCubicCentimeter => (GramsPerCubicCentimeterInOneKilogramPerCubicMeter, GramsPerCubicCentimeterTolerance), @@ -172,7 +172,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase DensityUnit.GramPerCubicInch => (GramsPerCubicInchInOneKilogramPerCubicMeter, GramsPerCubicInchTolerance), DensityUnit.GramPerCubicMeter => (GramsPerCubicMeterInOneKilogramPerCubicMeter, GramsPerCubicMeterTolerance), DensityUnit.GramPerCubicMillimeter => (GramsPerCubicMillimeterInOneKilogramPerCubicMeter, GramsPerCubicMillimeterTolerance), - DensityUnit.GramPerDeciliter => (GramsPerDeciLiterInOneKilogramPerCubicMeter, GramsPerDeciLiterTolerance), + DensityUnit.GramPerDeciliter => (GramsPerDeciliterInOneKilogramPerCubicMeter, GramsPerDeciliterTolerance), DensityUnit.GramPerLiter => (GramsPerLiterInOneKilogramPerCubicMeter, GramsPerLiterTolerance), DensityUnit.GramPerMilliliter => (GramsPerMilliliterInOneKilogramPerCubicMeter, GramsPerMilliliterTolerance), DensityUnit.KilogramPerCubicCentimeter => (KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter, KilogramsPerCubicCentimeterTolerance), @@ -183,17 +183,17 @@ public abstract partial class DensityTestsBase : QuantityTestsBase DensityUnit.KilopoundPerCubicInch => (KilopoundsPerCubicInchInOneKilogramPerCubicMeter, KilopoundsPerCubicInchTolerance), DensityUnit.KilopoundPerCubicYard => (KilopoundsPerCubicYardInOneKilogramPerCubicMeter, KilopoundsPerCubicYardTolerance), DensityUnit.MicrogramPerCubicMeter => (MicrogramsPerCubicMeterInOneKilogramPerCubicMeter, MicrogramsPerCubicMeterTolerance), - DensityUnit.MicrogramPerDeciliter => (MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, MicrogramsPerDeciLiterTolerance), + DensityUnit.MicrogramPerDeciliter => (MicrogramsPerDeciliterInOneKilogramPerCubicMeter, MicrogramsPerDeciliterTolerance), DensityUnit.MicrogramPerLiter => (MicrogramsPerLiterInOneKilogramPerCubicMeter, MicrogramsPerLiterTolerance), DensityUnit.MicrogramPerMilliliter => (MicrogramsPerMilliliterInOneKilogramPerCubicMeter, MicrogramsPerMilliliterTolerance), DensityUnit.MilligramPerCubicMeter => (MilligramsPerCubicMeterInOneKilogramPerCubicMeter, MilligramsPerCubicMeterTolerance), - DensityUnit.MilligramPerDeciliter => (MilligramsPerDeciLiterInOneKilogramPerCubicMeter, MilligramsPerDeciLiterTolerance), + DensityUnit.MilligramPerDeciliter => (MilligramsPerDeciliterInOneKilogramPerCubicMeter, MilligramsPerDeciliterTolerance), DensityUnit.MilligramPerLiter => (MilligramsPerLiterInOneKilogramPerCubicMeter, MilligramsPerLiterTolerance), DensityUnit.MilligramPerMilliliter => (MilligramsPerMilliliterInOneKilogramPerCubicMeter, MilligramsPerMilliliterTolerance), - DensityUnit.NanogramPerDeciliter => (NanogramsPerDeciLiterInOneKilogramPerCubicMeter, NanogramsPerDeciLiterTolerance), + DensityUnit.NanogramPerDeciliter => (NanogramsPerDeciliterInOneKilogramPerCubicMeter, NanogramsPerDeciliterTolerance), DensityUnit.NanogramPerLiter => (NanogramsPerLiterInOneKilogramPerCubicMeter, NanogramsPerLiterTolerance), DensityUnit.NanogramPerMilliliter => (NanogramsPerMilliliterInOneKilogramPerCubicMeter, NanogramsPerMilliliterTolerance), - DensityUnit.PicogramPerDeciliter => (PicogramsPerDeciLiterInOneKilogramPerCubicMeter, PicogramsPerDeciLiterTolerance), + DensityUnit.PicogramPerDeciliter => (PicogramsPerDeciliterInOneKilogramPerCubicMeter, PicogramsPerDeciliterTolerance), DensityUnit.PicogramPerLiter => (PicogramsPerLiterInOneKilogramPerCubicMeter, PicogramsPerLiterTolerance), DensityUnit.PicogramPerMilliliter => (PicogramsPerMilliliterInOneKilogramPerCubicMeter, PicogramsPerMilliliterTolerance), DensityUnit.PoundPerCubicCentimeter => (PoundsPerCubicCentimeterInOneKilogramPerCubicMeter, PoundsPerCubicCentimeterTolerance), @@ -287,16 +287,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Density(double.PositiveInfinity, DensityUnit.KilogramPerCubicMeter)); - Assert.Throws(() => new Density(double.NegativeInfinity, DensityUnit.KilogramPerCubicMeter)); + var exception1 = Record.Exception(() => new Density(double.PositiveInfinity, DensityUnit.KilogramPerCubicMeter)); + var exception2 = Record.Exception(() => new Density(double.NegativeInfinity, DensityUnit.KilogramPerCubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Density(double.NaN, DensityUnit.KilogramPerCubicMeter)); + var exception = Record.Exception(() => new Density(double.NaN, DensityUnit.KilogramPerCubicMeter)); + + Assert.Null(exception); } [Fact] @@ -338,13 +343,13 @@ public void Density_QuantityInfo_ReturnsQuantityInfoDescribingQuantity() public void KilogramPerCubicMeterToDensityUnits() { Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(CentigramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerDeciliter, CentigramsPerDeciliterTolerance); AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerLiter, CentigramsPerLiterTolerance); AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(DecigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(DecigramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.DecigramsPerDeciliter, DecigramsPerDeciliterTolerance); AssertEx.EqualTolerance(DecigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.DecigramsPerLiter, DecigramsPerLiterTolerance); AssertEx.EqualTolerance(DecigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(FemtogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.FemtogramsPerDeciLiter, FemtogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(FemtogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.FemtogramsPerDeciliter, FemtogramsPerDeciliterTolerance); AssertEx.EqualTolerance(FemtogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.FemtogramsPerLiter, FemtogramsPerLiterTolerance); AssertEx.EqualTolerance(FemtogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.FemtogramsPerMilliliter, FemtogramsPerMilliliterTolerance); AssertEx.EqualTolerance(GramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerCubicCentimeter, GramsPerCubicCentimeterTolerance); @@ -352,7 +357,7 @@ public void KilogramPerCubicMeterToDensityUnits() AssertEx.EqualTolerance(GramsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerCubicInch, GramsPerCubicInchTolerance); AssertEx.EqualTolerance(GramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerCubicMeter, GramsPerCubicMeterTolerance); AssertEx.EqualTolerance(GramsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerCubicMillimeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(GramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(GramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerDeciliter, GramsPerDeciliterTolerance); AssertEx.EqualTolerance(GramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerLiter, GramsPerLiterTolerance); AssertEx.EqualTolerance(GramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerMilliliter, GramsPerMilliliterTolerance); AssertEx.EqualTolerance(KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilogramsPerCubicCentimeter, KilogramsPerCubicCentimeterTolerance); @@ -363,17 +368,17 @@ public void KilogramPerCubicMeterToDensityUnits() AssertEx.EqualTolerance(KilopoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); AssertEx.EqualTolerance(KilopoundsPerCubicYardInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilopoundsPerCubicYard, KilopoundsPerCubicYardTolerance); AssertEx.EqualTolerance(MicrogramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(MicrogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerDeciliter, MicrogramsPerDeciliterTolerance); AssertEx.EqualTolerance(MicrogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerLiter, MicrogramsPerLiterTolerance); AssertEx.EqualTolerance(MicrogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); AssertEx.EqualTolerance(MilligramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MilligramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(MilligramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerDeciliter, MilligramsPerDeciliterTolerance); AssertEx.EqualTolerance(MilligramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerLiter, MilligramsPerLiterTolerance); AssertEx.EqualTolerance(MilligramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(NanogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(NanogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.NanogramsPerDeciliter, NanogramsPerDeciliterTolerance); AssertEx.EqualTolerance(NanogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.NanogramsPerLiter, NanogramsPerLiterTolerance); AssertEx.EqualTolerance(NanogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(PicogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(PicogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PicogramsPerDeciliter, PicogramsPerDeciliterTolerance); AssertEx.EqualTolerance(PicogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PicogramsPerLiter, PicogramsPerLiterTolerance); AssertEx.EqualTolerance(PicogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); AssertEx.EqualTolerance(PoundsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerCubicCentimeter, PoundsPerCubicCentimeterTolerance); @@ -400,7 +405,7 @@ public void KilogramPerCubicMeterToDensityUnits() public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() { var quantity00 = Density.From(1, DensityUnit.CentigramPerDeciliter); - AssertEx.EqualTolerance(1, quantity00.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity00.CentigramsPerDeciliter, CentigramsPerDeciliterTolerance); Assert.Equal(DensityUnit.CentigramPerDeciliter, quantity00.Unit); var quantity01 = Density.From(1, DensityUnit.CentigramPerLiter); @@ -412,7 +417,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(DensityUnit.CentigramPerMilliliter, quantity02.Unit); var quantity03 = Density.From(1, DensityUnit.DecigramPerDeciliter); - AssertEx.EqualTolerance(1, quantity03.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity03.DecigramsPerDeciliter, DecigramsPerDeciliterTolerance); Assert.Equal(DensityUnit.DecigramPerDeciliter, quantity03.Unit); var quantity04 = Density.From(1, DensityUnit.DecigramPerLiter); @@ -424,7 +429,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(DensityUnit.DecigramPerMilliliter, quantity05.Unit); var quantity06 = Density.From(1, DensityUnit.FemtogramPerDeciliter); - AssertEx.EqualTolerance(1, quantity06.FemtogramsPerDeciLiter, FemtogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity06.FemtogramsPerDeciliter, FemtogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.FemtogramPerDeciliter, quantity06.Unit); var quantity07 = Density.From(1, DensityUnit.FemtogramPerLiter); @@ -456,7 +461,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(DensityUnit.GramPerCubicMillimeter, quantity13.Unit); var quantity14 = Density.From(1, DensityUnit.GramPerDeciliter); - AssertEx.EqualTolerance(1, quantity14.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity14.GramsPerDeciliter, GramsPerDeciliterTolerance); Assert.Equal(DensityUnit.GramPerDeciliter, quantity14.Unit); var quantity15 = Density.From(1, DensityUnit.GramPerLiter); @@ -500,7 +505,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(DensityUnit.MicrogramPerCubicMeter, quantity24.Unit); var quantity25 = Density.From(1, DensityUnit.MicrogramPerDeciliter); - AssertEx.EqualTolerance(1, quantity25.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity25.MicrogramsPerDeciliter, MicrogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.MicrogramPerDeciliter, quantity25.Unit); var quantity26 = Density.From(1, DensityUnit.MicrogramPerLiter); @@ -516,7 +521,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(DensityUnit.MilligramPerCubicMeter, quantity28.Unit); var quantity29 = Density.From(1, DensityUnit.MilligramPerDeciliter); - AssertEx.EqualTolerance(1, quantity29.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity29.MilligramsPerDeciliter, MilligramsPerDeciliterTolerance); Assert.Equal(DensityUnit.MilligramPerDeciliter, quantity29.Unit); var quantity30 = Density.From(1, DensityUnit.MilligramPerLiter); @@ -528,7 +533,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(DensityUnit.MilligramPerMilliliter, quantity31.Unit); var quantity32 = Density.From(1, DensityUnit.NanogramPerDeciliter); - AssertEx.EqualTolerance(1, quantity32.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity32.NanogramsPerDeciliter, NanogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.NanogramPerDeciliter, quantity32.Unit); var quantity33 = Density.From(1, DensityUnit.NanogramPerLiter); @@ -540,7 +545,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(DensityUnit.NanogramPerMilliliter, quantity34.Unit); var quantity35 = Density.From(1, DensityUnit.PicogramPerDeciliter); - AssertEx.EqualTolerance(1, quantity35.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, quantity35.PicogramsPerDeciliter, PicogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.PicogramPerDeciliter, quantity35.Unit); var quantity36 = Density.From(1, DensityUnit.PicogramPerLiter); @@ -626,29 +631,34 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramsPerCubicMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Density.FromKilogramsPerCubicMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Density.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramsPerCubicMeter_WithNanValue_ThrowsArgumentException() + public void FromKilogramsPerCubicMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NaN)); + var exception = Record.Exception(() => Density.FromKilogramsPerCubicMeter(double.NaN)); + + Assert.Null(exception); } [Fact] public void As() { var kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerDeciliter), CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(CentigramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerDeciliter), CentigramsPerDeciliterTolerance); AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerLiter), CentigramsPerLiterTolerance); AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerMilliliter), CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(DecigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.DecigramPerDeciliter), DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(DecigramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.DecigramPerDeciliter), DecigramsPerDeciliterTolerance); AssertEx.EqualTolerance(DecigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.DecigramPerLiter), DecigramsPerLiterTolerance); AssertEx.EqualTolerance(DecigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.DecigramPerMilliliter), DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(FemtogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.FemtogramPerDeciliter), FemtogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(FemtogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.FemtogramPerDeciliter), FemtogramsPerDeciliterTolerance); AssertEx.EqualTolerance(FemtogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.FemtogramPerLiter), FemtogramsPerLiterTolerance); AssertEx.EqualTolerance(FemtogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.FemtogramPerMilliliter), FemtogramsPerMilliliterTolerance); AssertEx.EqualTolerance(GramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerCubicCentimeter), GramsPerCubicCentimeterTolerance); @@ -656,7 +666,7 @@ public void As() AssertEx.EqualTolerance(GramsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerCubicInch), GramsPerCubicInchTolerance); AssertEx.EqualTolerance(GramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerCubicMeter), GramsPerCubicMeterTolerance); AssertEx.EqualTolerance(GramsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerCubicMillimeter), GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(GramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerDeciliter), GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(GramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerDeciliter), GramsPerDeciliterTolerance); AssertEx.EqualTolerance(GramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerLiter), GramsPerLiterTolerance); AssertEx.EqualTolerance(GramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerMilliliter), GramsPerMilliliterTolerance); AssertEx.EqualTolerance(KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilogramPerCubicCentimeter), KilogramsPerCubicCentimeterTolerance); @@ -667,17 +677,17 @@ public void As() AssertEx.EqualTolerance(KilopoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilopoundPerCubicInch), KilopoundsPerCubicInchTolerance); AssertEx.EqualTolerance(KilopoundsPerCubicYardInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilopoundPerCubicYard), KilopoundsPerCubicYardTolerance); AssertEx.EqualTolerance(MicrogramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerCubicMeter), MicrogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerDeciliter), MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(MicrogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerDeciliter), MicrogramsPerDeciliterTolerance); AssertEx.EqualTolerance(MicrogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerLiter), MicrogramsPerLiterTolerance); AssertEx.EqualTolerance(MicrogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerMilliliter), MicrogramsPerMilliliterTolerance); AssertEx.EqualTolerance(MilligramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerCubicMeter), MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MilligramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerDeciliter), MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(MilligramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerDeciliter), MilligramsPerDeciliterTolerance); AssertEx.EqualTolerance(MilligramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerLiter), MilligramsPerLiterTolerance); AssertEx.EqualTolerance(MilligramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerMilliliter), MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(NanogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.NanogramPerDeciliter), NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(NanogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.NanogramPerDeciliter), NanogramsPerDeciliterTolerance); AssertEx.EqualTolerance(NanogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.NanogramPerLiter), NanogramsPerLiterTolerance); AssertEx.EqualTolerance(NanogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.NanogramPerMilliliter), NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(PicogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PicogramPerDeciliter), PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(PicogramsPerDeciliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PicogramPerDeciliter), PicogramsPerDeciliterTolerance); AssertEx.EqualTolerance(PicogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PicogramPerLiter), PicogramsPerLiterTolerance); AssertEx.EqualTolerance(PicogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PicogramPerMilliliter), PicogramsPerMilliliterTolerance); AssertEx.EqualTolerance(PoundsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerCubicCentimeter), PoundsPerCubicCentimeterTolerance); @@ -723,7 +733,7 @@ public void Parse() try { var parsed = Density.Parse("1 cg/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciliter, CentigramsPerDeciliterTolerance); Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -744,7 +754,7 @@ public void Parse() try { var parsed = Density.Parse("1 dg/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciliter, DecigramsPerDeciliterTolerance); Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -765,7 +775,7 @@ public void Parse() try { var parsed = Density.Parse("1 fg/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.FemtogramsPerDeciLiter, FemtogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.FemtogramsPerDeciliter, FemtogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.FemtogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -828,7 +838,7 @@ public void Parse() try { var parsed = Density.Parse("1 g/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.GramsPerDeciliter, GramsPerDeciliterTolerance); Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -919,7 +929,7 @@ public void Parse() try { var parsed = Density.Parse("1 µg/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciliter, MicrogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -954,7 +964,7 @@ public void Parse() try { var parsed = Density.Parse("1 mg/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciliter, MilligramsPerDeciliterTolerance); Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -975,7 +985,7 @@ public void Parse() try { var parsed = Density.Parse("1 ng/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciliter, NanogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -996,7 +1006,7 @@ public void Parse() try { var parsed = Density.Parse("1 pg/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciliter, PicogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -1147,7 +1157,7 @@ public void TryParse() { { Assert.True(Density.TryParse("1 cg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciliter, CentigramsPerDeciliterTolerance); Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); } @@ -1165,7 +1175,7 @@ public void TryParse() { Assert.True(Density.TryParse("1 dg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciliter, DecigramsPerDeciliterTolerance); Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); } @@ -1183,7 +1193,7 @@ public void TryParse() { Assert.True(Density.TryParse("1 fg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.FemtogramsPerDeciLiter, FemtogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.FemtogramsPerDeciliter, FemtogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.FemtogramPerDeciliter, parsed.Unit); } @@ -1237,7 +1247,7 @@ public void TryParse() { Assert.True(Density.TryParse("1 g/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.GramsPerDeciliter, GramsPerDeciliterTolerance); Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); } @@ -1315,7 +1325,7 @@ public void TryParse() { Assert.True(Density.TryParse("1 µg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciliter, MicrogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); } @@ -1345,7 +1355,7 @@ public void TryParse() { Assert.True(Density.TryParse("1 mg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciliter, MilligramsPerDeciliterTolerance); Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); } @@ -1363,7 +1373,7 @@ public void TryParse() { Assert.True(Density.TryParse("1 ng/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciliter, NanogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); } @@ -1381,7 +1391,7 @@ public void TryParse() { Assert.True(Density.TryParse("1 pg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciliter, PicogramsPerDeciliterTolerance); Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); } @@ -2223,13 +2233,13 @@ public virtual void ToUnit_FromDefaultQuantity_ReturnsQuantityWithGivenUnit(Dens public void ConversionRoundTrip() { Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(1, Density.FromCentigramsPerDeciLiter(kilogrampercubicmeter.CentigramsPerDeciLiter).KilogramsPerCubicMeter, CentigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromCentigramsPerDeciliter(kilogrampercubicmeter.CentigramsPerDeciliter).KilogramsPerCubicMeter, CentigramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromCentigramsPerLiter(kilogrampercubicmeter.CentigramsPerLiter).KilogramsPerCubicMeter, CentigramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromCentigramsPerMilliliter(kilogrampercubicmeter.CentigramsPerMilliliter).KilogramsPerCubicMeter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromDecigramsPerDeciLiter(kilogrampercubicmeter.DecigramsPerDeciLiter).KilogramsPerCubicMeter, DecigramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromDecigramsPerDeciliter(kilogrampercubicmeter.DecigramsPerDeciliter).KilogramsPerCubicMeter, DecigramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromDecigramsPerLiter(kilogrampercubicmeter.DecigramsPerLiter).KilogramsPerCubicMeter, DecigramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromDecigramsPerMilliliter(kilogrampercubicmeter.DecigramsPerMilliliter).KilogramsPerCubicMeter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromFemtogramsPerDeciLiter(kilogrampercubicmeter.FemtogramsPerDeciLiter).KilogramsPerCubicMeter, FemtogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromFemtogramsPerDeciliter(kilogrampercubicmeter.FemtogramsPerDeciliter).KilogramsPerCubicMeter, FemtogramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromFemtogramsPerLiter(kilogrampercubicmeter.FemtogramsPerLiter).KilogramsPerCubicMeter, FemtogramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromFemtogramsPerMilliliter(kilogrampercubicmeter.FemtogramsPerMilliliter).KilogramsPerCubicMeter, FemtogramsPerMilliliterTolerance); AssertEx.EqualTolerance(1, Density.FromGramsPerCubicCentimeter(kilogrampercubicmeter.GramsPerCubicCentimeter).KilogramsPerCubicMeter, GramsPerCubicCentimeterTolerance); @@ -2237,7 +2247,7 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Density.FromGramsPerCubicInch(kilogrampercubicmeter.GramsPerCubicInch).KilogramsPerCubicMeter, GramsPerCubicInchTolerance); AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMeter(kilogrampercubicmeter.GramsPerCubicMeter).KilogramsPerCubicMeter, GramsPerCubicMeterTolerance); AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMillimeter(kilogrampercubicmeter.GramsPerCubicMillimeter).KilogramsPerCubicMeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerDeciLiter(kilogrampercubicmeter.GramsPerDeciLiter).KilogramsPerCubicMeter, GramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromGramsPerDeciliter(kilogrampercubicmeter.GramsPerDeciliter).KilogramsPerCubicMeter, GramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromGramsPerLiter(kilogrampercubicmeter.GramsPerLiter).KilogramsPerCubicMeter, GramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromGramsPerMilliliter(kilogrampercubicmeter.GramsPerMilliliter).KilogramsPerCubicMeter, GramsPerMilliliterTolerance); AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicCentimeter(kilogrampercubicmeter.KilogramsPerCubicCentimeter).KilogramsPerCubicMeter, KilogramsPerCubicCentimeterTolerance); @@ -2248,17 +2258,17 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicInch(kilogrampercubicmeter.KilopoundsPerCubicInch).KilogramsPerCubicMeter, KilopoundsPerCubicInchTolerance); AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicYard(kilogrampercubicmeter.KilopoundsPerCubicYard).KilogramsPerCubicMeter, KilopoundsPerCubicYardTolerance); AssertEx.EqualTolerance(1, Density.FromMicrogramsPerCubicMeter(kilogrampercubicmeter.MicrogramsPerCubicMeter).KilogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerDeciLiter(kilogrampercubicmeter.MicrogramsPerDeciLiter).KilogramsPerCubicMeter, MicrogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromMicrogramsPerDeciliter(kilogrampercubicmeter.MicrogramsPerDeciliter).KilogramsPerCubicMeter, MicrogramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromMicrogramsPerLiter(kilogrampercubicmeter.MicrogramsPerLiter).KilogramsPerCubicMeter, MicrogramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromMicrogramsPerMilliliter(kilogrampercubicmeter.MicrogramsPerMilliliter).KilogramsPerCubicMeter, MicrogramsPerMilliliterTolerance); AssertEx.EqualTolerance(1, Density.FromMilligramsPerCubicMeter(kilogrampercubicmeter.MilligramsPerCubicMeter).KilogramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerDeciLiter(kilogrampercubicmeter.MilligramsPerDeciLiter).KilogramsPerCubicMeter, MilligramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromMilligramsPerDeciliter(kilogrampercubicmeter.MilligramsPerDeciliter).KilogramsPerCubicMeter, MilligramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromMilligramsPerLiter(kilogrampercubicmeter.MilligramsPerLiter).KilogramsPerCubicMeter, MilligramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromMilligramsPerMilliliter(kilogrampercubicmeter.MilligramsPerMilliliter).KilogramsPerCubicMeter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromNanogramsPerDeciLiter(kilogrampercubicmeter.NanogramsPerDeciLiter).KilogramsPerCubicMeter, NanogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromNanogramsPerDeciliter(kilogrampercubicmeter.NanogramsPerDeciliter).KilogramsPerCubicMeter, NanogramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromNanogramsPerLiter(kilogrampercubicmeter.NanogramsPerLiter).KilogramsPerCubicMeter, NanogramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromNanogramsPerMilliliter(kilogrampercubicmeter.NanogramsPerMilliliter).KilogramsPerCubicMeter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromPicogramsPerDeciLiter(kilogrampercubicmeter.PicogramsPerDeciLiter).KilogramsPerCubicMeter, PicogramsPerDeciLiterTolerance); + AssertEx.EqualTolerance(1, Density.FromPicogramsPerDeciliter(kilogrampercubicmeter.PicogramsPerDeciliter).KilogramsPerCubicMeter, PicogramsPerDeciliterTolerance); AssertEx.EqualTolerance(1, Density.FromPicogramsPerLiter(kilogrampercubicmeter.PicogramsPerLiter).KilogramsPerCubicMeter, PicogramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromPicogramsPerMilliliter(kilogrampercubicmeter.PicogramsPerMilliliter).KilogramsPerCubicMeter, PicogramsPerMilliliterTolerance); AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicCentimeter(kilogrampercubicmeter.PoundsPerCubicCentimeter).KilogramsPerCubicMeter, PoundsPerCubicCentimeterTolerance); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs index f894a93107..b6b8eb6e17 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs @@ -107,16 +107,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Duration(double.PositiveInfinity, DurationUnit.Second)); - Assert.Throws(() => new Duration(double.NegativeInfinity, DurationUnit.Second)); + var exception1 = Record.Exception(() => new Duration(double.PositiveInfinity, DurationUnit.Second)); + var exception2 = Record.Exception(() => new Duration(double.NegativeInfinity, DurationUnit.Second)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Duration(double.NaN, DurationUnit.Second)); + var exception = Record.Exception(() => new Duration(double.NaN, DurationUnit.Second)); + + Assert.Null(exception); } [Fact] @@ -221,16 +226,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSeconds_WithInfinityValue_ThrowsArgumentException() + public void FromSeconds_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Duration.FromSeconds(double.PositiveInfinity)); - Assert.Throws(() => Duration.FromSeconds(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Duration.FromSeconds(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Duration.FromSeconds(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSeconds_WithNanValue_ThrowsArgumentException() + public void FromSeconds_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Duration.FromSeconds(double.NaN)); + var exception = Record.Exception(() => Duration.FromSeconds(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs index dd8bc8d531..04783059d7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs @@ -103,16 +103,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new DynamicViscosity(double.PositiveInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); - Assert.Throws(() => new DynamicViscosity(double.NegativeInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + var exception1 = Record.Exception(() => new DynamicViscosity(double.PositiveInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + var exception2 = Record.Exception(() => new DynamicViscosity(double.NegativeInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new DynamicViscosity(double.NaN, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + var exception = Record.Exception(() => new DynamicViscosity(double.NaN, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + + Assert.Null(exception); } [Fact] @@ -212,16 +217,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonSecondsPerMeterSquared_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonSecondsPerMeterSquared_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.PositiveInfinity)); - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NegativeInfinity)); + var exception1 = Record.Exception(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.PositiveInfinity)); + var exception2 = Record.Exception(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonSecondsPerMeterSquared_WithNanValue_ThrowsArgumentException() + public void FromNewtonSecondsPerMeterSquared_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NaN)); + var exception = Record.Exception(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs index b38c2598ff..d8116b6226 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricAdmittance(double.PositiveInfinity, ElectricAdmittanceUnit.Siemens)); - Assert.Throws(() => new ElectricAdmittance(double.NegativeInfinity, ElectricAdmittanceUnit.Siemens)); + var exception1 = Record.Exception(() => new ElectricAdmittance(double.PositiveInfinity, ElectricAdmittanceUnit.Siemens)); + var exception2 = Record.Exception(() => new ElectricAdmittance(double.NegativeInfinity, ElectricAdmittanceUnit.Siemens)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricAdmittance(double.NaN, ElectricAdmittanceUnit.Siemens)); + var exception = Record.Exception(() => new ElectricAdmittance(double.NaN, ElectricAdmittanceUnit.Siemens)); + + Assert.Null(exception); } [Fact] @@ -158,16 +163,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSiemens_WithInfinityValue_ThrowsArgumentException() + public void FromSiemens_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.PositiveInfinity)); - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricAdmittance.FromSiemens(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricAdmittance.FromSiemens(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSiemens_WithNanValue_ThrowsArgumentException() + public void FromSiemens_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NaN)); + var exception = Record.Exception(() => ElectricAdmittance.FromSiemens(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs index 0633765b22..dbfcedc08f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricChargeDensity(double.PositiveInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); - Assert.Throws(() => new ElectricChargeDensity(double.NegativeInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + var exception1 = Record.Exception(() => new ElectricChargeDensity(double.PositiveInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + var exception2 = Record.Exception(() => new ElectricChargeDensity(double.NegativeInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricChargeDensity(double.NaN, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + var exception = Record.Exception(() => new ElectricChargeDensity(double.NaN, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCoulombsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + public void FromCoulombsPerCubicMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCoulombsPerCubicMeter_WithNanValue_ThrowsArgumentException() + public void FromCoulombsPerCubicMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NaN)); + var exception = Record.Exception(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs index 0307409152..bfd453e100 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs @@ -107,16 +107,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCharge(double.PositiveInfinity, ElectricChargeUnit.Coulomb)); - Assert.Throws(() => new ElectricCharge(double.NegativeInfinity, ElectricChargeUnit.Coulomb)); + var exception1 = Record.Exception(() => new ElectricCharge(double.PositiveInfinity, ElectricChargeUnit.Coulomb)); + var exception2 = Record.Exception(() => new ElectricCharge(double.NegativeInfinity, ElectricChargeUnit.Coulomb)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCharge(double.NaN, ElectricChargeUnit.Coulomb)); + var exception = Record.Exception(() => new ElectricCharge(double.NaN, ElectricChargeUnit.Coulomb)); + + Assert.Null(exception); } [Fact] @@ -221,16 +226,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCoulombs_WithInfinityValue_ThrowsArgumentException() + public void FromCoulombs_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCharge.FromCoulombs(double.PositiveInfinity)); - Assert.Throws(() => ElectricCharge.FromCoulombs(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricCharge.FromCoulombs(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricCharge.FromCoulombs(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCoulombs_WithNanValue_ThrowsArgumentException() + public void FromCoulombs_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCharge.FromCoulombs(double.NaN)); + var exception = Record.Exception(() => ElectricCharge.FromCoulombs(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs index 5c9c9a2388..ab6dbeb4a1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs @@ -83,16 +83,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricConductance(double.PositiveInfinity, ElectricConductanceUnit.Siemens)); - Assert.Throws(() => new ElectricConductance(double.NegativeInfinity, ElectricConductanceUnit.Siemens)); + var exception1 = Record.Exception(() => new ElectricConductance(double.PositiveInfinity, ElectricConductanceUnit.Siemens)); + var exception2 = Record.Exception(() => new ElectricConductance(double.NegativeInfinity, ElectricConductanceUnit.Siemens)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricConductance(double.NaN, ElectricConductanceUnit.Siemens)); + var exception = Record.Exception(() => new ElectricConductance(double.NaN, ElectricConductanceUnit.Siemens)); + + Assert.Null(exception); } [Fact] @@ -167,16 +172,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSiemens_WithInfinityValue_ThrowsArgumentException() + public void FromSiemens_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricConductance.FromSiemens(double.PositiveInfinity)); - Assert.Throws(() => ElectricConductance.FromSiemens(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricConductance.FromSiemens(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricConductance.FromSiemens(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSiemens_WithNanValue_ThrowsArgumentException() + public void FromSiemens_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricConductance.FromSiemens(double.NaN)); + var exception = Record.Exception(() => ElectricConductance.FromSiemens(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs index 5495b54c60..db74c22833 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricConductivity(double.PositiveInfinity, ElectricConductivityUnit.SiemensPerMeter)); - Assert.Throws(() => new ElectricConductivity(double.NegativeInfinity, ElectricConductivityUnit.SiemensPerMeter)); + var exception1 = Record.Exception(() => new ElectricConductivity(double.PositiveInfinity, ElectricConductivityUnit.SiemensPerMeter)); + var exception2 = Record.Exception(() => new ElectricConductivity(double.NegativeInfinity, ElectricConductivityUnit.SiemensPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricConductivity(double.NaN, ElectricConductivityUnit.SiemensPerMeter)); + var exception = Record.Exception(() => new ElectricConductivity(double.NaN, ElectricConductivityUnit.SiemensPerMeter)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSiemensPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromSiemensPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricConductivity.FromSiemensPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricConductivity.FromSiemensPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSiemensPerMeter_WithNanValue_ThrowsArgumentException() + public void FromSiemensPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NaN)); + var exception = Record.Exception(() => ElectricConductivity.FromSiemensPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs index 1e8f4d08e3..36a051e746 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentDensity(double.PositiveInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); - Assert.Throws(() => new ElectricCurrentDensity(double.NegativeInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + var exception1 = Record.Exception(() => new ElectricCurrentDensity(double.PositiveInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + var exception2 = Record.Exception(() => new ElectricCurrentDensity(double.NegativeInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentDensity(double.NaN, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + var exception = Record.Exception(() => new ElectricCurrentDensity(double.NaN, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromAmperesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromAmperesPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromAmperesPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromAmperesPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs index 9f712eba0f..7850e56594 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs @@ -91,16 +91,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentGradient(double.PositiveInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); - Assert.Throws(() => new ElectricCurrentGradient(double.NegativeInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + var exception1 = Record.Exception(() => new ElectricCurrentGradient(double.PositiveInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + var exception2 = Record.Exception(() => new ElectricCurrentGradient(double.NegativeInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrentGradient(double.NaN, ElectricCurrentGradientUnit.AmperePerSecond)); + var exception = Record.Exception(() => new ElectricCurrentGradient(double.NaN, ElectricCurrentGradientUnit.AmperePerSecond)); + + Assert.Null(exception); } [Fact] @@ -185,16 +190,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromAmperesPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromAmperesPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricCurrentGradient.FromAmperesPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromAmperesPerSecond_WithNanValue_ThrowsArgumentException() + public void FromAmperesPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NaN)); + var exception = Record.Exception(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs index a562934178..fb478daebd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrent(double.PositiveInfinity, ElectricCurrentUnit.Ampere)); - Assert.Throws(() => new ElectricCurrent(double.NegativeInfinity, ElectricCurrentUnit.Ampere)); + var exception1 = Record.Exception(() => new ElectricCurrent(double.PositiveInfinity, ElectricCurrentUnit.Ampere)); + var exception2 = Record.Exception(() => new ElectricCurrent(double.NegativeInfinity, ElectricCurrentUnit.Ampere)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricCurrent(double.NaN, ElectricCurrentUnit.Ampere)); + var exception = Record.Exception(() => new ElectricCurrent(double.NaN, ElectricCurrentUnit.Ampere)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromAmperes_WithInfinityValue_ThrowsArgumentException() + public void FromAmperes_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromAmperes_WithNanValue_ThrowsArgumentException() + public void FromAmperes_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricCurrent.FromAmperes(double.NaN)); + var exception = Record.Exception(() => ElectricCurrent.FromAmperes(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs index e45dad4e08..c0ed5996c6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricField(double.PositiveInfinity, ElectricFieldUnit.VoltPerMeter)); - Assert.Throws(() => new ElectricField(double.NegativeInfinity, ElectricFieldUnit.VoltPerMeter)); + var exception1 = Record.Exception(() => new ElectricField(double.PositiveInfinity, ElectricFieldUnit.VoltPerMeter)); + var exception2 = Record.Exception(() => new ElectricField(double.NegativeInfinity, ElectricFieldUnit.VoltPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricField(double.NaN, ElectricFieldUnit.VoltPerMeter)); + var exception = Record.Exception(() => new ElectricField(double.NaN, ElectricFieldUnit.VoltPerMeter)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVoltsPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromVoltsPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltsPerMeter_WithNanValue_ThrowsArgumentException() + public void FromVoltsPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NaN)); + var exception = Record.Exception(() => ElectricField.FromVoltsPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs index b96c40371f..5277d5929e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs @@ -83,16 +83,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricInductance(double.PositiveInfinity, ElectricInductanceUnit.Henry)); - Assert.Throws(() => new ElectricInductance(double.NegativeInfinity, ElectricInductanceUnit.Henry)); + var exception1 = Record.Exception(() => new ElectricInductance(double.PositiveInfinity, ElectricInductanceUnit.Henry)); + var exception2 = Record.Exception(() => new ElectricInductance(double.NegativeInfinity, ElectricInductanceUnit.Henry)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricInductance(double.NaN, ElectricInductanceUnit.Henry)); + var exception = Record.Exception(() => new ElectricInductance(double.NaN, ElectricInductanceUnit.Henry)); + + Assert.Null(exception); } [Fact] @@ -167,16 +172,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromHenries_WithInfinityValue_ThrowsArgumentException() + public void FromHenries_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricInductance.FromHenries(double.PositiveInfinity)); - Assert.Throws(() => ElectricInductance.FromHenries(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricInductance.FromHenries(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricInductance.FromHenries(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromHenries_WithNanValue_ThrowsArgumentException() + public void FromHenries_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricInductance.FromHenries(double.NaN)); + var exception = Record.Exception(() => ElectricInductance.FromHenries(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs index d1219793c5..c8afc29b25 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs @@ -83,16 +83,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialAc(double.PositiveInfinity, ElectricPotentialAcUnit.VoltAc)); - Assert.Throws(() => new ElectricPotentialAc(double.NegativeInfinity, ElectricPotentialAcUnit.VoltAc)); + var exception1 = Record.Exception(() => new ElectricPotentialAc(double.PositiveInfinity, ElectricPotentialAcUnit.VoltAc)); + var exception2 = Record.Exception(() => new ElectricPotentialAc(double.NegativeInfinity, ElectricPotentialAcUnit.VoltAc)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialAc(double.NaN, ElectricPotentialAcUnit.VoltAc)); + var exception = Record.Exception(() => new ElectricPotentialAc(double.NaN, ElectricPotentialAcUnit.VoltAc)); + + Assert.Null(exception); } [Fact] @@ -167,16 +172,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVoltsAc_WithInfinityValue_ThrowsArgumentException() + public void FromVoltsAc_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricPotentialAc.FromVoltsAc(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricPotentialAc.FromVoltsAc(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltsAc_WithNanValue_ThrowsArgumentException() + public void FromVoltsAc_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NaN)); + var exception = Record.Exception(() => ElectricPotentialAc.FromVoltsAc(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs index e30643eb12..3f496d9d3d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs @@ -38,74 +38,74 @@ namespace UnitsNet.Tests // ReSharper disable once PartialTypeWithSinglePart public abstract partial class ElectricPotentialChangeRateTestsBase : QuantityTestsBase { - protected abstract double KilovoltsPerHoursInOneVoltPerSecond { get; } - protected abstract double KilovoltsPerMicrosecondsInOneVoltPerSecond { get; } - protected abstract double KilovoltsPerMinutesInOneVoltPerSecond { get; } - protected abstract double KilovoltsPerSecondsInOneVoltPerSecond { get; } - protected abstract double MegavoltsPerHoursInOneVoltPerSecond { get; } - protected abstract double MegavoltsPerMicrosecondsInOneVoltPerSecond { get; } - protected abstract double MegavoltsPerMinutesInOneVoltPerSecond { get; } - protected abstract double MegavoltsPerSecondsInOneVoltPerSecond { get; } - protected abstract double MicrovoltsPerHoursInOneVoltPerSecond { get; } - protected abstract double MicrovoltsPerMicrosecondsInOneVoltPerSecond { get; } - protected abstract double MicrovoltsPerMinutesInOneVoltPerSecond { get; } - protected abstract double MicrovoltsPerSecondsInOneVoltPerSecond { get; } - protected abstract double MillivoltsPerHoursInOneVoltPerSecond { get; } - protected abstract double MillivoltsPerMicrosecondsInOneVoltPerSecond { get; } - protected abstract double MillivoltsPerMinutesInOneVoltPerSecond { get; } - protected abstract double MillivoltsPerSecondsInOneVoltPerSecond { get; } - protected abstract double VoltsPerHoursInOneVoltPerSecond { get; } - protected abstract double VoltsPerMicrosecondsInOneVoltPerSecond { get; } - protected abstract double VoltsPerMinutesInOneVoltPerSecond { get; } - protected abstract double VoltsPerSecondsInOneVoltPerSecond { get; } + protected abstract double KilovoltsPerHourInOneVoltPerSecond { get; } + protected abstract double KilovoltsPerMicrosecondInOneVoltPerSecond { get; } + protected abstract double KilovoltsPerMinuteInOneVoltPerSecond { get; } + protected abstract double KilovoltsPerSecondInOneVoltPerSecond { get; } + protected abstract double MegavoltsPerHourInOneVoltPerSecond { get; } + protected abstract double MegavoltsPerMicrosecondInOneVoltPerSecond { get; } + protected abstract double MegavoltsPerMinuteInOneVoltPerSecond { get; } + protected abstract double MegavoltsPerSecondInOneVoltPerSecond { get; } + protected abstract double MicrovoltsPerHourInOneVoltPerSecond { get; } + protected abstract double MicrovoltsPerMicrosecondInOneVoltPerSecond { get; } + protected abstract double MicrovoltsPerMinuteInOneVoltPerSecond { get; } + protected abstract double MicrovoltsPerSecondInOneVoltPerSecond { get; } + protected abstract double MillivoltsPerHourInOneVoltPerSecond { get; } + protected abstract double MillivoltsPerMicrosecondInOneVoltPerSecond { get; } + protected abstract double MillivoltsPerMinuteInOneVoltPerSecond { get; } + protected abstract double MillivoltsPerSecondInOneVoltPerSecond { get; } + protected abstract double VoltsPerHourInOneVoltPerSecond { get; } + protected abstract double VoltsPerMicrosecondInOneVoltPerSecond { get; } + protected abstract double VoltsPerMinuteInOneVoltPerSecond { get; } + protected abstract double VoltsPerSecondInOneVoltPerSecond { get; } // ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilovoltsPerHoursTolerance { get { return 1e-5; } } - protected virtual double KilovoltsPerMicrosecondsTolerance { get { return 1e-5; } } - protected virtual double KilovoltsPerMinutesTolerance { get { return 1e-5; } } - protected virtual double KilovoltsPerSecondsTolerance { get { return 1e-5; } } - protected virtual double MegavoltsPerHoursTolerance { get { return 1e-5; } } - protected virtual double MegavoltsPerMicrosecondsTolerance { get { return 1e-5; } } - protected virtual double MegavoltsPerMinutesTolerance { get { return 1e-5; } } - protected virtual double MegavoltsPerSecondsTolerance { get { return 1e-5; } } - protected virtual double MicrovoltsPerHoursTolerance { get { return 1e-5; } } - protected virtual double MicrovoltsPerMicrosecondsTolerance { get { return 1e-5; } } - protected virtual double MicrovoltsPerMinutesTolerance { get { return 1e-5; } } - protected virtual double MicrovoltsPerSecondsTolerance { get { return 1e-5; } } - protected virtual double MillivoltsPerHoursTolerance { get { return 1e-5; } } - protected virtual double MillivoltsPerMicrosecondsTolerance { get { return 1e-5; } } - protected virtual double MillivoltsPerMinutesTolerance { get { return 1e-5; } } - protected virtual double MillivoltsPerSecondsTolerance { get { return 1e-5; } } - protected virtual double VoltsPerHoursTolerance { get { return 1e-5; } } - protected virtual double VoltsPerMicrosecondsTolerance { get { return 1e-5; } } - protected virtual double VoltsPerMinutesTolerance { get { return 1e-5; } } - protected virtual double VoltsPerSecondsTolerance { get { return 1e-5; } } + protected virtual double KilovoltsPerHourTolerance { get { return 1e-5; } } + protected virtual double KilovoltsPerMicrosecondTolerance { get { return 1e-5; } } + protected virtual double KilovoltsPerMinuteTolerance { get { return 1e-5; } } + protected virtual double KilovoltsPerSecondTolerance { get { return 1e-5; } } + protected virtual double MegavoltsPerHourTolerance { get { return 1e-5; } } + protected virtual double MegavoltsPerMicrosecondTolerance { get { return 1e-5; } } + protected virtual double MegavoltsPerMinuteTolerance { get { return 1e-5; } } + protected virtual double MegavoltsPerSecondTolerance { get { return 1e-5; } } + protected virtual double MicrovoltsPerHourTolerance { get { return 1e-5; } } + protected virtual double MicrovoltsPerMicrosecondTolerance { get { return 1e-5; } } + protected virtual double MicrovoltsPerMinuteTolerance { get { return 1e-5; } } + protected virtual double MicrovoltsPerSecondTolerance { get { return 1e-5; } } + protected virtual double MillivoltsPerHourTolerance { get { return 1e-5; } } + protected virtual double MillivoltsPerMicrosecondTolerance { get { return 1e-5; } } + protected virtual double MillivoltsPerMinuteTolerance { get { return 1e-5; } } + protected virtual double MillivoltsPerSecondTolerance { get { return 1e-5; } } + protected virtual double VoltsPerHourTolerance { get { return 1e-5; } } + protected virtual double VoltsPerMicrosecondTolerance { get { return 1e-5; } } + protected virtual double VoltsPerMinuteTolerance { get { return 1e-5; } } + protected virtual double VoltsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global protected (double UnitsInBaseUnit, double Tolerence) GetConversionFactor(ElectricPotentialChangeRateUnit unit) { return unit switch { - ElectricPotentialChangeRateUnit.KilovoltPerHour => (KilovoltsPerHoursInOneVoltPerSecond, KilovoltsPerHoursTolerance), - ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond => (KilovoltsPerMicrosecondsInOneVoltPerSecond, KilovoltsPerMicrosecondsTolerance), - ElectricPotentialChangeRateUnit.KilovoltPerMinute => (KilovoltsPerMinutesInOneVoltPerSecond, KilovoltsPerMinutesTolerance), - ElectricPotentialChangeRateUnit.KilovoltPerSecond => (KilovoltsPerSecondsInOneVoltPerSecond, KilovoltsPerSecondsTolerance), - ElectricPotentialChangeRateUnit.MegavoltPerHour => (MegavoltsPerHoursInOneVoltPerSecond, MegavoltsPerHoursTolerance), - ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond => (MegavoltsPerMicrosecondsInOneVoltPerSecond, MegavoltsPerMicrosecondsTolerance), - ElectricPotentialChangeRateUnit.MegavoltPerMinute => (MegavoltsPerMinutesInOneVoltPerSecond, MegavoltsPerMinutesTolerance), - ElectricPotentialChangeRateUnit.MegavoltPerSecond => (MegavoltsPerSecondsInOneVoltPerSecond, MegavoltsPerSecondsTolerance), - ElectricPotentialChangeRateUnit.MicrovoltPerHour => (MicrovoltsPerHoursInOneVoltPerSecond, MicrovoltsPerHoursTolerance), - ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond => (MicrovoltsPerMicrosecondsInOneVoltPerSecond, MicrovoltsPerMicrosecondsTolerance), - ElectricPotentialChangeRateUnit.MicrovoltPerMinute => (MicrovoltsPerMinutesInOneVoltPerSecond, MicrovoltsPerMinutesTolerance), - ElectricPotentialChangeRateUnit.MicrovoltPerSecond => (MicrovoltsPerSecondsInOneVoltPerSecond, MicrovoltsPerSecondsTolerance), - ElectricPotentialChangeRateUnit.MillivoltPerHour => (MillivoltsPerHoursInOneVoltPerSecond, MillivoltsPerHoursTolerance), - ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond => (MillivoltsPerMicrosecondsInOneVoltPerSecond, MillivoltsPerMicrosecondsTolerance), - ElectricPotentialChangeRateUnit.MillivoltPerMinute => (MillivoltsPerMinutesInOneVoltPerSecond, MillivoltsPerMinutesTolerance), - ElectricPotentialChangeRateUnit.MillivoltPerSecond => (MillivoltsPerSecondsInOneVoltPerSecond, MillivoltsPerSecondsTolerance), - ElectricPotentialChangeRateUnit.VoltPerHour => (VoltsPerHoursInOneVoltPerSecond, VoltsPerHoursTolerance), - ElectricPotentialChangeRateUnit.VoltPerMicrosecond => (VoltsPerMicrosecondsInOneVoltPerSecond, VoltsPerMicrosecondsTolerance), - ElectricPotentialChangeRateUnit.VoltPerMinute => (VoltsPerMinutesInOneVoltPerSecond, VoltsPerMinutesTolerance), - ElectricPotentialChangeRateUnit.VoltPerSecond => (VoltsPerSecondsInOneVoltPerSecond, VoltsPerSecondsTolerance), + ElectricPotentialChangeRateUnit.KilovoltPerHour => (KilovoltsPerHourInOneVoltPerSecond, KilovoltsPerHourTolerance), + ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond => (KilovoltsPerMicrosecondInOneVoltPerSecond, KilovoltsPerMicrosecondTolerance), + ElectricPotentialChangeRateUnit.KilovoltPerMinute => (KilovoltsPerMinuteInOneVoltPerSecond, KilovoltsPerMinuteTolerance), + ElectricPotentialChangeRateUnit.KilovoltPerSecond => (KilovoltsPerSecondInOneVoltPerSecond, KilovoltsPerSecondTolerance), + ElectricPotentialChangeRateUnit.MegavoltPerHour => (MegavoltsPerHourInOneVoltPerSecond, MegavoltsPerHourTolerance), + ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond => (MegavoltsPerMicrosecondInOneVoltPerSecond, MegavoltsPerMicrosecondTolerance), + ElectricPotentialChangeRateUnit.MegavoltPerMinute => (MegavoltsPerMinuteInOneVoltPerSecond, MegavoltsPerMinuteTolerance), + ElectricPotentialChangeRateUnit.MegavoltPerSecond => (MegavoltsPerSecondInOneVoltPerSecond, MegavoltsPerSecondTolerance), + ElectricPotentialChangeRateUnit.MicrovoltPerHour => (MicrovoltsPerHourInOneVoltPerSecond, MicrovoltsPerHourTolerance), + ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond => (MicrovoltsPerMicrosecondInOneVoltPerSecond, MicrovoltsPerMicrosecondTolerance), + ElectricPotentialChangeRateUnit.MicrovoltPerMinute => (MicrovoltsPerMinuteInOneVoltPerSecond, MicrovoltsPerMinuteTolerance), + ElectricPotentialChangeRateUnit.MicrovoltPerSecond => (MicrovoltsPerSecondInOneVoltPerSecond, MicrovoltsPerSecondTolerance), + ElectricPotentialChangeRateUnit.MillivoltPerHour => (MillivoltsPerHourInOneVoltPerSecond, MillivoltsPerHourTolerance), + ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond => (MillivoltsPerMicrosecondInOneVoltPerSecond, MillivoltsPerMicrosecondTolerance), + ElectricPotentialChangeRateUnit.MillivoltPerMinute => (MillivoltsPerMinuteInOneVoltPerSecond, MillivoltsPerMinuteTolerance), + ElectricPotentialChangeRateUnit.MillivoltPerSecond => (MillivoltsPerSecondInOneVoltPerSecond, MillivoltsPerSecondTolerance), + ElectricPotentialChangeRateUnit.VoltPerHour => (VoltsPerHourInOneVoltPerSecond, VoltsPerHourTolerance), + ElectricPotentialChangeRateUnit.VoltPerMicrosecond => (VoltsPerMicrosecondInOneVoltPerSecond, VoltsPerMicrosecondTolerance), + ElectricPotentialChangeRateUnit.VoltPerMinute => (VoltsPerMinuteInOneVoltPerSecond, VoltsPerMinuteTolerance), + ElectricPotentialChangeRateUnit.VoltPerSecond => (VoltsPerSecondInOneVoltPerSecond, VoltsPerSecondTolerance), _ => throw new NotSupportedException() }; } @@ -143,16 +143,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialChangeRate(double.PositiveInfinity, ElectricPotentialChangeRateUnit.VoltPerSecond)); - Assert.Throws(() => new ElectricPotentialChangeRate(double.NegativeInfinity, ElectricPotentialChangeRateUnit.VoltPerSecond)); + var exception1 = Record.Exception(() => new ElectricPotentialChangeRate(double.PositiveInfinity, ElectricPotentialChangeRateUnit.VoltPerSecond)); + var exception2 = Record.Exception(() => new ElectricPotentialChangeRate(double.NegativeInfinity, ElectricPotentialChangeRateUnit.VoltPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialChangeRate(double.NaN, ElectricPotentialChangeRateUnit.VoltPerSecond)); + var exception = Record.Exception(() => new ElectricPotentialChangeRate(double.NaN, ElectricPotentialChangeRateUnit.VoltPerSecond)); + + Assert.Null(exception); } [Fact] @@ -193,151 +198,156 @@ public void ElectricPotentialChangeRate_QuantityInfo_ReturnsQuantityInfoDescribi [Fact] public void VoltPerSecondToElectricPotentialChangeRateUnits() { - ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); - AssertEx.EqualTolerance(KilovoltsPerHoursInOneVoltPerSecond, voltpersecond.KilovoltsPerHours, KilovoltsPerHoursTolerance); - AssertEx.EqualTolerance(KilovoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.KilovoltsPerMicroseconds, KilovoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(KilovoltsPerMinutesInOneVoltPerSecond, voltpersecond.KilovoltsPerMinutes, KilovoltsPerMinutesTolerance); - AssertEx.EqualTolerance(KilovoltsPerSecondsInOneVoltPerSecond, voltpersecond.KilovoltsPerSeconds, KilovoltsPerSecondsTolerance); - AssertEx.EqualTolerance(MegavoltsPerHoursInOneVoltPerSecond, voltpersecond.MegavoltsPerHours, MegavoltsPerHoursTolerance); - AssertEx.EqualTolerance(MegavoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.MegavoltsPerMicroseconds, MegavoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(MegavoltsPerMinutesInOneVoltPerSecond, voltpersecond.MegavoltsPerMinutes, MegavoltsPerMinutesTolerance); - AssertEx.EqualTolerance(MegavoltsPerSecondsInOneVoltPerSecond, voltpersecond.MegavoltsPerSeconds, MegavoltsPerSecondsTolerance); - AssertEx.EqualTolerance(MicrovoltsPerHoursInOneVoltPerSecond, voltpersecond.MicrovoltsPerHours, MicrovoltsPerHoursTolerance); - AssertEx.EqualTolerance(MicrovoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.MicrovoltsPerMicroseconds, MicrovoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(MicrovoltsPerMinutesInOneVoltPerSecond, voltpersecond.MicrovoltsPerMinutes, MicrovoltsPerMinutesTolerance); - AssertEx.EqualTolerance(MicrovoltsPerSecondsInOneVoltPerSecond, voltpersecond.MicrovoltsPerSeconds, MicrovoltsPerSecondsTolerance); - AssertEx.EqualTolerance(MillivoltsPerHoursInOneVoltPerSecond, voltpersecond.MillivoltsPerHours, MillivoltsPerHoursTolerance); - AssertEx.EqualTolerance(MillivoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.MillivoltsPerMicroseconds, MillivoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(MillivoltsPerMinutesInOneVoltPerSecond, voltpersecond.MillivoltsPerMinutes, MillivoltsPerMinutesTolerance); - AssertEx.EqualTolerance(MillivoltsPerSecondsInOneVoltPerSecond, voltpersecond.MillivoltsPerSeconds, MillivoltsPerSecondsTolerance); - AssertEx.EqualTolerance(VoltsPerHoursInOneVoltPerSecond, voltpersecond.VoltsPerHours, VoltsPerHoursTolerance); - AssertEx.EqualTolerance(VoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.VoltsPerMicroseconds, VoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(VoltsPerMinutesInOneVoltPerSecond, voltpersecond.VoltsPerMinutes, VoltsPerMinutesTolerance); - AssertEx.EqualTolerance(VoltsPerSecondsInOneVoltPerSecond, voltpersecond.VoltsPerSeconds, VoltsPerSecondsTolerance); + ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); + AssertEx.EqualTolerance(KilovoltsPerHourInOneVoltPerSecond, voltpersecond.KilovoltsPerHour, KilovoltsPerHourTolerance); + AssertEx.EqualTolerance(KilovoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.KilovoltsPerMicrosecond, KilovoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(KilovoltsPerMinuteInOneVoltPerSecond, voltpersecond.KilovoltsPerMinute, KilovoltsPerMinuteTolerance); + AssertEx.EqualTolerance(KilovoltsPerSecondInOneVoltPerSecond, voltpersecond.KilovoltsPerSecond, KilovoltsPerSecondTolerance); + AssertEx.EqualTolerance(MegavoltsPerHourInOneVoltPerSecond, voltpersecond.MegavoltsPerHour, MegavoltsPerHourTolerance); + AssertEx.EqualTolerance(MegavoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.MegavoltsPerMicrosecond, MegavoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(MegavoltsPerMinuteInOneVoltPerSecond, voltpersecond.MegavoltsPerMinute, MegavoltsPerMinuteTolerance); + AssertEx.EqualTolerance(MegavoltsPerSecondInOneVoltPerSecond, voltpersecond.MegavoltsPerSecond, MegavoltsPerSecondTolerance); + AssertEx.EqualTolerance(MicrovoltsPerHourInOneVoltPerSecond, voltpersecond.MicrovoltsPerHour, MicrovoltsPerHourTolerance); + AssertEx.EqualTolerance(MicrovoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.MicrovoltsPerMicrosecond, MicrovoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(MicrovoltsPerMinuteInOneVoltPerSecond, voltpersecond.MicrovoltsPerMinute, MicrovoltsPerMinuteTolerance); + AssertEx.EqualTolerance(MicrovoltsPerSecondInOneVoltPerSecond, voltpersecond.MicrovoltsPerSecond, MicrovoltsPerSecondTolerance); + AssertEx.EqualTolerance(MillivoltsPerHourInOneVoltPerSecond, voltpersecond.MillivoltsPerHour, MillivoltsPerHourTolerance); + AssertEx.EqualTolerance(MillivoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.MillivoltsPerMicrosecond, MillivoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(MillivoltsPerMinuteInOneVoltPerSecond, voltpersecond.MillivoltsPerMinute, MillivoltsPerMinuteTolerance); + AssertEx.EqualTolerance(MillivoltsPerSecondInOneVoltPerSecond, voltpersecond.MillivoltsPerSecond, MillivoltsPerSecondTolerance); + AssertEx.EqualTolerance(VoltsPerHourInOneVoltPerSecond, voltpersecond.VoltsPerHour, VoltsPerHourTolerance); + AssertEx.EqualTolerance(VoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.VoltsPerMicrosecond, VoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(VoltsPerMinuteInOneVoltPerSecond, voltpersecond.VoltsPerMinute, VoltsPerMinuteTolerance); + AssertEx.EqualTolerance(VoltsPerSecondInOneVoltPerSecond, voltpersecond.VoltsPerSecond, VoltsPerSecondTolerance); } [Fact] public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() { var quantity00 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.KilovoltPerHour); - AssertEx.EqualTolerance(1, quantity00.KilovoltsPerHours, KilovoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, quantity00.KilovoltsPerHour, KilovoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerHour, quantity00.Unit); var quantity01 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); - AssertEx.EqualTolerance(1, quantity01.KilovoltsPerMicroseconds, KilovoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, quantity01.KilovoltsPerMicrosecond, KilovoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond, quantity01.Unit); var quantity02 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.KilovoltPerMinute); - AssertEx.EqualTolerance(1, quantity02.KilovoltsPerMinutes, KilovoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity02.KilovoltsPerMinute, KilovoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerMinute, quantity02.Unit); var quantity03 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.KilovoltPerSecond); - AssertEx.EqualTolerance(1, quantity03.KilovoltsPerSeconds, KilovoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, quantity03.KilovoltsPerSecond, KilovoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerSecond, quantity03.Unit); var quantity04 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MegavoltPerHour); - AssertEx.EqualTolerance(1, quantity04.MegavoltsPerHours, MegavoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, quantity04.MegavoltsPerHour, MegavoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerHour, quantity04.Unit); var quantity05 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); - AssertEx.EqualTolerance(1, quantity05.MegavoltsPerMicroseconds, MegavoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, quantity05.MegavoltsPerMicrosecond, MegavoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond, quantity05.Unit); var quantity06 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MegavoltPerMinute); - AssertEx.EqualTolerance(1, quantity06.MegavoltsPerMinutes, MegavoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity06.MegavoltsPerMinute, MegavoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerMinute, quantity06.Unit); var quantity07 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MegavoltPerSecond); - AssertEx.EqualTolerance(1, quantity07.MegavoltsPerSeconds, MegavoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, quantity07.MegavoltsPerSecond, MegavoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerSecond, quantity07.Unit); var quantity08 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MicrovoltPerHour); - AssertEx.EqualTolerance(1, quantity08.MicrovoltsPerHours, MicrovoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, quantity08.MicrovoltsPerHour, MicrovoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerHour, quantity08.Unit); var quantity09 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); - AssertEx.EqualTolerance(1, quantity09.MicrovoltsPerMicroseconds, MicrovoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, quantity09.MicrovoltsPerMicrosecond, MicrovoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond, quantity09.Unit); var quantity10 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MicrovoltPerMinute); - AssertEx.EqualTolerance(1, quantity10.MicrovoltsPerMinutes, MicrovoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity10.MicrovoltsPerMinute, MicrovoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerMinute, quantity10.Unit); var quantity11 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MicrovoltPerSecond); - AssertEx.EqualTolerance(1, quantity11.MicrovoltsPerSeconds, MicrovoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, quantity11.MicrovoltsPerSecond, MicrovoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerSecond, quantity11.Unit); var quantity12 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MillivoltPerHour); - AssertEx.EqualTolerance(1, quantity12.MillivoltsPerHours, MillivoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, quantity12.MillivoltsPerHour, MillivoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerHour, quantity12.Unit); var quantity13 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); - AssertEx.EqualTolerance(1, quantity13.MillivoltsPerMicroseconds, MillivoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, quantity13.MillivoltsPerMicrosecond, MillivoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond, quantity13.Unit); var quantity14 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MillivoltPerMinute); - AssertEx.EqualTolerance(1, quantity14.MillivoltsPerMinutes, MillivoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity14.MillivoltsPerMinute, MillivoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerMinute, quantity14.Unit); var quantity15 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.MillivoltPerSecond); - AssertEx.EqualTolerance(1, quantity15.MillivoltsPerSeconds, MillivoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, quantity15.MillivoltsPerSecond, MillivoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerSecond, quantity15.Unit); var quantity16 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.VoltPerHour); - AssertEx.EqualTolerance(1, quantity16.VoltsPerHours, VoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, quantity16.VoltsPerHour, VoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerHour, quantity16.Unit); var quantity17 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.VoltPerMicrosecond); - AssertEx.EqualTolerance(1, quantity17.VoltsPerMicroseconds, VoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, quantity17.VoltsPerMicrosecond, VoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerMicrosecond, quantity17.Unit); var quantity18 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.VoltPerMinute); - AssertEx.EqualTolerance(1, quantity18.VoltsPerMinutes, VoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity18.VoltsPerMinute, VoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerMinute, quantity18.Unit); var quantity19 = ElectricPotentialChangeRate.From(1, ElectricPotentialChangeRateUnit.VoltPerSecond); - AssertEx.EqualTolerance(1, quantity19.VoltsPerSeconds, VoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, quantity19.VoltsPerSecond, VoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerSecond, quantity19.Unit); } [Fact] - public void FromVoltsPerSeconds_WithInfinityValue_ThrowsArgumentException() + public void FromVoltsPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialChangeRate.FromVoltsPerSeconds(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotentialChangeRate.FromVoltsPerSeconds(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricPotentialChangeRate.FromVoltsPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricPotentialChangeRate.FromVoltsPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltsPerSeconds_WithNanValue_ThrowsArgumentException() + public void FromVoltsPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialChangeRate.FromVoltsPerSeconds(double.NaN)); + var exception = Record.Exception(() => ElectricPotentialChangeRate.FromVoltsPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] public void As() { - var voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); - AssertEx.EqualTolerance(KilovoltsPerHoursInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerHour), KilovoltsPerHoursTolerance); - AssertEx.EqualTolerance(KilovoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond), KilovoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(KilovoltsPerMinutesInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerMinute), KilovoltsPerMinutesTolerance); - AssertEx.EqualTolerance(KilovoltsPerSecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerSecond), KilovoltsPerSecondsTolerance); - AssertEx.EqualTolerance(MegavoltsPerHoursInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerHour), MegavoltsPerHoursTolerance); - AssertEx.EqualTolerance(MegavoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond), MegavoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(MegavoltsPerMinutesInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerMinute), MegavoltsPerMinutesTolerance); - AssertEx.EqualTolerance(MegavoltsPerSecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerSecond), MegavoltsPerSecondsTolerance); - AssertEx.EqualTolerance(MicrovoltsPerHoursInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerHour), MicrovoltsPerHoursTolerance); - AssertEx.EqualTolerance(MicrovoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond), MicrovoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(MicrovoltsPerMinutesInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerMinute), MicrovoltsPerMinutesTolerance); - AssertEx.EqualTolerance(MicrovoltsPerSecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerSecond), MicrovoltsPerSecondsTolerance); - AssertEx.EqualTolerance(MillivoltsPerHoursInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerHour), MillivoltsPerHoursTolerance); - AssertEx.EqualTolerance(MillivoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond), MillivoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(MillivoltsPerMinutesInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerMinute), MillivoltsPerMinutesTolerance); - AssertEx.EqualTolerance(MillivoltsPerSecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerSecond), MillivoltsPerSecondsTolerance); - AssertEx.EqualTolerance(VoltsPerHoursInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerHour), VoltsPerHoursTolerance); - AssertEx.EqualTolerance(VoltsPerMicrosecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerMicrosecond), VoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(VoltsPerMinutesInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerMinute), VoltsPerMinutesTolerance); - AssertEx.EqualTolerance(VoltsPerSecondsInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerSecond), VoltsPerSecondsTolerance); + var voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); + AssertEx.EqualTolerance(KilovoltsPerHourInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerHour), KilovoltsPerHourTolerance); + AssertEx.EqualTolerance(KilovoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond), KilovoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(KilovoltsPerMinuteInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerMinute), KilovoltsPerMinuteTolerance); + AssertEx.EqualTolerance(KilovoltsPerSecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.KilovoltPerSecond), KilovoltsPerSecondTolerance); + AssertEx.EqualTolerance(MegavoltsPerHourInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerHour), MegavoltsPerHourTolerance); + AssertEx.EqualTolerance(MegavoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond), MegavoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(MegavoltsPerMinuteInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerMinute), MegavoltsPerMinuteTolerance); + AssertEx.EqualTolerance(MegavoltsPerSecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MegavoltPerSecond), MegavoltsPerSecondTolerance); + AssertEx.EqualTolerance(MicrovoltsPerHourInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerHour), MicrovoltsPerHourTolerance); + AssertEx.EqualTolerance(MicrovoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond), MicrovoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(MicrovoltsPerMinuteInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerMinute), MicrovoltsPerMinuteTolerance); + AssertEx.EqualTolerance(MicrovoltsPerSecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MicrovoltPerSecond), MicrovoltsPerSecondTolerance); + AssertEx.EqualTolerance(MillivoltsPerHourInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerHour), MillivoltsPerHourTolerance); + AssertEx.EqualTolerance(MillivoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond), MillivoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(MillivoltsPerMinuteInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerMinute), MillivoltsPerMinuteTolerance); + AssertEx.EqualTolerance(MillivoltsPerSecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.MillivoltPerSecond), MillivoltsPerSecondTolerance); + AssertEx.EqualTolerance(VoltsPerHourInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerHour), VoltsPerHourTolerance); + AssertEx.EqualTolerance(VoltsPerMicrosecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerMicrosecond), VoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(VoltsPerMinuteInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerMinute), VoltsPerMinuteTolerance); + AssertEx.EqualTolerance(VoltsPerSecondInOneVoltPerSecond, voltpersecond.As(ElectricPotentialChangeRateUnit.VoltPerSecond), VoltsPerSecondTolerance); } [Fact] @@ -363,140 +373,140 @@ public void Parse() try { var parsed = ElectricPotentialChangeRate.Parse("1 kV/h", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerHours, KilovoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerHour, KilovoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerHour, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 kV/μs", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerMicroseconds, KilovoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerMicrosecond, KilovoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 kV/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerMinutes, KilovoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerMinute, KilovoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 kV/s", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerSeconds, KilovoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerSecond, KilovoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerSecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 MV/h", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MegavoltsPerHours, MegavoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.MegavoltsPerHour, MegavoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerHour, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 MV/μs", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MegavoltsPerMicroseconds, MegavoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MegavoltsPerMicrosecond, MegavoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 MV/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MegavoltsPerMinutes, MegavoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MegavoltsPerMinute, MegavoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 MV/s", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MegavoltsPerSeconds, MegavoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MegavoltsPerSecond, MegavoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MegavoltPerSecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 µV/h", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerHours, MicrovoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerHour, MicrovoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerHour, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 µV/μs", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMicroseconds, MicrovoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMicrosecond, MicrovoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 µV/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMinutes, MicrovoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMinute, MicrovoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 µV/s", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerSeconds, MicrovoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerSecond, MicrovoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerSecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 mV/h", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MillivoltsPerHours, MillivoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.MillivoltsPerHour, MillivoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerHour, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 mV/μs", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MillivoltsPerMicroseconds, MillivoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MillivoltsPerMicrosecond, MillivoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 mV/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MillivoltsPerMinutes, MillivoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MillivoltsPerMinute, MillivoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 mV/s", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MillivoltsPerSeconds, MillivoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MillivoltsPerSecond, MillivoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MillivoltPerSecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 V/h", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.VoltsPerHours, VoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerHour, VoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerHour, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 V/μs", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.VoltsPerMicroseconds, VoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerMicrosecond, VoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerMicrosecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 V/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.VoltsPerMinutes, VoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerMinute, VoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = ElectricPotentialChangeRate.Parse("1 V/s", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.VoltsPerSeconds, VoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerSecond, VoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerSecond, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -507,73 +517,73 @@ public void TryParse() { { Assert.True(ElectricPotentialChangeRate.TryParse("1 kV/h", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerHours, KilovoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerHour, KilovoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerHour, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 kV/μs", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerMicroseconds, KilovoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerMicrosecond, KilovoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 kV/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerMinutes, KilovoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerMinute, KilovoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerMinute, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 kV/s", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.KilovoltsPerSeconds, KilovoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.KilovoltsPerSecond, KilovoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.KilovoltPerSecond, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 µV/h", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerHours, MicrovoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerHour, MicrovoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerHour, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 µV/μs", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMicroseconds, MicrovoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMicrosecond, MicrovoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 µV/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMinutes, MicrovoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerMinute, MicrovoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerMinute, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 µV/s", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MicrovoltsPerSeconds, MicrovoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.MicrovoltsPerSecond, MicrovoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.MicrovoltPerSecond, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 V/h", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.VoltsPerHours, VoltsPerHoursTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerHour, VoltsPerHourTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerHour, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 V/μs", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.VoltsPerMicroseconds, VoltsPerMicrosecondsTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerMicrosecond, VoltsPerMicrosecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerMicrosecond, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 V/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.VoltsPerMinutes, VoltsPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerMinute, VoltsPerMinuteTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerMinute, parsed.Unit); } { Assert.True(ElectricPotentialChangeRate.TryParse("1 V/s", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.VoltsPerSeconds, VoltsPerSecondsTolerance); + AssertEx.EqualTolerance(1, parsed.VoltsPerSecond, VoltsPerSecondTolerance); Assert.Equal(ElectricPotentialChangeRateUnit.VoltPerSecond, parsed.Unit); } @@ -814,63 +824,63 @@ public virtual void ToUnit_FromDefaultQuantity_ReturnsQuantityWithGivenUnit(Elec [Fact] public void ConversionRoundTrip() { - ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerHours(voltpersecond.KilovoltsPerHours).VoltsPerSeconds, KilovoltsPerHoursTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerMicroseconds(voltpersecond.KilovoltsPerMicroseconds).VoltsPerSeconds, KilovoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerMinutes(voltpersecond.KilovoltsPerMinutes).VoltsPerSeconds, KilovoltsPerMinutesTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerSeconds(voltpersecond.KilovoltsPerSeconds).VoltsPerSeconds, KilovoltsPerSecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerHours(voltpersecond.MegavoltsPerHours).VoltsPerSeconds, MegavoltsPerHoursTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerMicroseconds(voltpersecond.MegavoltsPerMicroseconds).VoltsPerSeconds, MegavoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerMinutes(voltpersecond.MegavoltsPerMinutes).VoltsPerSeconds, MegavoltsPerMinutesTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerSeconds(voltpersecond.MegavoltsPerSeconds).VoltsPerSeconds, MegavoltsPerSecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerHours(voltpersecond.MicrovoltsPerHours).VoltsPerSeconds, MicrovoltsPerHoursTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerMicroseconds(voltpersecond.MicrovoltsPerMicroseconds).VoltsPerSeconds, MicrovoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerMinutes(voltpersecond.MicrovoltsPerMinutes).VoltsPerSeconds, MicrovoltsPerMinutesTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerSeconds(voltpersecond.MicrovoltsPerSeconds).VoltsPerSeconds, MicrovoltsPerSecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerHours(voltpersecond.MillivoltsPerHours).VoltsPerSeconds, MillivoltsPerHoursTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerMicroseconds(voltpersecond.MillivoltsPerMicroseconds).VoltsPerSeconds, MillivoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerMinutes(voltpersecond.MillivoltsPerMinutes).VoltsPerSeconds, MillivoltsPerMinutesTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerSeconds(voltpersecond.MillivoltsPerSeconds).VoltsPerSeconds, MillivoltsPerSecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerHours(voltpersecond.VoltsPerHours).VoltsPerSeconds, VoltsPerHoursTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerMicroseconds(voltpersecond.VoltsPerMicroseconds).VoltsPerSeconds, VoltsPerMicrosecondsTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerMinutes(voltpersecond.VoltsPerMinutes).VoltsPerSeconds, VoltsPerMinutesTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerSeconds(voltpersecond.VoltsPerSeconds).VoltsPerSeconds, VoltsPerSecondsTolerance); + ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerHour(voltpersecond.KilovoltsPerHour).VoltsPerSecond, KilovoltsPerHourTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerMicrosecond(voltpersecond.KilovoltsPerMicrosecond).VoltsPerSecond, KilovoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerMinute(voltpersecond.KilovoltsPerMinute).VoltsPerSecond, KilovoltsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromKilovoltsPerSecond(voltpersecond.KilovoltsPerSecond).VoltsPerSecond, KilovoltsPerSecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerHour(voltpersecond.MegavoltsPerHour).VoltsPerSecond, MegavoltsPerHourTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerMicrosecond(voltpersecond.MegavoltsPerMicrosecond).VoltsPerSecond, MegavoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerMinute(voltpersecond.MegavoltsPerMinute).VoltsPerSecond, MegavoltsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMegavoltsPerSecond(voltpersecond.MegavoltsPerSecond).VoltsPerSecond, MegavoltsPerSecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerHour(voltpersecond.MicrovoltsPerHour).VoltsPerSecond, MicrovoltsPerHourTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerMicrosecond(voltpersecond.MicrovoltsPerMicrosecond).VoltsPerSecond, MicrovoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerMinute(voltpersecond.MicrovoltsPerMinute).VoltsPerSecond, MicrovoltsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMicrovoltsPerSecond(voltpersecond.MicrovoltsPerSecond).VoltsPerSecond, MicrovoltsPerSecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerHour(voltpersecond.MillivoltsPerHour).VoltsPerSecond, MillivoltsPerHourTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerMicrosecond(voltpersecond.MillivoltsPerMicrosecond).VoltsPerSecond, MillivoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerMinute(voltpersecond.MillivoltsPerMinute).VoltsPerSecond, MillivoltsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromMillivoltsPerSecond(voltpersecond.MillivoltsPerSecond).VoltsPerSecond, MillivoltsPerSecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerHour(voltpersecond.VoltsPerHour).VoltsPerSecond, VoltsPerHourTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerMicrosecond(voltpersecond.VoltsPerMicrosecond).VoltsPerSecond, VoltsPerMicrosecondTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerMinute(voltpersecond.VoltsPerMinute).VoltsPerSecond, VoltsPerMinuteTolerance); + AssertEx.EqualTolerance(1, ElectricPotentialChangeRate.FromVoltsPerSecond(voltpersecond.VoltsPerSecond).VoltsPerSecond, VoltsPerSecondTolerance); } [Fact] public void ArithmeticOperators() { - ElectricPotentialChangeRate v = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); - AssertEx.EqualTolerance(-1, -v.VoltsPerSeconds, VoltsPerSecondsTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialChangeRate.FromVoltsPerSeconds(3)-v).VoltsPerSeconds, VoltsPerSecondsTolerance); - AssertEx.EqualTolerance(2, (v + v).VoltsPerSeconds, VoltsPerSecondsTolerance); - AssertEx.EqualTolerance(10, (v*10).VoltsPerSeconds, VoltsPerSecondsTolerance); - AssertEx.EqualTolerance(10, (10*v).VoltsPerSeconds, VoltsPerSecondsTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialChangeRate.FromVoltsPerSeconds(10)/5).VoltsPerSeconds, VoltsPerSecondsTolerance); - AssertEx.EqualTolerance(2, ElectricPotentialChangeRate.FromVoltsPerSeconds(10)/ElectricPotentialChangeRate.FromVoltsPerSeconds(5), VoltsPerSecondsTolerance); + ElectricPotentialChangeRate v = ElectricPotentialChangeRate.FromVoltsPerSecond(1); + AssertEx.EqualTolerance(-1, -v.VoltsPerSecond, VoltsPerSecondTolerance); + AssertEx.EqualTolerance(2, (ElectricPotentialChangeRate.FromVoltsPerSecond(3)-v).VoltsPerSecond, VoltsPerSecondTolerance); + AssertEx.EqualTolerance(2, (v + v).VoltsPerSecond, VoltsPerSecondTolerance); + AssertEx.EqualTolerance(10, (v*10).VoltsPerSecond, VoltsPerSecondTolerance); + AssertEx.EqualTolerance(10, (10*v).VoltsPerSecond, VoltsPerSecondTolerance); + AssertEx.EqualTolerance(2, (ElectricPotentialChangeRate.FromVoltsPerSecond(10)/5).VoltsPerSecond, VoltsPerSecondTolerance); + AssertEx.EqualTolerance(2, ElectricPotentialChangeRate.FromVoltsPerSecond(10)/ElectricPotentialChangeRate.FromVoltsPerSecond(5), VoltsPerSecondTolerance); } [Fact] public void ComparisonOperators() { - ElectricPotentialChangeRate oneVoltPerSecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); - ElectricPotentialChangeRate twoVoltsPerSeconds = ElectricPotentialChangeRate.FromVoltsPerSeconds(2); + ElectricPotentialChangeRate oneVoltPerSecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); + ElectricPotentialChangeRate twoVoltsPerSecond = ElectricPotentialChangeRate.FromVoltsPerSecond(2); - Assert.True(oneVoltPerSecond < twoVoltsPerSeconds); - Assert.True(oneVoltPerSecond <= twoVoltsPerSeconds); - Assert.True(twoVoltsPerSeconds > oneVoltPerSecond); - Assert.True(twoVoltsPerSeconds >= oneVoltPerSecond); + Assert.True(oneVoltPerSecond < twoVoltsPerSecond); + Assert.True(oneVoltPerSecond <= twoVoltsPerSecond); + Assert.True(twoVoltsPerSecond > oneVoltPerSecond); + Assert.True(twoVoltsPerSecond >= oneVoltPerSecond); - Assert.False(oneVoltPerSecond > twoVoltsPerSeconds); - Assert.False(oneVoltPerSecond >= twoVoltsPerSeconds); - Assert.False(twoVoltsPerSeconds < oneVoltPerSecond); - Assert.False(twoVoltsPerSeconds <= oneVoltPerSecond); + Assert.False(oneVoltPerSecond > twoVoltsPerSecond); + Assert.False(oneVoltPerSecond >= twoVoltsPerSecond); + Assert.False(twoVoltsPerSecond < oneVoltPerSecond); + Assert.False(twoVoltsPerSecond <= oneVoltPerSecond); } [Fact] public void CompareToIsImplemented() { - ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); + ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); Assert.Equal(0, voltpersecond.CompareTo(voltpersecond)); Assert.True(voltpersecond.CompareTo(ElectricPotentialChangeRate.Zero) > 0); Assert.True(ElectricPotentialChangeRate.Zero.CompareTo(voltpersecond) < 0); @@ -879,14 +889,14 @@ public void CompareToIsImplemented() [Fact] public void CompareToThrowsOnTypeMismatch() { - ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); + ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); Assert.Throws(() => voltpersecond.CompareTo(new object())); } [Fact] public void CompareToThrowsOnNull() { - ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); + ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); Assert.Throws(() => voltpersecond.CompareTo(null)); } @@ -934,29 +944,29 @@ public void Equals_Null_ReturnsFalse() [Fact] public void Equals_RelativeTolerance_IsImplemented() { - var v = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); - Assert.True(v.Equals(ElectricPotentialChangeRate.FromVoltsPerSeconds(1), VoltsPerSecondsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricPotentialChangeRate.Zero, VoltsPerSecondsTolerance, ComparisonType.Relative)); + var v = ElectricPotentialChangeRate.FromVoltsPerSecond(1); + Assert.True(v.Equals(ElectricPotentialChangeRate.FromVoltsPerSecond(1), VoltsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricPotentialChangeRate.Zero, VoltsPerSecondTolerance, ComparisonType.Relative)); } [Fact] public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { - var v = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); - Assert.Throws(() => v.Equals(ElectricPotentialChangeRate.FromVoltsPerSeconds(1), -1, ComparisonType.Relative)); + var v = ElectricPotentialChangeRate.FromVoltsPerSecond(1); + Assert.Throws(() => v.Equals(ElectricPotentialChangeRate.FromVoltsPerSecond(1), -1, ComparisonType.Relative)); } [Fact] public void EqualsReturnsFalseOnTypeMismatch() { - ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); + ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); Assert.False(voltpersecond.Equals(new object())); } [Fact] public void EqualsReturnsFalseOnNull() { - ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSeconds(1); + ElectricPotentialChangeRate voltpersecond = ElectricPotentialChangeRate.FromVoltsPerSecond(1); Assert.False(voltpersecond.Equals(null)); } @@ -1070,7 +1080,7 @@ public void ToString_SFormatAndCulture_FormatsNumberWithGivenDigitsAfterRadixFor [InlineData("en-US")] public void ToString_NullFormat_DefaultsToGeneralFormat(string cultureName) { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); CultureInfo formatProvider = cultureName == null ? null : CultureInfo.GetCultureInfo(cultureName); @@ -1083,154 +1093,154 @@ public void ToString_NullFormat_DefaultsToGeneralFormat(string cultureName) [InlineData("g")] public void ToString_NullProvider_EqualsCurrentCulture(string format) { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal(quantity.ToString(format, CultureInfo.CurrentCulture), quantity.ToString(format, null)); } [Fact] public void Convert_ToBool_ThrowsInvalidCastException() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Throws(() => Convert.ToBoolean(quantity)); } [Fact] public void Convert_ToByte_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((byte)quantity.Value, Convert.ToByte(quantity)); } [Fact] public void Convert_ToChar_ThrowsInvalidCastException() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Throws(() => Convert.ToChar(quantity)); } [Fact] public void Convert_ToDateTime_ThrowsInvalidCastException() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Throws(() => Convert.ToDateTime(quantity)); } [Fact] public void Convert_ToDecimal_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); } [Fact] public void Convert_ToDouble_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((double)quantity.Value, Convert.ToDouble(quantity)); } [Fact] public void Convert_ToInt16_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity)); } [Fact] public void Convert_ToInt32_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity)); } [Fact] public void Convert_ToInt64_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((long)quantity.Value, Convert.ToInt64(quantity)); } [Fact] public void Convert_ToSByte_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((sbyte)quantity.Value, Convert.ToSByte(quantity)); } [Fact] public void Convert_ToSingle_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); } [Fact] public void Convert_ToString_EqualsToString() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); } [Fact] public void Convert_ToUInt16_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((ushort)quantity.Value, Convert.ToUInt16(quantity)); } [Fact] public void Convert_ToUInt32_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((uint)quantity.Value, Convert.ToUInt32(quantity)); } [Fact] public void Convert_ToUInt64_EqualsValueAsSameType() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); } [Fact] public void Convert_ChangeType_SelfType_EqualsSelf() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(ElectricPotentialChangeRate))); } [Fact] public void Convert_ChangeType_UnitType_EqualsUnit() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(ElectricPotentialChangeRateUnit))); } [Fact] public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal(ElectricPotentialChangeRate.Info, Convert.ChangeType(quantity, typeof(QuantityInfo))); } [Fact] public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal(ElectricPotentialChangeRate.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); } [Fact] public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Throws(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); } [Fact] public void GetHashCode_Equals() { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(1.0); Assert.Equal(new {ElectricPotentialChangeRate.Info.Name, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); } @@ -1239,8 +1249,8 @@ public void GetHashCode_Equals() [InlineData(-1.0)] public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) { - var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(value); - Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerSeconds(-value), -quantity); + var quantity = ElectricPotentialChangeRate.FromVoltsPerSecond(value); + Assert.Equal(ElectricPotentialChangeRate.FromVoltsPerSecond(-value), -quantity); } } } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs index 15669faa28..ce6513981b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs @@ -83,16 +83,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialDc(double.PositiveInfinity, ElectricPotentialDcUnit.VoltDc)); - Assert.Throws(() => new ElectricPotentialDc(double.NegativeInfinity, ElectricPotentialDcUnit.VoltDc)); + var exception1 = Record.Exception(() => new ElectricPotentialDc(double.PositiveInfinity, ElectricPotentialDcUnit.VoltDc)); + var exception2 = Record.Exception(() => new ElectricPotentialDc(double.NegativeInfinity, ElectricPotentialDcUnit.VoltDc)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotentialDc(double.NaN, ElectricPotentialDcUnit.VoltDc)); + var exception = Record.Exception(() => new ElectricPotentialDc(double.NaN, ElectricPotentialDcUnit.VoltDc)); + + Assert.Null(exception); } [Fact] @@ -167,16 +172,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVoltsDc_WithInfinityValue_ThrowsArgumentException() + public void FromVoltsDc_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricPotentialDc.FromVoltsDc(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricPotentialDc.FromVoltsDc(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltsDc_WithNanValue_ThrowsArgumentException() + public void FromVoltsDc_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NaN)); + var exception = Record.Exception(() => ElectricPotentialDc.FromVoltsDc(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs index b375ce83d4..7dc092cc39 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotential(double.PositiveInfinity, ElectricPotentialUnit.Volt)); - Assert.Throws(() => new ElectricPotential(double.NegativeInfinity, ElectricPotentialUnit.Volt)); + var exception1 = Record.Exception(() => new ElectricPotential(double.PositiveInfinity, ElectricPotentialUnit.Volt)); + var exception2 = Record.Exception(() => new ElectricPotential(double.NegativeInfinity, ElectricPotentialUnit.Volt)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricPotential(double.NaN, ElectricPotentialUnit.Volt)); + var exception = Record.Exception(() => new ElectricPotential(double.NaN, ElectricPotentialUnit.Volt)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVolts_WithInfinityValue_ThrowsArgumentException() + public void FromVolts_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotential.FromVolts(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotential.FromVolts(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricPotential.FromVolts(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricPotential.FromVolts(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVolts_WithNanValue_ThrowsArgumentException() + public void FromVolts_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricPotential.FromVolts(double.NaN)); + var exception = Record.Exception(() => ElectricPotential.FromVolts(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs index c69fe1611c..c11e686600 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs @@ -91,16 +91,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricResistance(double.PositiveInfinity, ElectricResistanceUnit.Ohm)); - Assert.Throws(() => new ElectricResistance(double.NegativeInfinity, ElectricResistanceUnit.Ohm)); + var exception1 = Record.Exception(() => new ElectricResistance(double.PositiveInfinity, ElectricResistanceUnit.Ohm)); + var exception2 = Record.Exception(() => new ElectricResistance(double.NegativeInfinity, ElectricResistanceUnit.Ohm)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricResistance(double.NaN, ElectricResistanceUnit.Ohm)); + var exception = Record.Exception(() => new ElectricResistance(double.NaN, ElectricResistanceUnit.Ohm)); + + Assert.Null(exception); } [Fact] @@ -185,16 +190,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromOhms_WithInfinityValue_ThrowsArgumentException() + public void FromOhms_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricResistance.FromOhms(double.PositiveInfinity)); - Assert.Throws(() => ElectricResistance.FromOhms(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricResistance.FromOhms(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricResistance.FromOhms(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromOhms_WithNanValue_ThrowsArgumentException() + public void FromOhms_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricResistance.FromOhms(double.NaN)); + var exception = Record.Exception(() => ElectricResistance.FromOhms(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs index 2ce41ad10e..f6b8d3931d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs @@ -119,16 +119,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricResistivity(double.PositiveInfinity, ElectricResistivityUnit.OhmMeter)); - Assert.Throws(() => new ElectricResistivity(double.NegativeInfinity, ElectricResistivityUnit.OhmMeter)); + var exception1 = Record.Exception(() => new ElectricResistivity(double.PositiveInfinity, ElectricResistivityUnit.OhmMeter)); + var exception2 = Record.Exception(() => new ElectricResistivity(double.NegativeInfinity, ElectricResistivityUnit.OhmMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricResistivity(double.NaN, ElectricResistivityUnit.OhmMeter)); + var exception = Record.Exception(() => new ElectricResistivity(double.NaN, ElectricResistivityUnit.OhmMeter)); + + Assert.Null(exception); } [Fact] @@ -248,16 +253,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromOhmMeters_WithInfinityValue_ThrowsArgumentException() + public void FromOhmMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.PositiveInfinity)); - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricResistivity.FromOhmMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricResistivity.FromOhmMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromOhmMeters_WithNanValue_ThrowsArgumentException() + public void FromOhmMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NaN)); + var exception = Record.Exception(() => ElectricResistivity.FromOhmMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs index 04af0291fe..4fe2ba0dc5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricSurfaceChargeDensity(double.PositiveInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); - Assert.Throws(() => new ElectricSurfaceChargeDensity(double.NegativeInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + var exception1 = Record.Exception(() => new ElectricSurfaceChargeDensity(double.PositiveInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + var exception2 = Record.Exception(() => new ElectricSurfaceChargeDensity(double.NegativeInfinity, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ElectricSurfaceChargeDensity(double.NaN, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + var exception = Record.Exception(() => new ElectricSurfaceChargeDensity(double.NaN, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCoulombsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromCoulombsPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCoulombsPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromCoulombsPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs index 57502ee676..8cd2c3b07c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs @@ -111,16 +111,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new EnergyDensity(double.PositiveInfinity, EnergyDensityUnit.JoulePerCubicMeter)); - Assert.Throws(() => new EnergyDensity(double.NegativeInfinity, EnergyDensityUnit.JoulePerCubicMeter)); + var exception1 = Record.Exception(() => new EnergyDensity(double.PositiveInfinity, EnergyDensityUnit.JoulePerCubicMeter)); + var exception2 = Record.Exception(() => new EnergyDensity(double.NegativeInfinity, EnergyDensityUnit.JoulePerCubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new EnergyDensity(double.NaN, EnergyDensityUnit.JoulePerCubicMeter)); + var exception = Record.Exception(() => new EnergyDensity(double.NaN, EnergyDensityUnit.JoulePerCubicMeter)); + + Assert.Null(exception); } [Fact] @@ -230,16 +235,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerCubicMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => EnergyDensity.FromJoulesPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => EnergyDensity.FromJoulesPerCubicMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => EnergyDensity.FromJoulesPerCubicMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => EnergyDensity.FromJoulesPerCubicMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerCubicMeter_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerCubicMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => EnergyDensity.FromJoulesPerCubicMeter(double.NaN)); + var exception = Record.Exception(() => EnergyDensity.FromJoulesPerCubicMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs index 5ddc7afd48..7595d23197 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs @@ -223,16 +223,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Energy(double.PositiveInfinity, EnergyUnit.Joule)); - Assert.Throws(() => new Energy(double.NegativeInfinity, EnergyUnit.Joule)); + var exception1 = Record.Exception(() => new Energy(double.PositiveInfinity, EnergyUnit.Joule)); + var exception2 = Record.Exception(() => new Energy(double.NegativeInfinity, EnergyUnit.Joule)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Energy(double.NaN, EnergyUnit.Joule)); + var exception = Record.Exception(() => new Energy(double.NaN, EnergyUnit.Joule)); + + Assert.Null(exception); } [Fact] @@ -482,16 +487,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoules_WithInfinityValue_ThrowsArgumentException() + public void FromJoules_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Energy.FromJoules(double.PositiveInfinity)); - Assert.Throws(() => Energy.FromJoules(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Energy.FromJoules(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Energy.FromJoules(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoules_WithNanValue_ThrowsArgumentException() + public void FromJoules_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Energy.FromJoules(double.NaN)); + var exception = Record.Exception(() => Energy.FromJoules(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs index 65737394af..716f46113e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs @@ -91,16 +91,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Entropy(double.PositiveInfinity, EntropyUnit.JoulePerKelvin)); - Assert.Throws(() => new Entropy(double.NegativeInfinity, EntropyUnit.JoulePerKelvin)); + var exception1 = Record.Exception(() => new Entropy(double.PositiveInfinity, EntropyUnit.JoulePerKelvin)); + var exception2 = Record.Exception(() => new Entropy(double.NegativeInfinity, EntropyUnit.JoulePerKelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Entropy(double.NaN, EntropyUnit.JoulePerKelvin)); + var exception = Record.Exception(() => new Entropy(double.NaN, EntropyUnit.JoulePerKelvin)); + + Assert.Null(exception); } [Fact] @@ -185,16 +190,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerKelvin_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerKelvin_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.PositiveInfinity)); - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Entropy.FromJoulesPerKelvin(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Entropy.FromJoulesPerKelvin(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerKelvin_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerKelvin_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NaN)); + var exception = Record.Exception(() => Entropy.FromJoulesPerKelvin(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs index 82f5a8ee3c..9fb05c1c41 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs @@ -123,16 +123,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ForceChangeRate(double.PositiveInfinity, ForceChangeRateUnit.NewtonPerSecond)); - Assert.Throws(() => new ForceChangeRate(double.NegativeInfinity, ForceChangeRateUnit.NewtonPerSecond)); + var exception1 = Record.Exception(() => new ForceChangeRate(double.PositiveInfinity, ForceChangeRateUnit.NewtonPerSecond)); + var exception2 = Record.Exception(() => new ForceChangeRate(double.NegativeInfinity, ForceChangeRateUnit.NewtonPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ForceChangeRate(double.NaN, ForceChangeRateUnit.NewtonPerSecond)); + var exception = Record.Exception(() => new ForceChangeRate(double.NaN, ForceChangeRateUnit.NewtonPerSecond)); + + Assert.Null(exception); } [Fact] @@ -257,16 +262,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonsPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonsPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ForceChangeRate.FromNewtonsPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ForceChangeRate.FromNewtonsPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonsPerSecond_WithNanValue_ThrowsArgumentException() + public void FromNewtonsPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NaN)); + var exception = Record.Exception(() => ForceChangeRate.FromNewtonsPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs index 5a75e375d3..647e0eb1fc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs @@ -215,16 +215,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ForcePerLength(double.PositiveInfinity, ForcePerLengthUnit.NewtonPerMeter)); - Assert.Throws(() => new ForcePerLength(double.NegativeInfinity, ForcePerLengthUnit.NewtonPerMeter)); + var exception1 = Record.Exception(() => new ForcePerLength(double.PositiveInfinity, ForcePerLengthUnit.NewtonPerMeter)); + var exception2 = Record.Exception(() => new ForcePerLength(double.NegativeInfinity, ForcePerLengthUnit.NewtonPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ForcePerLength(double.NaN, ForcePerLengthUnit.NewtonPerMeter)); + var exception = Record.Exception(() => new ForcePerLength(double.NaN, ForcePerLengthUnit.NewtonPerMeter)); + + Assert.Null(exception); } [Fact] @@ -464,16 +469,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonsPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonsPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ForcePerLength.FromNewtonsPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ForcePerLength.FromNewtonsPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonsPerMeter_WithNanValue_ThrowsArgumentException() + public void FromNewtonsPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NaN)); + var exception = Record.Exception(() => ForcePerLength.FromNewtonsPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs index feac3204ae..972e275bfb 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs @@ -123,16 +123,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Force(double.PositiveInfinity, ForceUnit.Newton)); - Assert.Throws(() => new Force(double.NegativeInfinity, ForceUnit.Newton)); + var exception1 = Record.Exception(() => new Force(double.PositiveInfinity, ForceUnit.Newton)); + var exception2 = Record.Exception(() => new Force(double.NegativeInfinity, ForceUnit.Newton)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Force(double.NaN, ForceUnit.Newton)); + var exception = Record.Exception(() => new Force(double.NaN, ForceUnit.Newton)); + + Assert.Null(exception); } [Fact] @@ -257,16 +262,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtons_WithInfinityValue_ThrowsArgumentException() + public void FromNewtons_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Force.FromNewtons(double.PositiveInfinity)); - Assert.Throws(() => Force.FromNewtons(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Force.FromNewtons(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Force.FromNewtons(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtons_WithNanValue_ThrowsArgumentException() + public void FromNewtons_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Force.FromNewtons(double.NaN)); + var exception = Record.Exception(() => Force.FromNewtons(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs index a68228ce0d..232ea244c9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs @@ -115,16 +115,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Frequency(double.PositiveInfinity, FrequencyUnit.Hertz)); - Assert.Throws(() => new Frequency(double.NegativeInfinity, FrequencyUnit.Hertz)); + var exception1 = Record.Exception(() => new Frequency(double.PositiveInfinity, FrequencyUnit.Hertz)); + var exception2 = Record.Exception(() => new Frequency(double.NegativeInfinity, FrequencyUnit.Hertz)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Frequency(double.NaN, FrequencyUnit.Hertz)); + var exception = Record.Exception(() => new Frequency(double.NaN, FrequencyUnit.Hertz)); + + Assert.Null(exception); } [Fact] @@ -239,16 +244,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromHertz_WithInfinityValue_ThrowsArgumentException() + public void FromHertz_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Frequency.FromHertz(double.PositiveInfinity)); - Assert.Throws(() => Frequency.FromHertz(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Frequency.FromHertz(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Frequency.FromHertz(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromHertz_WithNanValue_ThrowsArgumentException() + public void FromHertz_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Frequency.FromHertz(double.NaN)); + var exception = Record.Exception(() => Frequency.FromHertz(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs index a558e69faf..6f5a23ad6e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs @@ -38,13 +38,13 @@ namespace UnitsNet.Tests // ReSharper disable once PartialTypeWithSinglePart public abstract partial class FuelEfficiencyTestsBase : QuantityTestsBase { - protected abstract double KilometersPerLitersInOneLiterPer100Kilometers { get; } + protected abstract double KilometersPerLiterInOneLiterPer100Kilometers { get; } protected abstract double LitersPer100KilometersInOneLiterPer100Kilometers { get; } protected abstract double MilesPerUkGallonInOneLiterPer100Kilometers { get; } protected abstract double MilesPerUsGallonInOneLiterPer100Kilometers { get; } // ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilometersPerLitersTolerance { get { return 1e-5; } } + protected virtual double KilometersPerLiterTolerance { get { return 1e-5; } } protected virtual double LitersPer100KilometersTolerance { get { return 1e-5; } } protected virtual double MilesPerUkGallonTolerance { get { return 1e-5; } } protected virtual double MilesPerUsGallonTolerance { get { return 1e-5; } } @@ -54,7 +54,7 @@ public abstract partial class FuelEfficiencyTestsBase : QuantityTestsBase { return unit switch { - FuelEfficiencyUnit.KilometerPerLiter => (KilometersPerLitersInOneLiterPer100Kilometers, KilometersPerLitersTolerance), + FuelEfficiencyUnit.KilometerPerLiter => (KilometersPerLiterInOneLiterPer100Kilometers, KilometersPerLiterTolerance), FuelEfficiencyUnit.LiterPer100Kilometers => (LitersPer100KilometersInOneLiterPer100Kilometers, LitersPer100KilometersTolerance), FuelEfficiencyUnit.MilePerUkGallon => (MilesPerUkGallonInOneLiterPer100Kilometers, MilesPerUkGallonTolerance), FuelEfficiencyUnit.MilePerUsGallon => (MilesPerUsGallonInOneLiterPer100Kilometers, MilesPerUsGallonTolerance), @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new FuelEfficiency(double.PositiveInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); - Assert.Throws(() => new FuelEfficiency(double.NegativeInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); + var exception1 = Record.Exception(() => new FuelEfficiency(double.PositiveInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); + var exception2 = Record.Exception(() => new FuelEfficiency(double.NegativeInfinity, FuelEfficiencyUnit.LiterPer100Kilometers)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new FuelEfficiency(double.NaN, FuelEfficiencyUnit.LiterPer100Kilometers)); + var exception = Record.Exception(() => new FuelEfficiency(double.NaN, FuelEfficiencyUnit.LiterPer100Kilometers)); + + Assert.Null(exception); } [Fact] @@ -130,7 +135,7 @@ public void FuelEfficiency_QuantityInfo_ReturnsQuantityInfoDescribingQuantity() public void LiterPer100KilometersToFuelEfficiencyUnits() { FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); - AssertEx.EqualTolerance(KilometersPerLitersInOneLiterPer100Kilometers, literper100kilometers.KilometersPerLiters, KilometersPerLitersTolerance); + AssertEx.EqualTolerance(KilometersPerLiterInOneLiterPer100Kilometers, literper100kilometers.KilometersPerLiter, KilometersPerLiterTolerance); AssertEx.EqualTolerance(LitersPer100KilometersInOneLiterPer100Kilometers, literper100kilometers.LitersPer100Kilometers, LitersPer100KilometersTolerance); AssertEx.EqualTolerance(MilesPerUkGallonInOneLiterPer100Kilometers, literper100kilometers.MilesPerUkGallon, MilesPerUkGallonTolerance); AssertEx.EqualTolerance(MilesPerUsGallonInOneLiterPer100Kilometers, literper100kilometers.MilesPerUsGallon, MilesPerUsGallonTolerance); @@ -140,7 +145,7 @@ public void LiterPer100KilometersToFuelEfficiencyUnits() public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() { var quantity00 = FuelEfficiency.From(1, FuelEfficiencyUnit.KilometerPerLiter); - AssertEx.EqualTolerance(1, quantity00.KilometersPerLiters, KilometersPerLitersTolerance); + AssertEx.EqualTolerance(1, quantity00.KilometersPerLiter, KilometersPerLiterTolerance); Assert.Equal(FuelEfficiencyUnit.KilometerPerLiter, quantity00.Unit); var quantity01 = FuelEfficiency.From(1, FuelEfficiencyUnit.LiterPer100Kilometers); @@ -158,23 +163,28 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromLitersPer100Kilometers_WithInfinityValue_ThrowsArgumentException() + public void FromLitersPer100Kilometers_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.PositiveInfinity)); - Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.NegativeInfinity)); + var exception1 = Record.Exception(() => FuelEfficiency.FromLitersPer100Kilometers(double.PositiveInfinity)); + var exception2 = Record.Exception(() => FuelEfficiency.FromLitersPer100Kilometers(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromLitersPer100Kilometers_WithNanValue_ThrowsArgumentException() + public void FromLitersPer100Kilometers_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => FuelEfficiency.FromLitersPer100Kilometers(double.NaN)); + var exception = Record.Exception(() => FuelEfficiency.FromLitersPer100Kilometers(double.NaN)); + + Assert.Null(exception); } [Fact] public void As() { var literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); - AssertEx.EqualTolerance(KilometersPerLitersInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.KilometerPerLiter), KilometersPerLitersTolerance); + AssertEx.EqualTolerance(KilometersPerLiterInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.KilometerPerLiter), KilometersPerLiterTolerance); AssertEx.EqualTolerance(LitersPer100KilometersInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.LiterPer100Kilometers), LitersPer100KilometersTolerance); AssertEx.EqualTolerance(MilesPerUkGallonInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.MilePerUkGallon), MilesPerUkGallonTolerance); AssertEx.EqualTolerance(MilesPerUsGallonInOneLiterPer100Kilometers, literper100kilometers.As(FuelEfficiencyUnit.MilePerUsGallon), MilesPerUsGallonTolerance); @@ -203,7 +213,7 @@ public void Parse() try { var parsed = FuelEfficiency.Parse("1 km/L", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.KilometersPerLiters, KilometersPerLitersTolerance); + AssertEx.EqualTolerance(1, parsed.KilometersPerLiter, KilometersPerLiterTolerance); Assert.Equal(FuelEfficiencyUnit.KilometerPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -235,7 +245,7 @@ public void TryParse() { { Assert.True(FuelEfficiency.TryParse("1 km/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.KilometersPerLiters, KilometersPerLitersTolerance); + AssertEx.EqualTolerance(1, parsed.KilometersPerLiter, KilometersPerLiterTolerance); Assert.Equal(FuelEfficiencyUnit.KilometerPerLiter, parsed.Unit); } @@ -359,7 +369,7 @@ public virtual void ToUnit_FromDefaultQuantity_ReturnsQuantityWithGivenUnit(Fuel public void ConversionRoundTrip() { FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1); - AssertEx.EqualTolerance(1, FuelEfficiency.FromKilometersPerLiters(literper100kilometers.KilometersPerLiters).LitersPer100Kilometers, KilometersPerLitersTolerance); + AssertEx.EqualTolerance(1, FuelEfficiency.FromKilometersPerLiter(literper100kilometers.KilometersPerLiter).LitersPer100Kilometers, KilometersPerLiterTolerance); AssertEx.EqualTolerance(1, FuelEfficiency.FromLitersPer100Kilometers(literper100kilometers.LitersPer100Kilometers).LitersPer100Kilometers, LitersPer100KilometersTolerance); AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUkGallon(literper100kilometers.MilesPerUkGallon).LitersPer100Kilometers, MilesPerUkGallonTolerance); AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUsGallon(literper100kilometers.MilesPerUsGallon).LitersPer100Kilometers, MilesPerUsGallonTolerance); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs index 0f653e5ceb..c4c41efbf5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs @@ -135,16 +135,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new HeatFlux(double.PositiveInfinity, HeatFluxUnit.WattPerSquareMeter)); - Assert.Throws(() => new HeatFlux(double.NegativeInfinity, HeatFluxUnit.WattPerSquareMeter)); + var exception1 = Record.Exception(() => new HeatFlux(double.PositiveInfinity, HeatFluxUnit.WattPerSquareMeter)); + var exception2 = Record.Exception(() => new HeatFlux(double.NegativeInfinity, HeatFluxUnit.WattPerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new HeatFlux(double.NaN, HeatFluxUnit.WattPerSquareMeter)); + var exception = Record.Exception(() => new HeatFlux(double.NaN, HeatFluxUnit.WattPerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -284,16 +289,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromWattsPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromWattsPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs index 6ff8538e11..8722aac635 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new HeatTransferCoefficient(double.PositiveInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); - Assert.Throws(() => new HeatTransferCoefficient(double.NegativeInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + var exception1 = Record.Exception(() => new HeatTransferCoefficient(double.PositiveInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + var exception2 = Record.Exception(() => new HeatTransferCoefficient(double.NegativeInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new HeatTransferCoefficient(double.NaN, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + var exception = Record.Exception(() => new HeatTransferCoefficient(double.NaN, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWattsPerSquareMeterKelvin_WithInfinityValue_ThrowsArgumentException() + public void FromWattsPerSquareMeterKelvin_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.PositiveInfinity)); - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NegativeInfinity)); + var exception1 = Record.Exception(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.PositiveInfinity)); + var exception2 = Record.Exception(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWattsPerSquareMeterKelvin_WithNanValue_ThrowsArgumentException() + public void FromWattsPerSquareMeterKelvin_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NaN)); + var exception = Record.Exception(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs index 5bb67f139b..138a4da00d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Illuminance(double.PositiveInfinity, IlluminanceUnit.Lux)); - Assert.Throws(() => new Illuminance(double.NegativeInfinity, IlluminanceUnit.Lux)); + var exception1 = Record.Exception(() => new Illuminance(double.PositiveInfinity, IlluminanceUnit.Lux)); + var exception2 = Record.Exception(() => new Illuminance(double.NegativeInfinity, IlluminanceUnit.Lux)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Illuminance(double.NaN, IlluminanceUnit.Lux)); + var exception = Record.Exception(() => new Illuminance(double.NaN, IlluminanceUnit.Lux)); + + Assert.Null(exception); } [Fact] @@ -158,16 +163,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromLux_WithInfinityValue_ThrowsArgumentException() + public void FromLux_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Illuminance.FromLux(double.PositiveInfinity)); - Assert.Throws(() => Illuminance.FromLux(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Illuminance.FromLux(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Illuminance.FromLux(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromLux_WithNanValue_ThrowsArgumentException() + public void FromLux_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Illuminance.FromLux(double.NaN)); + var exception = Record.Exception(() => Illuminance.FromLux(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs index 5f556412e4..e01d2b3df0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs @@ -115,16 +115,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Impulse(double.PositiveInfinity, ImpulseUnit.NewtonSecond)); - Assert.Throws(() => new Impulse(double.NegativeInfinity, ImpulseUnit.NewtonSecond)); + var exception1 = Record.Exception(() => new Impulse(double.PositiveInfinity, ImpulseUnit.NewtonSecond)); + var exception2 = Record.Exception(() => new Impulse(double.NegativeInfinity, ImpulseUnit.NewtonSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Impulse(double.NaN, ImpulseUnit.NewtonSecond)); + var exception = Record.Exception(() => new Impulse(double.NaN, ImpulseUnit.NewtonSecond)); + + Assert.Null(exception); } [Fact] @@ -239,16 +244,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonSeconds_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonSeconds_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Impulse.FromNewtonSeconds(double.PositiveInfinity)); - Assert.Throws(() => Impulse.FromNewtonSeconds(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Impulse.FromNewtonSeconds(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Impulse.FromNewtonSeconds(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonSeconds_WithNanValue_ThrowsArgumentException() + public void FromNewtonSeconds_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Impulse.FromNewtonSeconds(double.NaN)); + var exception = Record.Exception(() => Impulse.FromNewtonSeconds(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs index fea1eaca85..8e586edca8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs @@ -119,16 +119,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Irradiance(double.PositiveInfinity, IrradianceUnit.WattPerSquareMeter)); - Assert.Throws(() => new Irradiance(double.NegativeInfinity, IrradianceUnit.WattPerSquareMeter)); + var exception1 = Record.Exception(() => new Irradiance(double.PositiveInfinity, IrradianceUnit.WattPerSquareMeter)); + var exception2 = Record.Exception(() => new Irradiance(double.NegativeInfinity, IrradianceUnit.WattPerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Irradiance(double.NaN, IrradianceUnit.WattPerSquareMeter)); + var exception = Record.Exception(() => new Irradiance(double.NaN, IrradianceUnit.WattPerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -248,16 +253,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromWattsPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Irradiance.FromWattsPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Irradiance.FromWattsPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromWattsPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => Irradiance.FromWattsPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs index 908b49b1f8..30024603b2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs @@ -91,16 +91,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Irradiation(double.PositiveInfinity, IrradiationUnit.JoulePerSquareMeter)); - Assert.Throws(() => new Irradiation(double.NegativeInfinity, IrradiationUnit.JoulePerSquareMeter)); + var exception1 = Record.Exception(() => new Irradiation(double.PositiveInfinity, IrradiationUnit.JoulePerSquareMeter)); + var exception2 = Record.Exception(() => new Irradiation(double.NegativeInfinity, IrradiationUnit.JoulePerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Irradiation(double.NaN, IrradiationUnit.JoulePerSquareMeter)); + var exception = Record.Exception(() => new Irradiation(double.NaN, IrradiationUnit.JoulePerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -185,16 +190,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Irradiation.FromJoulesPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Irradiation.FromJoulesPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => Irradiation.FromJoulesPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs index 21e44641e9..eb0754c789 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs @@ -107,16 +107,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Jerk(double.PositiveInfinity, JerkUnit.MeterPerSecondCubed)); - Assert.Throws(() => new Jerk(double.NegativeInfinity, JerkUnit.MeterPerSecondCubed)); + var exception1 = Record.Exception(() => new Jerk(double.PositiveInfinity, JerkUnit.MeterPerSecondCubed)); + var exception2 = Record.Exception(() => new Jerk(double.NegativeInfinity, JerkUnit.MeterPerSecondCubed)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Jerk(double.NaN, JerkUnit.MeterPerSecondCubed)); + var exception = Record.Exception(() => new Jerk(double.NaN, JerkUnit.MeterPerSecondCubed)); + + Assert.Null(exception); } [Fact] @@ -221,16 +226,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMetersPerSecondCubed_WithInfinityValue_ThrowsArgumentException() + public void FromMetersPerSecondCubed_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Jerk.FromMetersPerSecondCubed(double.PositiveInfinity)); - Assert.Throws(() => Jerk.FromMetersPerSecondCubed(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Jerk.FromMetersPerSecondCubed(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Jerk.FromMetersPerSecondCubed(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMetersPerSecondCubed_WithNanValue_ThrowsArgumentException() + public void FromMetersPerSecondCubed_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Jerk.FromMetersPerSecondCubed(double.NaN)); + var exception = Record.Exception(() => Jerk.FromMetersPerSecondCubed(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs index 129806d5c9..94b9ea9dfe 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new KinematicViscosity(double.PositiveInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); - Assert.Throws(() => new KinematicViscosity(double.NegativeInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + var exception1 = Record.Exception(() => new KinematicViscosity(double.PositiveInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + var exception2 = Record.Exception(() => new KinematicViscosity(double.NegativeInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new KinematicViscosity(double.NaN, KinematicViscosityUnit.SquareMeterPerSecond)); + var exception = Record.Exception(() => new KinematicViscosity(double.NaN, KinematicViscosityUnit.SquareMeterPerSecond)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSquareMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromSquareMetersPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => KinematicViscosity.FromSquareMetersPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => KinematicViscosity.FromSquareMetersPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSquareMetersPerSecond_WithNanValue_ThrowsArgumentException() + public void FromSquareMetersPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NaN)); + var exception = Record.Exception(() => KinematicViscosity.FromSquareMetersPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs index 16e0a8cfed..4ed4d28b79 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LeakRate(double.PositiveInfinity, LeakRateUnit.PascalCubicMeterPerSecond)); - Assert.Throws(() => new LeakRate(double.NegativeInfinity, LeakRateUnit.PascalCubicMeterPerSecond)); + var exception1 = Record.Exception(() => new LeakRate(double.PositiveInfinity, LeakRateUnit.PascalCubicMeterPerSecond)); + var exception2 = Record.Exception(() => new LeakRate(double.NegativeInfinity, LeakRateUnit.PascalCubicMeterPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LeakRate(double.NaN, LeakRateUnit.PascalCubicMeterPerSecond)); + var exception = Record.Exception(() => new LeakRate(double.NaN, LeakRateUnit.PascalCubicMeterPerSecond)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromPascalCubicMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromPascalCubicMetersPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LeakRate.FromPascalCubicMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => LeakRate.FromPascalCubicMetersPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => LeakRate.FromPascalCubicMetersPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => LeakRate.FromPascalCubicMetersPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromPascalCubicMetersPerSecond_WithNanValue_ThrowsArgumentException() + public void FromPascalCubicMetersPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LeakRate.FromPascalCubicMetersPerSecond(double.NaN)); + var exception = Record.Exception(() => LeakRate.FromPascalCubicMetersPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs index 2d9be6f4db..606906809e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs @@ -231,16 +231,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Length(double.PositiveInfinity, LengthUnit.Meter)); - Assert.Throws(() => new Length(double.NegativeInfinity, LengthUnit.Meter)); + var exception1 = Record.Exception(() => new Length(double.PositiveInfinity, LengthUnit.Meter)); + var exception2 = Record.Exception(() => new Length(double.NegativeInfinity, LengthUnit.Meter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Length(double.NaN, LengthUnit.Meter)); + var exception = Record.Exception(() => new Length(double.NaN, LengthUnit.Meter)); + + Assert.Null(exception); } [Fact] @@ -500,16 +505,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMeters_WithInfinityValue_ThrowsArgumentException() + public void FromMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Length.FromMeters(double.PositiveInfinity)); - Assert.Throws(() => Length.FromMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Length.FromMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Length.FromMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMeters_WithNanValue_ThrowsArgumentException() + public void FromMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Length.FromMeters(double.NaN)); + var exception = Record.Exception(() => Length.FromMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs index 0118d7d382..e66e811785 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs @@ -71,16 +71,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Level(double.PositiveInfinity, LevelUnit.Decibel)); - Assert.Throws(() => new Level(double.NegativeInfinity, LevelUnit.Decibel)); + var exception1 = Record.Exception(() => new Level(double.PositiveInfinity, LevelUnit.Decibel)); + var exception2 = Record.Exception(() => new Level(double.NegativeInfinity, LevelUnit.Decibel)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Level(double.NaN, LevelUnit.Decibel)); + var exception = Record.Exception(() => new Level(double.NaN, LevelUnit.Decibel)); + + Assert.Null(exception); } [Fact] @@ -140,16 +145,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDecibels_WithInfinityValue_ThrowsArgumentException() + public void FromDecibels_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Level.FromDecibels(double.PositiveInfinity)); - Assert.Throws(() => Level.FromDecibels(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Level.FromDecibels(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Level.FromDecibels(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDecibels_WithNanValue_ThrowsArgumentException() + public void FromDecibels_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Level.FromDecibels(double.NaN)); + var exception = Record.Exception(() => Level.FromDecibels(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs index 7611aa928b..ee4d74de2e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs @@ -119,16 +119,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LinearDensity(double.PositiveInfinity, LinearDensityUnit.KilogramPerMeter)); - Assert.Throws(() => new LinearDensity(double.NegativeInfinity, LinearDensityUnit.KilogramPerMeter)); + var exception1 = Record.Exception(() => new LinearDensity(double.PositiveInfinity, LinearDensityUnit.KilogramPerMeter)); + var exception2 = Record.Exception(() => new LinearDensity(double.NegativeInfinity, LinearDensityUnit.KilogramPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LinearDensity(double.NaN, LinearDensityUnit.KilogramPerMeter)); + var exception = Record.Exception(() => new LinearDensity(double.NaN, LinearDensityUnit.KilogramPerMeter)); + + Assert.Null(exception); } [Fact] @@ -248,16 +253,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramsPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramsPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => LinearDensity.FromKilogramsPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => LinearDensity.FromKilogramsPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramsPerMeter_WithNanValue_ThrowsArgumentException() + public void FromKilogramsPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NaN)); + var exception = Record.Exception(() => LinearDensity.FromKilogramsPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs index e052b5c169..285ea7d869 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs @@ -163,16 +163,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LinearPowerDensity(double.PositiveInfinity, LinearPowerDensityUnit.WattPerMeter)); - Assert.Throws(() => new LinearPowerDensity(double.NegativeInfinity, LinearPowerDensityUnit.WattPerMeter)); + var exception1 = Record.Exception(() => new LinearPowerDensity(double.PositiveInfinity, LinearPowerDensityUnit.WattPerMeter)); + var exception2 = Record.Exception(() => new LinearPowerDensity(double.NegativeInfinity, LinearPowerDensityUnit.WattPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LinearPowerDensity(double.NaN, LinearPowerDensityUnit.WattPerMeter)); + var exception = Record.Exception(() => new LinearPowerDensity(double.NaN, LinearPowerDensityUnit.WattPerMeter)); + + Assert.Null(exception); } [Fact] @@ -347,16 +352,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWattsPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromWattsPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LinearPowerDensity.FromWattsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => LinearPowerDensity.FromWattsPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => LinearPowerDensity.FromWattsPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => LinearPowerDensity.FromWattsPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWattsPerMeter_WithNanValue_ThrowsArgumentException() + public void FromWattsPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LinearPowerDensity.FromWattsPerMeter(double.NaN)); + var exception = Record.Exception(() => LinearPowerDensity.FromWattsPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs index 56d125c861..f2012f80ec 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs @@ -103,16 +103,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Luminance(double.PositiveInfinity, LuminanceUnit.CandelaPerSquareMeter)); - Assert.Throws(() => new Luminance(double.NegativeInfinity, LuminanceUnit.CandelaPerSquareMeter)); + var exception1 = Record.Exception(() => new Luminance(double.PositiveInfinity, LuminanceUnit.CandelaPerSquareMeter)); + var exception2 = Record.Exception(() => new Luminance(double.NegativeInfinity, LuminanceUnit.CandelaPerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Luminance(double.NaN, LuminanceUnit.CandelaPerSquareMeter)); + var exception = Record.Exception(() => new Luminance(double.NaN, LuminanceUnit.CandelaPerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -212,16 +217,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCandelasPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromCandelasPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Luminance.FromCandelasPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => Luminance.FromCandelasPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Luminance.FromCandelasPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Luminance.FromCandelasPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCandelasPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromCandelasPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Luminance.FromCandelasPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => Luminance.FromCandelasPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs index f89aaf41e9..01acc81210 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs @@ -119,16 +119,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Luminosity(double.PositiveInfinity, LuminosityUnit.Watt)); - Assert.Throws(() => new Luminosity(double.NegativeInfinity, LuminosityUnit.Watt)); + var exception1 = Record.Exception(() => new Luminosity(double.PositiveInfinity, LuminosityUnit.Watt)); + var exception2 = Record.Exception(() => new Luminosity(double.NegativeInfinity, LuminosityUnit.Watt)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Luminosity(double.NaN, LuminosityUnit.Watt)); + var exception = Record.Exception(() => new Luminosity(double.NaN, LuminosityUnit.Watt)); + + Assert.Null(exception); } [Fact] @@ -248,16 +253,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWatts_WithInfinityValue_ThrowsArgumentException() + public void FromWatts_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Luminosity.FromWatts(double.PositiveInfinity)); - Assert.Throws(() => Luminosity.FromWatts(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Luminosity.FromWatts(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Luminosity.FromWatts(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWatts_WithNanValue_ThrowsArgumentException() + public void FromWatts_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Luminosity.FromWatts(double.NaN)); + var exception = Record.Exception(() => Luminosity.FromWatts(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs index 94f4eda89e..c9847200e8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LuminousFlux(double.PositiveInfinity, LuminousFluxUnit.Lumen)); - Assert.Throws(() => new LuminousFlux(double.NegativeInfinity, LuminousFluxUnit.Lumen)); + var exception1 = Record.Exception(() => new LuminousFlux(double.PositiveInfinity, LuminousFluxUnit.Lumen)); + var exception2 = Record.Exception(() => new LuminousFlux(double.NegativeInfinity, LuminousFluxUnit.Lumen)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LuminousFlux(double.NaN, LuminousFluxUnit.Lumen)); + var exception = Record.Exception(() => new LuminousFlux(double.NaN, LuminousFluxUnit.Lumen)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromLumens_WithInfinityValue_ThrowsArgumentException() + public void FromLumens_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LuminousFlux.FromLumens(double.PositiveInfinity)); - Assert.Throws(() => LuminousFlux.FromLumens(double.NegativeInfinity)); + var exception1 = Record.Exception(() => LuminousFlux.FromLumens(double.PositiveInfinity)); + var exception2 = Record.Exception(() => LuminousFlux.FromLumens(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromLumens_WithNanValue_ThrowsArgumentException() + public void FromLumens_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LuminousFlux.FromLumens(double.NaN)); + var exception = Record.Exception(() => LuminousFlux.FromLumens(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs index 401981527c..b2411776e3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LuminousIntensity(double.PositiveInfinity, LuminousIntensityUnit.Candela)); - Assert.Throws(() => new LuminousIntensity(double.NegativeInfinity, LuminousIntensityUnit.Candela)); + var exception1 = Record.Exception(() => new LuminousIntensity(double.PositiveInfinity, LuminousIntensityUnit.Candela)); + var exception2 = Record.Exception(() => new LuminousIntensity(double.NegativeInfinity, LuminousIntensityUnit.Candela)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new LuminousIntensity(double.NaN, LuminousIntensityUnit.Candela)); + var exception = Record.Exception(() => new LuminousIntensity(double.NaN, LuminousIntensityUnit.Candela)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCandela_WithInfinityValue_ThrowsArgumentException() + public void FromCandela_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LuminousIntensity.FromCandela(double.PositiveInfinity)); - Assert.Throws(() => LuminousIntensity.FromCandela(double.NegativeInfinity)); + var exception1 = Record.Exception(() => LuminousIntensity.FromCandela(double.PositiveInfinity)); + var exception2 = Record.Exception(() => LuminousIntensity.FromCandela(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCandela_WithNanValue_ThrowsArgumentException() + public void FromCandela_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => LuminousIntensity.FromCandela(double.NaN)); + var exception = Record.Exception(() => LuminousIntensity.FromCandela(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs index 6838b70523..8b2c6dbe4a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MagneticField(double.PositiveInfinity, MagneticFieldUnit.Tesla)); - Assert.Throws(() => new MagneticField(double.NegativeInfinity, MagneticFieldUnit.Tesla)); + var exception1 = Record.Exception(() => new MagneticField(double.PositiveInfinity, MagneticFieldUnit.Tesla)); + var exception2 = Record.Exception(() => new MagneticField(double.NegativeInfinity, MagneticFieldUnit.Tesla)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MagneticField(double.NaN, MagneticFieldUnit.Tesla)); + var exception = Record.Exception(() => new MagneticField(double.NaN, MagneticFieldUnit.Tesla)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromTeslas_WithInfinityValue_ThrowsArgumentException() + public void FromTeslas_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MagneticField.FromTeslas(double.PositiveInfinity)); - Assert.Throws(() => MagneticField.FromTeslas(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MagneticField.FromTeslas(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MagneticField.FromTeslas(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromTeslas_WithNanValue_ThrowsArgumentException() + public void FromTeslas_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MagneticField.FromTeslas(double.NaN)); + var exception = Record.Exception(() => MagneticField.FromTeslas(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs index 9e109a9d60..7fb6fe4167 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MagneticFlux(double.PositiveInfinity, MagneticFluxUnit.Weber)); - Assert.Throws(() => new MagneticFlux(double.NegativeInfinity, MagneticFluxUnit.Weber)); + var exception1 = Record.Exception(() => new MagneticFlux(double.PositiveInfinity, MagneticFluxUnit.Weber)); + var exception2 = Record.Exception(() => new MagneticFlux(double.NegativeInfinity, MagneticFluxUnit.Weber)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MagneticFlux(double.NaN, MagneticFluxUnit.Weber)); + var exception = Record.Exception(() => new MagneticFlux(double.NaN, MagneticFluxUnit.Weber)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWebers_WithInfinityValue_ThrowsArgumentException() + public void FromWebers_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MagneticFlux.FromWebers(double.PositiveInfinity)); - Assert.Throws(() => MagneticFlux.FromWebers(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MagneticFlux.FromWebers(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MagneticFlux.FromWebers(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWebers_WithNanValue_ThrowsArgumentException() + public void FromWebers_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MagneticFlux.FromWebers(double.NaN)); + var exception = Record.Exception(() => MagneticFlux.FromWebers(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs index 43935193f2..899ef4b52f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Magnetization(double.PositiveInfinity, MagnetizationUnit.AmperePerMeter)); - Assert.Throws(() => new Magnetization(double.NegativeInfinity, MagnetizationUnit.AmperePerMeter)); + var exception1 = Record.Exception(() => new Magnetization(double.PositiveInfinity, MagnetizationUnit.AmperePerMeter)); + var exception2 = Record.Exception(() => new Magnetization(double.NegativeInfinity, MagnetizationUnit.AmperePerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Magnetization(double.NaN, MagnetizationUnit.AmperePerMeter)); + var exception = Record.Exception(() => new Magnetization(double.NaN, MagnetizationUnit.AmperePerMeter)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromAmperesPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromAmperesPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromAmperesPerMeter_WithNanValue_ThrowsArgumentException() + public void FromAmperesPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NaN)); + var exception = Record.Exception(() => Magnetization.FromAmperesPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs index ad27b46c09..f36a2637fc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs @@ -259,16 +259,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassConcentration(double.PositiveInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); - Assert.Throws(() => new MassConcentration(double.NegativeInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); + var exception1 = Record.Exception(() => new MassConcentration(double.PositiveInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); + var exception2 = Record.Exception(() => new MassConcentration(double.NegativeInfinity, MassConcentrationUnit.KilogramPerCubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassConcentration(double.NaN, MassConcentrationUnit.KilogramPerCubicMeter)); + var exception = Record.Exception(() => new MassConcentration(double.NaN, MassConcentrationUnit.KilogramPerCubicMeter)); + + Assert.Null(exception); } [Fact] @@ -563,16 +568,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramsPerCubicMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MassConcentration.FromKilogramsPerCubicMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MassConcentration.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramsPerCubicMeter_WithNanValue_ThrowsArgumentException() + public void FromKilogramsPerCubicMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassConcentration.FromKilogramsPerCubicMeter(double.NaN)); + var exception = Record.Exception(() => MassConcentration.FromKilogramsPerCubicMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs index 6351cb648d..2670fd3bda 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs @@ -195,16 +195,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassFlow(double.PositiveInfinity, MassFlowUnit.GramPerSecond)); - Assert.Throws(() => new MassFlow(double.NegativeInfinity, MassFlowUnit.GramPerSecond)); + var exception1 = Record.Exception(() => new MassFlow(double.PositiveInfinity, MassFlowUnit.GramPerSecond)); + var exception2 = Record.Exception(() => new MassFlow(double.NegativeInfinity, MassFlowUnit.GramPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassFlow(double.NaN, MassFlowUnit.GramPerSecond)); + var exception = Record.Exception(() => new MassFlow(double.NaN, MassFlowUnit.GramPerSecond)); + + Assert.Null(exception); } [Fact] @@ -419,16 +424,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromGramsPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromGramsPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MassFlow.FromGramsPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MassFlow.FromGramsPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromGramsPerSecond_WithNanValue_ThrowsArgumentException() + public void FromGramsPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NaN)); + var exception = Record.Exception(() => MassFlow.FromGramsPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs index eab6d4618d..a34f26945f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs @@ -111,16 +111,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassFlux(double.PositiveInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); - Assert.Throws(() => new MassFlux(double.NegativeInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + var exception1 = Record.Exception(() => new MassFlux(double.PositiveInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + var exception2 = Record.Exception(() => new MassFlux(double.NegativeInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassFlux(double.NaN, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + var exception = Record.Exception(() => new MassFlux(double.NaN, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -230,16 +235,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramsPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramsPerSecondPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramsPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromKilogramsPerSecondPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs index 814eead319..03abfe59ac 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs @@ -159,16 +159,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassFraction(double.PositiveInfinity, MassFractionUnit.DecimalFraction)); - Assert.Throws(() => new MassFraction(double.NegativeInfinity, MassFractionUnit.DecimalFraction)); + var exception1 = Record.Exception(() => new MassFraction(double.PositiveInfinity, MassFractionUnit.DecimalFraction)); + var exception2 = Record.Exception(() => new MassFraction(double.NegativeInfinity, MassFractionUnit.DecimalFraction)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassFraction(double.NaN, MassFractionUnit.DecimalFraction)); + var exception = Record.Exception(() => new MassFraction(double.NaN, MassFractionUnit.DecimalFraction)); + + Assert.Null(exception); } [Fact] @@ -338,16 +343,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() + public void FromDecimalFractions_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassFraction.FromDecimalFractions(double.PositiveInfinity)); - Assert.Throws(() => MassFraction.FromDecimalFractions(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MassFraction.FromDecimalFractions(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MassFraction.FromDecimalFractions(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() + public void FromDecimalFractions_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassFraction.FromDecimalFractions(double.NaN)); + var exception = Record.Exception(() => MassFraction.FromDecimalFractions(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs index 6ed4f77b07..87da68ae89 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs @@ -175,16 +175,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassMomentOfInertia(double.PositiveInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); - Assert.Throws(() => new MassMomentOfInertia(double.NegativeInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + var exception1 = Record.Exception(() => new MassMomentOfInertia(double.PositiveInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + var exception2 = Record.Exception(() => new MassMomentOfInertia(double.NegativeInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MassMomentOfInertia(double.NaN, MassMomentOfInertiaUnit.KilogramSquareMeter)); + var exception = Record.Exception(() => new MassMomentOfInertia(double.NaN, MassMomentOfInertiaUnit.KilogramSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -374,16 +379,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramSquareMeters_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramSquareMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MassMomentOfInertia.FromKilogramSquareMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramSquareMeters_WithNanValue_ThrowsArgumentException() + public void FromKilogramSquareMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NaN)); + var exception = Record.Exception(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs index 7307a896ba..2759b9b0bd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs @@ -171,16 +171,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Mass(double.PositiveInfinity, MassUnit.Kilogram)); - Assert.Throws(() => new Mass(double.NegativeInfinity, MassUnit.Kilogram)); + var exception1 = Record.Exception(() => new Mass(double.PositiveInfinity, MassUnit.Kilogram)); + var exception2 = Record.Exception(() => new Mass(double.NegativeInfinity, MassUnit.Kilogram)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Mass(double.NaN, MassUnit.Kilogram)); + var exception = Record.Exception(() => new Mass(double.NaN, MassUnit.Kilogram)); + + Assert.Null(exception); } [Fact] @@ -365,16 +370,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilograms_WithInfinityValue_ThrowsArgumentException() + public void FromKilograms_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Mass.FromKilograms(double.PositiveInfinity)); - Assert.Throws(() => Mass.FromKilograms(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Mass.FromKilograms(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Mass.FromKilograms(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilograms_WithNanValue_ThrowsArgumentException() + public void FromKilograms_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Mass.FromKilograms(double.NaN)); + var exception = Record.Exception(() => Mass.FromKilograms(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs index d8dec9a2d0..7ec6b5cd8a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs @@ -71,16 +71,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Molality(double.PositiveInfinity, MolalityUnit.MolePerKilogram)); - Assert.Throws(() => new Molality(double.NegativeInfinity, MolalityUnit.MolePerKilogram)); + var exception1 = Record.Exception(() => new Molality(double.PositiveInfinity, MolalityUnit.MolePerKilogram)); + var exception2 = Record.Exception(() => new Molality(double.NegativeInfinity, MolalityUnit.MolePerKilogram)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Molality(double.NaN, MolalityUnit.MolePerKilogram)); + var exception = Record.Exception(() => new Molality(double.NaN, MolalityUnit.MolePerKilogram)); + + Assert.Null(exception); } [Fact] @@ -140,16 +145,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMolesPerKilogram_WithInfinityValue_ThrowsArgumentException() + public void FromMolesPerKilogram_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Molality.FromMolesPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => Molality.FromMolesPerKilogram(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Molality.FromMolesPerKilogram(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Molality.FromMolesPerKilogram(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMolesPerKilogram_WithNanValue_ThrowsArgumentException() + public void FromMolesPerKilogram_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Molality.FromMolesPerKilogram(double.NaN)); + var exception = Record.Exception(() => Molality.FromMolesPerKilogram(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs index 8cabd707e9..3f78851b43 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarEnergy(double.PositiveInfinity, MolarEnergyUnit.JoulePerMole)); - Assert.Throws(() => new MolarEnergy(double.NegativeInfinity, MolarEnergyUnit.JoulePerMole)); + var exception1 = Record.Exception(() => new MolarEnergy(double.PositiveInfinity, MolarEnergyUnit.JoulePerMole)); + var exception2 = Record.Exception(() => new MolarEnergy(double.NegativeInfinity, MolarEnergyUnit.JoulePerMole)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarEnergy(double.NaN, MolarEnergyUnit.JoulePerMole)); + var exception = Record.Exception(() => new MolarEnergy(double.NaN, MolarEnergyUnit.JoulePerMole)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerMole_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerMole_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerMole_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerMole_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NaN)); + var exception = Record.Exception(() => MolarEnergy.FromJoulesPerMole(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs index c915d64342..21ee3dccbe 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarEntropy(double.PositiveInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); - Assert.Throws(() => new MolarEntropy(double.NegativeInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + var exception1 = Record.Exception(() => new MolarEntropy(double.PositiveInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + var exception2 = Record.Exception(() => new MolarEntropy(double.NegativeInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin)); + var exception = Record.Exception(() => new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerMoleKelvin_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerMoleKelvin_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerMoleKelvin_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerMoleKelvin_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); + var exception = Record.Exception(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs index 89f673b4d3..3327e56843 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarFlow(double.PositiveInfinity, MolarFlowUnit.MolePerSecond)); - Assert.Throws(() => new MolarFlow(double.NegativeInfinity, MolarFlowUnit.MolePerSecond)); + var exception1 = Record.Exception(() => new MolarFlow(double.PositiveInfinity, MolarFlowUnit.MolePerSecond)); + var exception2 = Record.Exception(() => new MolarFlow(double.NegativeInfinity, MolarFlowUnit.MolePerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarFlow(double.NaN, MolarFlowUnit.MolePerSecond)); + var exception = Record.Exception(() => new MolarFlow(double.NaN, MolarFlowUnit.MolePerSecond)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMolesPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromMolesPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarFlow.FromMolesPerSecond(double.PositiveInfinity)); - Assert.Throws(() => MolarFlow.FromMolesPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MolarFlow.FromMolesPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MolarFlow.FromMolesPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMolesPerSecond_WithNanValue_ThrowsArgumentException() + public void FromMolesPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarFlow.FromMolesPerSecond(double.NaN)); + var exception = Record.Exception(() => MolarFlow.FromMolesPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs index 28e3c0f6c3..efe943b6bb 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs @@ -115,16 +115,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarMass(double.PositiveInfinity, MolarMassUnit.KilogramPerMole)); - Assert.Throws(() => new MolarMass(double.NegativeInfinity, MolarMassUnit.KilogramPerMole)); + var exception1 = Record.Exception(() => new MolarMass(double.PositiveInfinity, MolarMassUnit.KilogramPerMole)); + var exception2 = Record.Exception(() => new MolarMass(double.NegativeInfinity, MolarMassUnit.KilogramPerMole)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new MolarMass(double.NaN, MolarMassUnit.KilogramPerMole)); + var exception = Record.Exception(() => new MolarMass(double.NaN, MolarMassUnit.KilogramPerMole)); + + Assert.Null(exception); } [Fact] @@ -239,16 +244,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKilogramsPerMole_WithInfinityValue_ThrowsArgumentException() + public void FromKilogramsPerMole_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.PositiveInfinity)); - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NegativeInfinity)); + var exception1 = Record.Exception(() => MolarMass.FromKilogramsPerMole(double.PositiveInfinity)); + var exception2 = Record.Exception(() => MolarMass.FromKilogramsPerMole(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKilogramsPerMole_WithNanValue_ThrowsArgumentException() + public void FromKilogramsPerMole_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NaN)); + var exception = Record.Exception(() => MolarMass.FromKilogramsPerMole(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs index 64f4b2db4b..c87aacc006 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs @@ -107,16 +107,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Molarity(double.PositiveInfinity, MolarityUnit.MolePerCubicMeter)); - Assert.Throws(() => new Molarity(double.NegativeInfinity, MolarityUnit.MolePerCubicMeter)); + var exception1 = Record.Exception(() => new Molarity(double.PositiveInfinity, MolarityUnit.MolePerCubicMeter)); + var exception2 = Record.Exception(() => new Molarity(double.NegativeInfinity, MolarityUnit.MolePerCubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Molarity(double.NaN, MolarityUnit.MolePerCubicMeter)); + var exception = Record.Exception(() => new Molarity(double.NaN, MolarityUnit.MolePerCubicMeter)); + + Assert.Null(exception); } [Fact] @@ -221,16 +226,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMolesPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + public void FromMolesPerCubicMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Molarity.FromMolesPerCubicMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Molarity.FromMolesPerCubicMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMolesPerCubicMeter_WithNanValue_ThrowsArgumentException() + public void FromMolesPerCubicMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NaN)); + var exception = Record.Exception(() => Molarity.FromMolesPerCubicMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs index 5959b2d99d..b0889115bc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Permeability(double.PositiveInfinity, PermeabilityUnit.HenryPerMeter)); - Assert.Throws(() => new Permeability(double.NegativeInfinity, PermeabilityUnit.HenryPerMeter)); + var exception1 = Record.Exception(() => new Permeability(double.PositiveInfinity, PermeabilityUnit.HenryPerMeter)); + var exception2 = Record.Exception(() => new Permeability(double.NegativeInfinity, PermeabilityUnit.HenryPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Permeability(double.NaN, PermeabilityUnit.HenryPerMeter)); + var exception = Record.Exception(() => new Permeability(double.NaN, PermeabilityUnit.HenryPerMeter)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromHenriesPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromHenriesPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromHenriesPerMeter_WithNanValue_ThrowsArgumentException() + public void FromHenriesPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NaN)); + var exception = Record.Exception(() => Permeability.FromHenriesPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs index 6ba7c5194d..f56dda0005 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Permittivity(double.PositiveInfinity, PermittivityUnit.FaradPerMeter)); - Assert.Throws(() => new Permittivity(double.NegativeInfinity, PermittivityUnit.FaradPerMeter)); + var exception1 = Record.Exception(() => new Permittivity(double.PositiveInfinity, PermittivityUnit.FaradPerMeter)); + var exception2 = Record.Exception(() => new Permittivity(double.NegativeInfinity, PermittivityUnit.FaradPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Permittivity(double.NaN, PermittivityUnit.FaradPerMeter)); + var exception = Record.Exception(() => new Permittivity(double.NaN, PermittivityUnit.FaradPerMeter)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromFaradsPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromFaradsPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Permittivity.FromFaradsPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Permittivity.FromFaradsPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromFaradsPerMeter_WithNanValue_ThrowsArgumentException() + public void FromFaradsPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NaN)); + var exception = Record.Exception(() => Permittivity.FromFaradsPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs index d7321f40b1..9cda117a1a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs @@ -83,16 +83,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PorousMediumPermeability(double.PositiveInfinity, PorousMediumPermeabilityUnit.SquareMeter)); - Assert.Throws(() => new PorousMediumPermeability(double.NegativeInfinity, PorousMediumPermeabilityUnit.SquareMeter)); + var exception1 = Record.Exception(() => new PorousMediumPermeability(double.PositiveInfinity, PorousMediumPermeabilityUnit.SquareMeter)); + var exception2 = Record.Exception(() => new PorousMediumPermeability(double.NegativeInfinity, PorousMediumPermeabilityUnit.SquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PorousMediumPermeability(double.NaN, PorousMediumPermeabilityUnit.SquareMeter)); + var exception = Record.Exception(() => new PorousMediumPermeability(double.NaN, PorousMediumPermeabilityUnit.SquareMeter)); + + Assert.Null(exception); } [Fact] @@ -167,16 +172,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSquareMeters_WithInfinityValue_ThrowsArgumentException() + public void FromSquareMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PorousMediumPermeability.FromSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => PorousMediumPermeability.FromSquareMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => PorousMediumPermeability.FromSquareMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => PorousMediumPermeability.FromSquareMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSquareMeters_WithNanValue_ThrowsArgumentException() + public void FromSquareMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PorousMediumPermeability.FromSquareMeters(double.NaN)); + var exception = Record.Exception(() => PorousMediumPermeability.FromSquareMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs index 3d3e6d9312..4949a0a39e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs @@ -239,16 +239,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PowerDensity(double.PositiveInfinity, PowerDensityUnit.WattPerCubicMeter)); - Assert.Throws(() => new PowerDensity(double.NegativeInfinity, PowerDensityUnit.WattPerCubicMeter)); + var exception1 = Record.Exception(() => new PowerDensity(double.PositiveInfinity, PowerDensityUnit.WattPerCubicMeter)); + var exception2 = Record.Exception(() => new PowerDensity(double.NegativeInfinity, PowerDensityUnit.WattPerCubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PowerDensity(double.NaN, PowerDensityUnit.WattPerCubicMeter)); + var exception = Record.Exception(() => new PowerDensity(double.NaN, PowerDensityUnit.WattPerCubicMeter)); + + Assert.Null(exception); } [Fact] @@ -518,16 +523,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWattsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + public void FromWattsPerCubicMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => PowerDensity.FromWattsPerCubicMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => PowerDensity.FromWattsPerCubicMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWattsPerCubicMeter_WithNanValue_ThrowsArgumentException() + public void FromWattsPerCubicMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NaN)); + var exception = Record.Exception(() => PowerDensity.FromWattsPerCubicMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs index 1b05a986a4..141fefd908 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs @@ -71,16 +71,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PowerRatio(double.PositiveInfinity, PowerRatioUnit.DecibelWatt)); - Assert.Throws(() => new PowerRatio(double.NegativeInfinity, PowerRatioUnit.DecibelWatt)); + var exception1 = Record.Exception(() => new PowerRatio(double.PositiveInfinity, PowerRatioUnit.DecibelWatt)); + var exception2 = Record.Exception(() => new PowerRatio(double.NegativeInfinity, PowerRatioUnit.DecibelWatt)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PowerRatio(double.NaN, PowerRatioUnit.DecibelWatt)); + var exception = Record.Exception(() => new PowerRatio(double.NaN, PowerRatioUnit.DecibelWatt)); + + Assert.Null(exception); } [Fact] @@ -140,16 +145,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDecibelWatts_WithInfinityValue_ThrowsArgumentException() + public void FromDecibelWatts_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.PositiveInfinity)); - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NegativeInfinity)); + var exception1 = Record.Exception(() => PowerRatio.FromDecibelWatts(double.PositiveInfinity)); + var exception2 = Record.Exception(() => PowerRatio.FromDecibelWatts(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDecibelWatts_WithNanValue_ThrowsArgumentException() + public void FromDecibelWatts_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NaN)); + var exception = Record.Exception(() => PowerRatio.FromDecibelWatts(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs index 1e4178602b..8af12eaaf2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs @@ -135,16 +135,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PressureChangeRate(double.PositiveInfinity, PressureChangeRateUnit.PascalPerSecond)); - Assert.Throws(() => new PressureChangeRate(double.NegativeInfinity, PressureChangeRateUnit.PascalPerSecond)); + var exception1 = Record.Exception(() => new PressureChangeRate(double.PositiveInfinity, PressureChangeRateUnit.PascalPerSecond)); + var exception2 = Record.Exception(() => new PressureChangeRate(double.NegativeInfinity, PressureChangeRateUnit.PascalPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new PressureChangeRate(double.NaN, PressureChangeRateUnit.PascalPerSecond)); + var exception = Record.Exception(() => new PressureChangeRate(double.NaN, PressureChangeRateUnit.PascalPerSecond)); + + Assert.Null(exception); } [Fact] @@ -284,16 +289,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromPascalsPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromPascalsPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => PressureChangeRate.FromPascalsPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => PressureChangeRate.FromPascalsPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromPascalsPerSecond_WithNanValue_ThrowsArgumentException() + public void FromPascalsPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NaN)); + var exception = Record.Exception(() => PressureChangeRate.FromPascalsPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs index 88592eb00a..1abc7a7fb1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs @@ -259,16 +259,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Pressure(double.PositiveInfinity, PressureUnit.Pascal)); - Assert.Throws(() => new Pressure(double.NegativeInfinity, PressureUnit.Pascal)); + var exception1 = Record.Exception(() => new Pressure(double.PositiveInfinity, PressureUnit.Pascal)); + var exception2 = Record.Exception(() => new Pressure(double.NegativeInfinity, PressureUnit.Pascal)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Pressure(double.NaN, PressureUnit.Pascal)); + var exception = Record.Exception(() => new Pressure(double.NaN, PressureUnit.Pascal)); + + Assert.Null(exception); } [Fact] @@ -563,16 +568,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromPascals_WithInfinityValue_ThrowsArgumentException() + public void FromPascals_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Pressure.FromPascals(double.PositiveInfinity)); - Assert.Throws(() => Pressure.FromPascals(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Pressure.FromPascals(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Pressure.FromPascals(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromPascals_WithNanValue_ThrowsArgumentException() + public void FromPascals_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Pressure.FromPascals(double.NaN)); + var exception = Record.Exception(() => Pressure.FromPascals(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs index 31f2bf9527..ecf3283df7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs @@ -95,16 +95,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RadiationExposure(double.PositiveInfinity, RadiationExposureUnit.CoulombPerKilogram)); - Assert.Throws(() => new RadiationExposure(double.NegativeInfinity, RadiationExposureUnit.CoulombPerKilogram)); + var exception1 = Record.Exception(() => new RadiationExposure(double.PositiveInfinity, RadiationExposureUnit.CoulombPerKilogram)); + var exception2 = Record.Exception(() => new RadiationExposure(double.NegativeInfinity, RadiationExposureUnit.CoulombPerKilogram)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RadiationExposure(double.NaN, RadiationExposureUnit.CoulombPerKilogram)); + var exception = Record.Exception(() => new RadiationExposure(double.NaN, RadiationExposureUnit.CoulombPerKilogram)); + + Assert.Null(exception); } [Fact] @@ -194,16 +199,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCoulombsPerKilogram_WithInfinityValue_ThrowsArgumentException() + public void FromCoulombsPerKilogram_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RadiationExposure.FromCoulombsPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => RadiationExposure.FromCoulombsPerKilogram(double.NegativeInfinity)); + var exception1 = Record.Exception(() => RadiationExposure.FromCoulombsPerKilogram(double.PositiveInfinity)); + var exception2 = Record.Exception(() => RadiationExposure.FromCoulombsPerKilogram(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCoulombsPerKilogram_WithNanValue_ThrowsArgumentException() + public void FromCoulombsPerKilogram_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RadiationExposure.FromCoulombsPerKilogram(double.NaN)); + var exception = Record.Exception(() => RadiationExposure.FromCoulombsPerKilogram(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs index 9307cbdbd7..02573832a7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs @@ -179,16 +179,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Radioactivity(double.PositiveInfinity, RadioactivityUnit.Becquerel)); - Assert.Throws(() => new Radioactivity(double.NegativeInfinity, RadioactivityUnit.Becquerel)); + var exception1 = Record.Exception(() => new Radioactivity(double.PositiveInfinity, RadioactivityUnit.Becquerel)); + var exception2 = Record.Exception(() => new Radioactivity(double.NegativeInfinity, RadioactivityUnit.Becquerel)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Radioactivity(double.NaN, RadioactivityUnit.Becquerel)); + var exception = Record.Exception(() => new Radioactivity(double.NaN, RadioactivityUnit.Becquerel)); + + Assert.Null(exception); } [Fact] @@ -383,16 +388,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromBecquerels_WithInfinityValue_ThrowsArgumentException() + public void FromBecquerels_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Radioactivity.FromBecquerels(double.PositiveInfinity)); - Assert.Throws(() => Radioactivity.FromBecquerels(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Radioactivity.FromBecquerels(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Radioactivity.FromBecquerels(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromBecquerels_WithNanValue_ThrowsArgumentException() + public void FromBecquerels_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Radioactivity.FromBecquerels(double.NaN)); + var exception = Record.Exception(() => Radioactivity.FromBecquerels(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs index eb98e2014b..bcd7625c96 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs @@ -71,16 +71,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RatioChangeRate(double.PositiveInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); - Assert.Throws(() => new RatioChangeRate(double.NegativeInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); + var exception1 = Record.Exception(() => new RatioChangeRate(double.PositiveInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); + var exception2 = Record.Exception(() => new RatioChangeRate(double.NegativeInfinity, RatioChangeRateUnit.DecimalFractionPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RatioChangeRate(double.NaN, RatioChangeRateUnit.DecimalFractionPerSecond)); + var exception = Record.Exception(() => new RatioChangeRate(double.NaN, RatioChangeRateUnit.DecimalFractionPerSecond)); + + Assert.Null(exception); } [Fact] @@ -140,16 +145,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDecimalFractionsPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromDecimalFractionsPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDecimalFractionsPerSecond_WithNanValue_ThrowsArgumentException() + public void FromDecimalFractionsPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NaN)); + var exception = Record.Exception(() => RatioChangeRate.FromDecimalFractionsPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs index dff098a836..8b67419d0a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Ratio(double.PositiveInfinity, RatioUnit.DecimalFraction)); - Assert.Throws(() => new Ratio(double.NegativeInfinity, RatioUnit.DecimalFraction)); + var exception1 = Record.Exception(() => new Ratio(double.PositiveInfinity, RatioUnit.DecimalFraction)); + var exception2 = Record.Exception(() => new Ratio(double.NegativeInfinity, RatioUnit.DecimalFraction)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Ratio(double.NaN, RatioUnit.DecimalFraction)); + var exception = Record.Exception(() => new Ratio(double.NaN, RatioUnit.DecimalFraction)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() + public void FromDecimalFractions_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Ratio.FromDecimalFractions(double.PositiveInfinity)); - Assert.Throws(() => Ratio.FromDecimalFractions(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Ratio.FromDecimalFractions(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Ratio.FromDecimalFractions(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() + public void FromDecimalFractions_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Ratio.FromDecimalFractions(double.NaN)); + var exception = Record.Exception(() => Ratio.FromDecimalFractions(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs index ac965968bb..2a0cd7413e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReactiveEnergy(double.PositiveInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); - Assert.Throws(() => new ReactiveEnergy(double.NegativeInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + var exception1 = Record.Exception(() => new ReactiveEnergy(double.PositiveInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + var exception2 = Record.Exception(() => new ReactiveEnergy(double.NegativeInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReactiveEnergy(double.NaN, ReactiveEnergyUnit.VoltampereReactiveHour)); + var exception = Record.Exception(() => new ReactiveEnergy(double.NaN, ReactiveEnergyUnit.VoltampereReactiveHour)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVoltampereReactiveHours_WithInfinityValue_ThrowsArgumentException() + public void FromVoltampereReactiveHours_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.PositiveInfinity)); - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ReactiveEnergy.FromVoltampereReactiveHours(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltampereReactiveHours_WithNanValue_ThrowsArgumentException() + public void FromVoltampereReactiveHours_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NaN)); + var exception = Record.Exception(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs index 718b047479..60499caa3f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReactivePower(double.PositiveInfinity, ReactivePowerUnit.VoltampereReactive)); - Assert.Throws(() => new ReactivePower(double.NegativeInfinity, ReactivePowerUnit.VoltampereReactive)); + var exception1 = Record.Exception(() => new ReactivePower(double.PositiveInfinity, ReactivePowerUnit.VoltampereReactive)); + var exception2 = Record.Exception(() => new ReactivePower(double.NegativeInfinity, ReactivePowerUnit.VoltampereReactive)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReactivePower(double.NaN, ReactivePowerUnit.VoltampereReactive)); + var exception = Record.Exception(() => new ReactivePower(double.NaN, ReactivePowerUnit.VoltampereReactive)); + + Assert.Null(exception); } [Fact] @@ -158,16 +163,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromVoltamperesReactive_WithInfinityValue_ThrowsArgumentException() + public void FromVoltamperesReactive_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity)); - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromVoltamperesReactive_WithNanValue_ThrowsArgumentException() + public void FromVoltamperesReactive_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NaN)); + var exception = Record.Exception(() => ReactivePower.FromVoltamperesReactive(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs index e9dd3b8dc1..1a066dd028 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs @@ -107,16 +107,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReciprocalArea(double.PositiveInfinity, ReciprocalAreaUnit.InverseSquareMeter)); - Assert.Throws(() => new ReciprocalArea(double.NegativeInfinity, ReciprocalAreaUnit.InverseSquareMeter)); + var exception1 = Record.Exception(() => new ReciprocalArea(double.PositiveInfinity, ReciprocalAreaUnit.InverseSquareMeter)); + var exception2 = Record.Exception(() => new ReciprocalArea(double.NegativeInfinity, ReciprocalAreaUnit.InverseSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReciprocalArea(double.NaN, ReciprocalAreaUnit.InverseSquareMeter)); + var exception = Record.Exception(() => new ReciprocalArea(double.NaN, ReciprocalAreaUnit.InverseSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -221,16 +226,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromInverseSquareMeters_WithInfinityValue_ThrowsArgumentException() + public void FromInverseSquareMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReciprocalArea.FromInverseSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => ReciprocalArea.FromInverseSquareMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ReciprocalArea.FromInverseSquareMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ReciprocalArea.FromInverseSquareMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromInverseSquareMeters_WithNanValue_ThrowsArgumentException() + public void FromInverseSquareMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReciprocalArea.FromInverseSquareMeters(double.NaN)); + var exception = Record.Exception(() => ReciprocalArea.FromInverseSquareMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs index e856fc3bb5..3826eae96b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs @@ -103,16 +103,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReciprocalLength(double.PositiveInfinity, ReciprocalLengthUnit.InverseMeter)); - Assert.Throws(() => new ReciprocalLength(double.NegativeInfinity, ReciprocalLengthUnit.InverseMeter)); + var exception1 = Record.Exception(() => new ReciprocalLength(double.PositiveInfinity, ReciprocalLengthUnit.InverseMeter)); + var exception2 = Record.Exception(() => new ReciprocalLength(double.NegativeInfinity, ReciprocalLengthUnit.InverseMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ReciprocalLength(double.NaN, ReciprocalLengthUnit.InverseMeter)); + var exception = Record.Exception(() => new ReciprocalLength(double.NaN, ReciprocalLengthUnit.InverseMeter)); + + Assert.Null(exception); } [Fact] @@ -212,16 +217,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromInverseMeters_WithInfinityValue_ThrowsArgumentException() + public void FromInverseMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReciprocalLength.FromInverseMeters(double.PositiveInfinity)); - Assert.Throws(() => ReciprocalLength.FromInverseMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ReciprocalLength.FromInverseMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ReciprocalLength.FromInverseMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromInverseMeters_WithNanValue_ThrowsArgumentException() + public void FromInverseMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ReciprocalLength.FromInverseMeters(double.NaN)); + var exception = Record.Exception(() => ReciprocalLength.FromInverseMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs index 36c3ebfc5a..be8a616e92 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RelativeHumidity(double.PositiveInfinity, RelativeHumidityUnit.Percent)); - Assert.Throws(() => new RelativeHumidity(double.NegativeInfinity, RelativeHumidityUnit.Percent)); + var exception1 = Record.Exception(() => new RelativeHumidity(double.PositiveInfinity, RelativeHumidityUnit.Percent)); + var exception2 = Record.Exception(() => new RelativeHumidity(double.NegativeInfinity, RelativeHumidityUnit.Percent)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RelativeHumidity(double.NaN, RelativeHumidityUnit.Percent)); + var exception = Record.Exception(() => new RelativeHumidity(double.NaN, RelativeHumidityUnit.Percent)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromPercent_WithInfinityValue_ThrowsArgumentException() + public void FromPercent_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RelativeHumidity.FromPercent(double.PositiveInfinity)); - Assert.Throws(() => RelativeHumidity.FromPercent(double.NegativeInfinity)); + var exception1 = Record.Exception(() => RelativeHumidity.FromPercent(double.PositiveInfinity)); + var exception2 = Record.Exception(() => RelativeHumidity.FromPercent(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromPercent_WithNanValue_ThrowsArgumentException() + public void FromPercent_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RelativeHumidity.FromPercent(double.NaN)); + var exception = Record.Exception(() => RelativeHumidity.FromPercent(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs index 96aef71bb8..117c8046e0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalAcceleration(double.PositiveInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); - Assert.Throws(() => new RotationalAcceleration(double.NegativeInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + var exception1 = Record.Exception(() => new RotationalAcceleration(double.PositiveInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + var exception2 = Record.Exception(() => new RotationalAcceleration(double.NegativeInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalAcceleration(double.NaN, RotationalAccelerationUnit.RadianPerSecondSquared)); + var exception = Record.Exception(() => new RotationalAcceleration(double.NaN, RotationalAccelerationUnit.RadianPerSecondSquared)); + + Assert.Null(exception); } [Fact] @@ -158,16 +163,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromRadiansPerSecondSquared_WithInfinityValue_ThrowsArgumentException() + public void FromRadiansPerSecondSquared_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity)); - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity)); + var exception1 = Record.Exception(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity)); + var exception2 = Record.Exception(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromRadiansPerSecondSquared_WithNanValue_ThrowsArgumentException() + public void FromRadiansPerSecondSquared_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN)); + var exception = Record.Exception(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs index a8ec0147c7..ee731ca9c5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs @@ -115,16 +115,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalSpeed(double.PositiveInfinity, RotationalSpeedUnit.RadianPerSecond)); - Assert.Throws(() => new RotationalSpeed(double.NegativeInfinity, RotationalSpeedUnit.RadianPerSecond)); + var exception1 = Record.Exception(() => new RotationalSpeed(double.PositiveInfinity, RotationalSpeedUnit.RadianPerSecond)); + var exception2 = Record.Exception(() => new RotationalSpeed(double.NegativeInfinity, RotationalSpeedUnit.RadianPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalSpeed(double.NaN, RotationalSpeedUnit.RadianPerSecond)); + var exception = Record.Exception(() => new RotationalSpeed(double.NaN, RotationalSpeedUnit.RadianPerSecond)); + + Assert.Null(exception); } [Fact] @@ -239,16 +244,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromRadiansPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromRadiansPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.PositiveInfinity)); - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => RotationalSpeed.FromRadiansPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => RotationalSpeed.FromRadiansPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromRadiansPerSecond_WithNanValue_ThrowsArgumentException() + public void FromRadiansPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NaN)); + var exception = Record.Exception(() => RotationalSpeed.FromRadiansPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs index 49ed69b1cc..2b58133545 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs @@ -83,16 +83,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffnessPerLength(double.PositiveInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); - Assert.Throws(() => new RotationalStiffnessPerLength(double.NegativeInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + var exception1 = Record.Exception(() => new RotationalStiffnessPerLength(double.PositiveInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + var exception2 = Record.Exception(() => new RotationalStiffnessPerLength(double.NegativeInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffnessPerLength(double.NaN, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + var exception = Record.Exception(() => new RotationalStiffnessPerLength(double.NaN, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + + Assert.Null(exception); } [Fact] @@ -167,16 +172,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonMetersPerRadianPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonMetersPerRadianPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.PositiveInfinity)); - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonMetersPerRadianPerMeter_WithNanValue_ThrowsArgumentException() + public void FromNewtonMetersPerRadianPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NaN)); + var exception = Record.Exception(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs index 9570dbe397..13d340cd8e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs @@ -195,16 +195,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffness(double.PositiveInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); - Assert.Throws(() => new RotationalStiffness(double.NegativeInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + var exception1 = Record.Exception(() => new RotationalStiffness(double.PositiveInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + var exception2 = Record.Exception(() => new RotationalStiffness(double.NegativeInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new RotationalStiffness(double.NaN, RotationalStiffnessUnit.NewtonMeterPerRadian)); + var exception = Record.Exception(() => new RotationalStiffness(double.NaN, RotationalStiffnessUnit.NewtonMeterPerRadian)); + + Assert.Null(exception); } [Fact] @@ -419,16 +424,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonMetersPerRadian_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonMetersPerRadian_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.PositiveInfinity)); - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NegativeInfinity)); + var exception1 = Record.Exception(() => RotationalStiffness.FromNewtonMetersPerRadian(double.PositiveInfinity)); + var exception2 = Record.Exception(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonMetersPerRadian_WithNanValue_ThrowsArgumentException() + public void FromNewtonMetersPerRadian_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NaN)); + var exception = Record.Exception(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs index 742d059f30..57dc7da0d2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Scalar(double.PositiveInfinity, ScalarUnit.Amount)); - Assert.Throws(() => new Scalar(double.NegativeInfinity, ScalarUnit.Amount)); + var exception1 = Record.Exception(() => new Scalar(double.PositiveInfinity, ScalarUnit.Amount)); + var exception2 = Record.Exception(() => new Scalar(double.NegativeInfinity, ScalarUnit.Amount)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Scalar(double.NaN, ScalarUnit.Amount)); + var exception = Record.Exception(() => new Scalar(double.NaN, ScalarUnit.Amount)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromAmount_WithInfinityValue_ThrowsArgumentException() + public void FromAmount_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Scalar.FromAmount(double.PositiveInfinity)); - Assert.Throws(() => Scalar.FromAmount(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Scalar.FromAmount(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Scalar.FromAmount(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromAmount_WithNanValue_ThrowsArgumentException() + public void FromAmount_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Scalar.FromAmount(double.NaN)); + var exception = Record.Exception(() => Scalar.FromAmount(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs index aa6510723b..1d75039295 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SolidAngle(double.PositiveInfinity, SolidAngleUnit.Steradian)); - Assert.Throws(() => new SolidAngle(double.NegativeInfinity, SolidAngleUnit.Steradian)); + var exception1 = Record.Exception(() => new SolidAngle(double.PositiveInfinity, SolidAngleUnit.Steradian)); + var exception2 = Record.Exception(() => new SolidAngle(double.NegativeInfinity, SolidAngleUnit.Steradian)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SolidAngle(double.NaN, SolidAngleUnit.Steradian)); + var exception = Record.Exception(() => new SolidAngle(double.NaN, SolidAngleUnit.Steradian)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSteradians_WithInfinityValue_ThrowsArgumentException() + public void FromSteradians_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SolidAngle.FromSteradians(double.PositiveInfinity)); - Assert.Throws(() => SolidAngle.FromSteradians(double.NegativeInfinity)); + var exception1 = Record.Exception(() => SolidAngle.FromSteradians(double.PositiveInfinity)); + var exception2 = Record.Exception(() => SolidAngle.FromSteradians(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSteradians_WithNanValue_ThrowsArgumentException() + public void FromSteradians_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SolidAngle.FromSteradians(double.NaN)); + var exception = Record.Exception(() => SolidAngle.FromSteradians(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs index e2c1dafb97..c31874a81d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs @@ -183,16 +183,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificEnergy(double.PositiveInfinity, SpecificEnergyUnit.JoulePerKilogram)); - Assert.Throws(() => new SpecificEnergy(double.NegativeInfinity, SpecificEnergyUnit.JoulePerKilogram)); + var exception1 = Record.Exception(() => new SpecificEnergy(double.PositiveInfinity, SpecificEnergyUnit.JoulePerKilogram)); + var exception2 = Record.Exception(() => new SpecificEnergy(double.NegativeInfinity, SpecificEnergyUnit.JoulePerKilogram)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificEnergy(double.NaN, SpecificEnergyUnit.JoulePerKilogram)); + var exception = Record.Exception(() => new SpecificEnergy(double.NaN, SpecificEnergyUnit.JoulePerKilogram)); + + Assert.Null(exception); } [Fact] @@ -392,16 +397,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerKilogram_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerKilogram_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NegativeInfinity)); + var exception1 = Record.Exception(() => SpecificEnergy.FromJoulesPerKilogram(double.PositiveInfinity)); + var exception2 = Record.Exception(() => SpecificEnergy.FromJoulesPerKilogram(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerKilogram_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerKilogram_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NaN)); + var exception = Record.Exception(() => SpecificEnergy.FromJoulesPerKilogram(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs index 2aa80ab7b4..af0c1ee8ff 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificEntropy(double.PositiveInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); - Assert.Throws(() => new SpecificEntropy(double.NegativeInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + var exception1 = Record.Exception(() => new SpecificEntropy(double.PositiveInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + var exception2 = Record.Exception(() => new SpecificEntropy(double.NegativeInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificEntropy(double.NaN, SpecificEntropyUnit.JoulePerKilogramKelvin)); + var exception = Record.Exception(() => new SpecificEntropy(double.NaN, SpecificEntropyUnit.JoulePerKilogramKelvin)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerKilogramKelvin_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerKilogramKelvin_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.PositiveInfinity)); - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NegativeInfinity)); + var exception1 = Record.Exception(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.PositiveInfinity)); + var exception2 = Record.Exception(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerKilogramKelvin_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerKilogramKelvin_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NaN)); + var exception = Record.Exception(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs index 468bd12dbd..43e0506737 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificFuelConsumption(double.PositiveInfinity, SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond)); - Assert.Throws(() => new SpecificFuelConsumption(double.NegativeInfinity, SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond)); + var exception1 = Record.Exception(() => new SpecificFuelConsumption(double.PositiveInfinity, SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond)); + var exception2 = Record.Exception(() => new SpecificFuelConsumption(double.NegativeInfinity, SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificFuelConsumption(double.NaN, SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond)); + var exception = Record.Exception(() => new SpecificFuelConsumption(double.NaN, SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond)); + + Assert.Null(exception); } [Fact] @@ -158,16 +163,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromGramsPerKiloNewtonSecond_WithInfinityValue_ThrowsArgumentException() + public void FromGramsPerKiloNewtonSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificFuelConsumption.FromGramsPerKiloNewtonSecond(double.PositiveInfinity)); - Assert.Throws(() => SpecificFuelConsumption.FromGramsPerKiloNewtonSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => SpecificFuelConsumption.FromGramsPerKiloNewtonSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => SpecificFuelConsumption.FromGramsPerKiloNewtonSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromGramsPerKiloNewtonSecond_WithNanValue_ThrowsArgumentException() + public void FromGramsPerKiloNewtonSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificFuelConsumption.FromGramsPerKiloNewtonSecond(double.NaN)); + var exception = Record.Exception(() => SpecificFuelConsumption.FromGramsPerKiloNewtonSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs index 52668dba57..2ff6e37598 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs @@ -75,16 +75,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificVolume(double.PositiveInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); - Assert.Throws(() => new SpecificVolume(double.NegativeInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + var exception1 = Record.Exception(() => new SpecificVolume(double.PositiveInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + var exception2 = Record.Exception(() => new SpecificVolume(double.NegativeInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificVolume(double.NaN, SpecificVolumeUnit.CubicMeterPerKilogram)); + var exception = Record.Exception(() => new SpecificVolume(double.NaN, SpecificVolumeUnit.CubicMeterPerKilogram)); + + Assert.Null(exception); } [Fact] @@ -149,16 +154,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCubicMetersPerKilogram_WithInfinityValue_ThrowsArgumentException() + public void FromCubicMetersPerKilogram_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NegativeInfinity)); + var exception1 = Record.Exception(() => SpecificVolume.FromCubicMetersPerKilogram(double.PositiveInfinity)); + var exception2 = Record.Exception(() => SpecificVolume.FromCubicMetersPerKilogram(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCubicMetersPerKilogram_WithNanValue_ThrowsArgumentException() + public void FromCubicMetersPerKilogram_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NaN)); + var exception = Record.Exception(() => SpecificVolume.FromCubicMetersPerKilogram(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs index 49815d777c..ba99208dd9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs @@ -131,16 +131,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificWeight(double.PositiveInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); - Assert.Throws(() => new SpecificWeight(double.NegativeInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + var exception1 = Record.Exception(() => new SpecificWeight(double.PositiveInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + var exception2 = Record.Exception(() => new SpecificWeight(double.NegativeInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new SpecificWeight(double.NaN, SpecificWeightUnit.NewtonPerCubicMeter)); + var exception = Record.Exception(() => new SpecificWeight(double.NaN, SpecificWeightUnit.NewtonPerCubicMeter)); + + Assert.Null(exception); } [Fact] @@ -275,16 +280,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonsPerCubicMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => SpecificWeight.FromNewtonsPerCubicMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonsPerCubicMeter_WithNanValue_ThrowsArgumentException() + public void FromNewtonsPerCubicMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NaN)); + var exception = Record.Exception(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs index ceafc36b5c..d8e25872a8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs @@ -39,9 +39,9 @@ namespace UnitsNet.Tests public abstract partial class SpeedTestsBase : QuantityTestsBase { protected abstract double CentimetersPerHourInOneMeterPerSecond { get; } - protected abstract double CentimetersPerMinutesInOneMeterPerSecond { get; } + protected abstract double CentimetersPerMinuteInOneMeterPerSecond { get; } protected abstract double CentimetersPerSecondInOneMeterPerSecond { get; } - protected abstract double DecimetersPerMinutesInOneMeterPerSecond { get; } + protected abstract double DecimetersPerMinuteInOneMeterPerSecond { get; } protected abstract double DecimetersPerSecondInOneMeterPerSecond { get; } protected abstract double FeetPerHourInOneMeterPerSecond { get; } protected abstract double FeetPerMinuteInOneMeterPerSecond { get; } @@ -50,20 +50,20 @@ public abstract partial class SpeedTestsBase : QuantityTestsBase protected abstract double InchesPerMinuteInOneMeterPerSecond { get; } protected abstract double InchesPerSecondInOneMeterPerSecond { get; } protected abstract double KilometersPerHourInOneMeterPerSecond { get; } - protected abstract double KilometersPerMinutesInOneMeterPerSecond { get; } + protected abstract double KilometersPerMinuteInOneMeterPerSecond { get; } protected abstract double KilometersPerSecondInOneMeterPerSecond { get; } protected abstract double KnotsInOneMeterPerSecond { get; } protected abstract double MachInOneMeterPerSecond { get; } protected abstract double MetersPerHourInOneMeterPerSecond { get; } - protected abstract double MetersPerMinutesInOneMeterPerSecond { get; } + protected abstract double MetersPerMinuteInOneMeterPerSecond { get; } protected abstract double MetersPerSecondInOneMeterPerSecond { get; } - protected abstract double MicrometersPerMinutesInOneMeterPerSecond { get; } + protected abstract double MicrometersPerMinuteInOneMeterPerSecond { get; } protected abstract double MicrometersPerSecondInOneMeterPerSecond { get; } protected abstract double MilesPerHourInOneMeterPerSecond { get; } protected abstract double MillimetersPerHourInOneMeterPerSecond { get; } - protected abstract double MillimetersPerMinutesInOneMeterPerSecond { get; } + protected abstract double MillimetersPerMinuteInOneMeterPerSecond { get; } protected abstract double MillimetersPerSecondInOneMeterPerSecond { get; } - protected abstract double NanometersPerMinutesInOneMeterPerSecond { get; } + protected abstract double NanometersPerMinuteInOneMeterPerSecond { get; } protected abstract double NanometersPerSecondInOneMeterPerSecond { get; } protected abstract double UsSurveyFeetPerHourInOneMeterPerSecond { get; } protected abstract double UsSurveyFeetPerMinuteInOneMeterPerSecond { get; } @@ -74,9 +74,9 @@ public abstract partial class SpeedTestsBase : QuantityTestsBase // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double CentimetersPerHourTolerance { get { return 1e-5; } } - protected virtual double CentimetersPerMinutesTolerance { get { return 1e-5; } } + protected virtual double CentimetersPerMinuteTolerance { get { return 1e-5; } } protected virtual double CentimetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecimetersPerMinutesTolerance { get { return 1e-5; } } + protected virtual double DecimetersPerMinuteTolerance { get { return 1e-5; } } protected virtual double DecimetersPerSecondTolerance { get { return 1e-5; } } protected virtual double FeetPerHourTolerance { get { return 1e-5; } } protected virtual double FeetPerMinuteTolerance { get { return 1e-5; } } @@ -85,20 +85,20 @@ public abstract partial class SpeedTestsBase : QuantityTestsBase protected virtual double InchesPerMinuteTolerance { get { return 1e-5; } } protected virtual double InchesPerSecondTolerance { get { return 1e-5; } } protected virtual double KilometersPerHourTolerance { get { return 1e-5; } } - protected virtual double KilometersPerMinutesTolerance { get { return 1e-5; } } + protected virtual double KilometersPerMinuteTolerance { get { return 1e-5; } } protected virtual double KilometersPerSecondTolerance { get { return 1e-5; } } protected virtual double KnotsTolerance { get { return 1e-5; } } protected virtual double MachTolerance { get { return 1e-5; } } protected virtual double MetersPerHourTolerance { get { return 1e-5; } } - protected virtual double MetersPerMinutesTolerance { get { return 1e-5; } } + protected virtual double MetersPerMinuteTolerance { get { return 1e-5; } } protected virtual double MetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicrometersPerMinutesTolerance { get { return 1e-5; } } + protected virtual double MicrometersPerMinuteTolerance { get { return 1e-5; } } protected virtual double MicrometersPerSecondTolerance { get { return 1e-5; } } protected virtual double MilesPerHourTolerance { get { return 1e-5; } } protected virtual double MillimetersPerHourTolerance { get { return 1e-5; } } - protected virtual double MillimetersPerMinutesTolerance { get { return 1e-5; } } + protected virtual double MillimetersPerMinuteTolerance { get { return 1e-5; } } protected virtual double MillimetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double NanometersPerMinutesTolerance { get { return 1e-5; } } + protected virtual double NanometersPerMinuteTolerance { get { return 1e-5; } } protected virtual double NanometersPerSecondTolerance { get { return 1e-5; } } protected virtual double UsSurveyFeetPerHourTolerance { get { return 1e-5; } } protected virtual double UsSurveyFeetPerMinuteTolerance { get { return 1e-5; } } @@ -113,9 +113,9 @@ public abstract partial class SpeedTestsBase : QuantityTestsBase return unit switch { SpeedUnit.CentimeterPerHour => (CentimetersPerHourInOneMeterPerSecond, CentimetersPerHourTolerance), - SpeedUnit.CentimeterPerMinute => (CentimetersPerMinutesInOneMeterPerSecond, CentimetersPerMinutesTolerance), + SpeedUnit.CentimeterPerMinute => (CentimetersPerMinuteInOneMeterPerSecond, CentimetersPerMinuteTolerance), SpeedUnit.CentimeterPerSecond => (CentimetersPerSecondInOneMeterPerSecond, CentimetersPerSecondTolerance), - SpeedUnit.DecimeterPerMinute => (DecimetersPerMinutesInOneMeterPerSecond, DecimetersPerMinutesTolerance), + SpeedUnit.DecimeterPerMinute => (DecimetersPerMinuteInOneMeterPerSecond, DecimetersPerMinuteTolerance), SpeedUnit.DecimeterPerSecond => (DecimetersPerSecondInOneMeterPerSecond, DecimetersPerSecondTolerance), SpeedUnit.FootPerHour => (FeetPerHourInOneMeterPerSecond, FeetPerHourTolerance), SpeedUnit.FootPerMinute => (FeetPerMinuteInOneMeterPerSecond, FeetPerMinuteTolerance), @@ -124,20 +124,20 @@ public abstract partial class SpeedTestsBase : QuantityTestsBase SpeedUnit.InchPerMinute => (InchesPerMinuteInOneMeterPerSecond, InchesPerMinuteTolerance), SpeedUnit.InchPerSecond => (InchesPerSecondInOneMeterPerSecond, InchesPerSecondTolerance), SpeedUnit.KilometerPerHour => (KilometersPerHourInOneMeterPerSecond, KilometersPerHourTolerance), - SpeedUnit.KilometerPerMinute => (KilometersPerMinutesInOneMeterPerSecond, KilometersPerMinutesTolerance), + SpeedUnit.KilometerPerMinute => (KilometersPerMinuteInOneMeterPerSecond, KilometersPerMinuteTolerance), SpeedUnit.KilometerPerSecond => (KilometersPerSecondInOneMeterPerSecond, KilometersPerSecondTolerance), SpeedUnit.Knot => (KnotsInOneMeterPerSecond, KnotsTolerance), SpeedUnit.Mach => (MachInOneMeterPerSecond, MachTolerance), SpeedUnit.MeterPerHour => (MetersPerHourInOneMeterPerSecond, MetersPerHourTolerance), - SpeedUnit.MeterPerMinute => (MetersPerMinutesInOneMeterPerSecond, MetersPerMinutesTolerance), + SpeedUnit.MeterPerMinute => (MetersPerMinuteInOneMeterPerSecond, MetersPerMinuteTolerance), SpeedUnit.MeterPerSecond => (MetersPerSecondInOneMeterPerSecond, MetersPerSecondTolerance), - SpeedUnit.MicrometerPerMinute => (MicrometersPerMinutesInOneMeterPerSecond, MicrometersPerMinutesTolerance), + SpeedUnit.MicrometerPerMinute => (MicrometersPerMinuteInOneMeterPerSecond, MicrometersPerMinuteTolerance), SpeedUnit.MicrometerPerSecond => (MicrometersPerSecondInOneMeterPerSecond, MicrometersPerSecondTolerance), SpeedUnit.MilePerHour => (MilesPerHourInOneMeterPerSecond, MilesPerHourTolerance), SpeedUnit.MillimeterPerHour => (MillimetersPerHourInOneMeterPerSecond, MillimetersPerHourTolerance), - SpeedUnit.MillimeterPerMinute => (MillimetersPerMinutesInOneMeterPerSecond, MillimetersPerMinutesTolerance), + SpeedUnit.MillimeterPerMinute => (MillimetersPerMinuteInOneMeterPerSecond, MillimetersPerMinuteTolerance), SpeedUnit.MillimeterPerSecond => (MillimetersPerSecondInOneMeterPerSecond, MillimetersPerSecondTolerance), - SpeedUnit.NanometerPerMinute => (NanometersPerMinutesInOneMeterPerSecond, NanometersPerMinutesTolerance), + SpeedUnit.NanometerPerMinute => (NanometersPerMinuteInOneMeterPerSecond, NanometersPerMinuteTolerance), SpeedUnit.NanometerPerSecond => (NanometersPerSecondInOneMeterPerSecond, NanometersPerSecondTolerance), SpeedUnit.UsSurveyFootPerHour => (UsSurveyFeetPerHourInOneMeterPerSecond, UsSurveyFeetPerHourTolerance), SpeedUnit.UsSurveyFootPerMinute => (UsSurveyFeetPerMinuteInOneMeterPerSecond, UsSurveyFeetPerMinuteTolerance), @@ -195,16 +195,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Speed(double.PositiveInfinity, SpeedUnit.MeterPerSecond)); - Assert.Throws(() => new Speed(double.NegativeInfinity, SpeedUnit.MeterPerSecond)); + var exception1 = Record.Exception(() => new Speed(double.PositiveInfinity, SpeedUnit.MeterPerSecond)); + var exception2 = Record.Exception(() => new Speed(double.NegativeInfinity, SpeedUnit.MeterPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Speed(double.NaN, SpeedUnit.MeterPerSecond)); + var exception = Record.Exception(() => new Speed(double.NaN, SpeedUnit.MeterPerSecond)); + + Assert.Null(exception); } [Fact] @@ -247,9 +252,9 @@ public void MeterPerSecondToSpeedUnits() { Speed meterpersecond = Speed.FromMetersPerSecond(1); AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, meterpersecond.CentimetersPerHour, CentimetersPerHourTolerance); - AssertEx.EqualTolerance(CentimetersPerMinutesInOneMeterPerSecond, meterpersecond.CentimetersPerMinutes, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(CentimetersPerMinuteInOneMeterPerSecond, meterpersecond.CentimetersPerMinute, CentimetersPerMinuteTolerance); AssertEx.EqualTolerance(CentimetersPerSecondInOneMeterPerSecond, meterpersecond.CentimetersPerSecond, CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(DecimetersPerMinutesInOneMeterPerSecond, meterpersecond.DecimetersPerMinutes, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(DecimetersPerMinuteInOneMeterPerSecond, meterpersecond.DecimetersPerMinute, DecimetersPerMinuteTolerance); AssertEx.EqualTolerance(DecimetersPerSecondInOneMeterPerSecond, meterpersecond.DecimetersPerSecond, DecimetersPerSecondTolerance); AssertEx.EqualTolerance(FeetPerHourInOneMeterPerSecond, meterpersecond.FeetPerHour, FeetPerHourTolerance); AssertEx.EqualTolerance(FeetPerMinuteInOneMeterPerSecond, meterpersecond.FeetPerMinute, FeetPerMinuteTolerance); @@ -258,20 +263,20 @@ public void MeterPerSecondToSpeedUnits() AssertEx.EqualTolerance(InchesPerMinuteInOneMeterPerSecond, meterpersecond.InchesPerMinute, InchesPerMinuteTolerance); AssertEx.EqualTolerance(InchesPerSecondInOneMeterPerSecond, meterpersecond.InchesPerSecond, InchesPerSecondTolerance); AssertEx.EqualTolerance(KilometersPerHourInOneMeterPerSecond, meterpersecond.KilometersPerHour, KilometersPerHourTolerance); - AssertEx.EqualTolerance(KilometersPerMinutesInOneMeterPerSecond, meterpersecond.KilometersPerMinutes, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(KilometersPerMinuteInOneMeterPerSecond, meterpersecond.KilometersPerMinute, KilometersPerMinuteTolerance); AssertEx.EqualTolerance(KilometersPerSecondInOneMeterPerSecond, meterpersecond.KilometersPerSecond, KilometersPerSecondTolerance); AssertEx.EqualTolerance(KnotsInOneMeterPerSecond, meterpersecond.Knots, KnotsTolerance); AssertEx.EqualTolerance(MachInOneMeterPerSecond, meterpersecond.Mach, MachTolerance); AssertEx.EqualTolerance(MetersPerHourInOneMeterPerSecond, meterpersecond.MetersPerHour, MetersPerHourTolerance); - AssertEx.EqualTolerance(MetersPerMinutesInOneMeterPerSecond, meterpersecond.MetersPerMinutes, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(MetersPerMinuteInOneMeterPerSecond, meterpersecond.MetersPerMinute, MetersPerMinuteTolerance); AssertEx.EqualTolerance(MetersPerSecondInOneMeterPerSecond, meterpersecond.MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(MicrometersPerMinutesInOneMeterPerSecond, meterpersecond.MicrometersPerMinutes, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(MicrometersPerMinuteInOneMeterPerSecond, meterpersecond.MicrometersPerMinute, MicrometersPerMinuteTolerance); AssertEx.EqualTolerance(MicrometersPerSecondInOneMeterPerSecond, meterpersecond.MicrometersPerSecond, MicrometersPerSecondTolerance); AssertEx.EqualTolerance(MilesPerHourInOneMeterPerSecond, meterpersecond.MilesPerHour, MilesPerHourTolerance); AssertEx.EqualTolerance(MillimetersPerHourInOneMeterPerSecond, meterpersecond.MillimetersPerHour, MillimetersPerHourTolerance); - AssertEx.EqualTolerance(MillimetersPerMinutesInOneMeterPerSecond, meterpersecond.MillimetersPerMinutes, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(MillimetersPerMinuteInOneMeterPerSecond, meterpersecond.MillimetersPerMinute, MillimetersPerMinuteTolerance); AssertEx.EqualTolerance(MillimetersPerSecondInOneMeterPerSecond, meterpersecond.MillimetersPerSecond, MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(NanometersPerMinutesInOneMeterPerSecond, meterpersecond.NanometersPerMinutes, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(NanometersPerMinuteInOneMeterPerSecond, meterpersecond.NanometersPerMinute, NanometersPerMinuteTolerance); AssertEx.EqualTolerance(NanometersPerSecondInOneMeterPerSecond, meterpersecond.NanometersPerSecond, NanometersPerSecondTolerance); AssertEx.EqualTolerance(UsSurveyFeetPerHourInOneMeterPerSecond, meterpersecond.UsSurveyFeetPerHour, UsSurveyFeetPerHourTolerance); AssertEx.EqualTolerance(UsSurveyFeetPerMinuteInOneMeterPerSecond, meterpersecond.UsSurveyFeetPerMinute, UsSurveyFeetPerMinuteTolerance); @@ -289,7 +294,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(SpeedUnit.CentimeterPerHour, quantity00.Unit); var quantity01 = Speed.From(1, SpeedUnit.CentimeterPerMinute); - AssertEx.EqualTolerance(1, quantity01.CentimetersPerMinutes, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity01.CentimetersPerMinute, CentimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.CentimeterPerMinute, quantity01.Unit); var quantity02 = Speed.From(1, SpeedUnit.CentimeterPerSecond); @@ -297,7 +302,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(SpeedUnit.CentimeterPerSecond, quantity02.Unit); var quantity03 = Speed.From(1, SpeedUnit.DecimeterPerMinute); - AssertEx.EqualTolerance(1, quantity03.DecimetersPerMinutes, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity03.DecimetersPerMinute, DecimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.DecimeterPerMinute, quantity03.Unit); var quantity04 = Speed.From(1, SpeedUnit.DecimeterPerSecond); @@ -333,7 +338,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(SpeedUnit.KilometerPerHour, quantity11.Unit); var quantity12 = Speed.From(1, SpeedUnit.KilometerPerMinute); - AssertEx.EqualTolerance(1, quantity12.KilometersPerMinutes, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity12.KilometersPerMinute, KilometersPerMinuteTolerance); Assert.Equal(SpeedUnit.KilometerPerMinute, quantity12.Unit); var quantity13 = Speed.From(1, SpeedUnit.KilometerPerSecond); @@ -353,7 +358,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(SpeedUnit.MeterPerHour, quantity16.Unit); var quantity17 = Speed.From(1, SpeedUnit.MeterPerMinute); - AssertEx.EqualTolerance(1, quantity17.MetersPerMinutes, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity17.MetersPerMinute, MetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MeterPerMinute, quantity17.Unit); var quantity18 = Speed.From(1, SpeedUnit.MeterPerSecond); @@ -361,7 +366,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(SpeedUnit.MeterPerSecond, quantity18.Unit); var quantity19 = Speed.From(1, SpeedUnit.MicrometerPerMinute); - AssertEx.EqualTolerance(1, quantity19.MicrometersPerMinutes, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity19.MicrometersPerMinute, MicrometersPerMinuteTolerance); Assert.Equal(SpeedUnit.MicrometerPerMinute, quantity19.Unit); var quantity20 = Speed.From(1, SpeedUnit.MicrometerPerSecond); @@ -377,7 +382,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(SpeedUnit.MillimeterPerHour, quantity22.Unit); var quantity23 = Speed.From(1, SpeedUnit.MillimeterPerMinute); - AssertEx.EqualTolerance(1, quantity23.MillimetersPerMinutes, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity23.MillimetersPerMinute, MillimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MillimeterPerMinute, quantity23.Unit); var quantity24 = Speed.From(1, SpeedUnit.MillimeterPerSecond); @@ -385,7 +390,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Assert.Equal(SpeedUnit.MillimeterPerSecond, quantity24.Unit); var quantity25 = Speed.From(1, SpeedUnit.NanometerPerMinute); - AssertEx.EqualTolerance(1, quantity25.NanometersPerMinutes, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, quantity25.NanometersPerMinute, NanometersPerMinuteTolerance); Assert.Equal(SpeedUnit.NanometerPerMinute, quantity25.Unit); var quantity26 = Speed.From(1, SpeedUnit.NanometerPerSecond); @@ -419,16 +424,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromMetersPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Speed.FromMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => Speed.FromMetersPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Speed.FromMetersPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Speed.FromMetersPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMetersPerSecond_WithNanValue_ThrowsArgumentException() + public void FromMetersPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Speed.FromMetersPerSecond(double.NaN)); + var exception = Record.Exception(() => Speed.FromMetersPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] @@ -436,9 +446,9 @@ public void As() { var meterpersecond = Speed.FromMetersPerSecond(1); AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerHour), CentimetersPerHourTolerance); - AssertEx.EqualTolerance(CentimetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerMinute), CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(CentimetersPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerMinute), CentimetersPerMinuteTolerance); AssertEx.EqualTolerance(CentimetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerSecond), CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(DecimetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.DecimeterPerMinute), DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(DecimetersPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.DecimeterPerMinute), DecimetersPerMinuteTolerance); AssertEx.EqualTolerance(DecimetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.DecimeterPerSecond), DecimetersPerSecondTolerance); AssertEx.EqualTolerance(FeetPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.FootPerHour), FeetPerHourTolerance); AssertEx.EqualTolerance(FeetPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.FootPerMinute), FeetPerMinuteTolerance); @@ -447,20 +457,20 @@ public void As() AssertEx.EqualTolerance(InchesPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.InchPerMinute), InchesPerMinuteTolerance); AssertEx.EqualTolerance(InchesPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.InchPerSecond), InchesPerSecondTolerance); AssertEx.EqualTolerance(KilometersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.KilometerPerHour), KilometersPerHourTolerance); - AssertEx.EqualTolerance(KilometersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.KilometerPerMinute), KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(KilometersPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.KilometerPerMinute), KilometersPerMinuteTolerance); AssertEx.EqualTolerance(KilometersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.KilometerPerSecond), KilometersPerSecondTolerance); AssertEx.EqualTolerance(KnotsInOneMeterPerSecond, meterpersecond.As(SpeedUnit.Knot), KnotsTolerance); AssertEx.EqualTolerance(MachInOneMeterPerSecond, meterpersecond.As(SpeedUnit.Mach), MachTolerance); AssertEx.EqualTolerance(MetersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MeterPerHour), MetersPerHourTolerance); - AssertEx.EqualTolerance(MetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MeterPerMinute), MetersPerMinutesTolerance); + AssertEx.EqualTolerance(MetersPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MeterPerMinute), MetersPerMinuteTolerance); AssertEx.EqualTolerance(MetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MeterPerSecond), MetersPerSecondTolerance); - AssertEx.EqualTolerance(MicrometersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MicrometerPerMinute), MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(MicrometersPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MicrometerPerMinute), MicrometersPerMinuteTolerance); AssertEx.EqualTolerance(MicrometersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MicrometerPerSecond), MicrometersPerSecondTolerance); AssertEx.EqualTolerance(MilesPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MilePerHour), MilesPerHourTolerance); AssertEx.EqualTolerance(MillimetersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MillimeterPerHour), MillimetersPerHourTolerance); - AssertEx.EqualTolerance(MillimetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MillimeterPerMinute), MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(MillimetersPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MillimeterPerMinute), MillimetersPerMinuteTolerance); AssertEx.EqualTolerance(MillimetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MillimeterPerSecond), MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(NanometersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.NanometerPerMinute), NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(NanometersPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.NanometerPerMinute), NanometersPerMinuteTolerance); AssertEx.EqualTolerance(NanometersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.NanometerPerSecond), NanometersPerSecondTolerance); AssertEx.EqualTolerance(UsSurveyFeetPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.UsSurveyFootPerHour), UsSurveyFeetPerHourTolerance); AssertEx.EqualTolerance(UsSurveyFeetPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.UsSurveyFootPerMinute), UsSurveyFeetPerMinuteTolerance); @@ -507,14 +517,14 @@ public void Parse() try { var parsed = Speed.Parse("1 cm/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.CentimetersPerMinutes, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.CentimetersPerMinute, CentimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.CentimeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = Speed.Parse("1 см/мин", CultureInfo.GetCultureInfo("ru-RU")); - AssertEx.EqualTolerance(1, parsed.CentimetersPerMinutes, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.CentimetersPerMinute, CentimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.CentimeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -535,14 +545,14 @@ public void Parse() try { var parsed = Speed.Parse("1 dm/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.DecimetersPerMinutes, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.DecimetersPerMinute, DecimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.DecimeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = Speed.Parse("1 дм/мин", CultureInfo.GetCultureInfo("ru-RU")); - AssertEx.EqualTolerance(1, parsed.DecimetersPerMinutes, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.DecimetersPerMinute, DecimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.DecimeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -640,14 +650,14 @@ public void Parse() try { var parsed = Speed.Parse("1 km/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.KilometersPerMinutes, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.KilometersPerMinute, KilometersPerMinuteTolerance); Assert.Equal(SpeedUnit.KilometerPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = Speed.Parse("1 км/мин", CultureInfo.GetCultureInfo("ru-RU")); - AssertEx.EqualTolerance(1, parsed.KilometersPerMinutes, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.KilometersPerMinute, KilometersPerMinuteTolerance); Assert.Equal(SpeedUnit.KilometerPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -752,14 +762,14 @@ public void Parse() try { var parsed = Speed.Parse("1 m/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MetersPerMinutes, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MetersPerMinute, MetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = Speed.Parse("1 м/мин", CultureInfo.GetCultureInfo("ru-RU")); - AssertEx.EqualTolerance(1, parsed.MetersPerMinutes, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MetersPerMinute, MetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -780,14 +790,14 @@ public void Parse() try { var parsed = Speed.Parse("1 µm/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MicrometersPerMinutes, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MicrometersPerMinute, MicrometersPerMinuteTolerance); Assert.Equal(SpeedUnit.MicrometerPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = Speed.Parse("1 мкм/мин", CultureInfo.GetCultureInfo("ru-RU")); - AssertEx.EqualTolerance(1, parsed.MicrometersPerMinutes, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MicrometersPerMinute, MicrometersPerMinuteTolerance); Assert.Equal(SpeedUnit.MicrometerPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -836,14 +846,14 @@ public void Parse() try { var parsed = Speed.Parse("1 mm/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MillimetersPerMinutes, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MillimetersPerMinute, MillimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MillimeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = Speed.Parse("1 мм/мин", CultureInfo.GetCultureInfo("ru-RU")); - AssertEx.EqualTolerance(1, parsed.MillimetersPerMinutes, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MillimetersPerMinute, MillimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MillimeterPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -864,14 +874,14 @@ public void Parse() try { var parsed = Speed.Parse("1 nm/min", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.NanometersPerMinutes, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.NanometersPerMinute, NanometersPerMinuteTolerance); Assert.Equal(SpeedUnit.NanometerPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = Speed.Parse("1 нм/мин", CultureInfo.GetCultureInfo("ru-RU")); - AssertEx.EqualTolerance(1, parsed.NanometersPerMinutes, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.NanometersPerMinute, NanometersPerMinuteTolerance); Assert.Equal(SpeedUnit.NanometerPerMinute, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -950,13 +960,13 @@ public void TryParse() { Assert.True(Speed.TryParse("1 cm/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.CentimetersPerMinutes, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.CentimetersPerMinute, CentimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.CentimeterPerMinute, parsed.Unit); } { Assert.True(Speed.TryParse("1 см/мин", CultureInfo.GetCultureInfo("ru-RU"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.CentimetersPerMinutes, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.CentimetersPerMinute, CentimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.CentimeterPerMinute, parsed.Unit); } @@ -974,13 +984,13 @@ public void TryParse() { Assert.True(Speed.TryParse("1 dm/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.DecimetersPerMinutes, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.DecimetersPerMinute, DecimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.DecimeterPerMinute, parsed.Unit); } { Assert.True(Speed.TryParse("1 дм/мин", CultureInfo.GetCultureInfo("ru-RU"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.DecimetersPerMinutes, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.DecimetersPerMinute, DecimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.DecimeterPerMinute, parsed.Unit); } @@ -1064,13 +1074,13 @@ public void TryParse() { Assert.True(Speed.TryParse("1 km/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.KilometersPerMinutes, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.KilometersPerMinute, KilometersPerMinuteTolerance); Assert.Equal(SpeedUnit.KilometerPerMinute, parsed.Unit); } { Assert.True(Speed.TryParse("1 км/мин", CultureInfo.GetCultureInfo("ru-RU"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.KilometersPerMinutes, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.KilometersPerMinute, KilometersPerMinuteTolerance); Assert.Equal(SpeedUnit.KilometerPerMinute, parsed.Unit); } @@ -1160,13 +1170,13 @@ public void TryParse() { Assert.True(Speed.TryParse("1 m/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MetersPerMinutes, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MetersPerMinute, MetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MeterPerMinute, parsed.Unit); } { Assert.True(Speed.TryParse("1 м/мин", CultureInfo.GetCultureInfo("ru-RU"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MetersPerMinutes, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MetersPerMinute, MetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MeterPerMinute, parsed.Unit); } @@ -1184,13 +1194,13 @@ public void TryParse() { Assert.True(Speed.TryParse("1 µm/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MicrometersPerMinutes, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MicrometersPerMinute, MicrometersPerMinuteTolerance); Assert.Equal(SpeedUnit.MicrometerPerMinute, parsed.Unit); } { Assert.True(Speed.TryParse("1 мкм/мин", CultureInfo.GetCultureInfo("ru-RU"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MicrometersPerMinutes, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MicrometersPerMinute, MicrometersPerMinuteTolerance); Assert.Equal(SpeedUnit.MicrometerPerMinute, parsed.Unit); } @@ -1232,13 +1242,13 @@ public void TryParse() { Assert.True(Speed.TryParse("1 mm/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MillimetersPerMinutes, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MillimetersPerMinute, MillimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MillimeterPerMinute, parsed.Unit); } { Assert.True(Speed.TryParse("1 мм/мин", CultureInfo.GetCultureInfo("ru-RU"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.MillimetersPerMinutes, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.MillimetersPerMinute, MillimetersPerMinuteTolerance); Assert.Equal(SpeedUnit.MillimeterPerMinute, parsed.Unit); } @@ -1256,13 +1266,13 @@ public void TryParse() { Assert.True(Speed.TryParse("1 nm/min", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.NanometersPerMinutes, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.NanometersPerMinute, NanometersPerMinuteTolerance); Assert.Equal(SpeedUnit.NanometerPerMinute, parsed.Unit); } { Assert.True(Speed.TryParse("1 нм/мин", CultureInfo.GetCultureInfo("ru-RU"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.NanometersPerMinutes, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, parsed.NanometersPerMinute, NanometersPerMinuteTolerance); Assert.Equal(SpeedUnit.NanometerPerMinute, parsed.Unit); } @@ -2066,9 +2076,9 @@ public void ConversionRoundTrip() { Speed meterpersecond = Speed.FromMetersPerSecond(1); AssertEx.EqualTolerance(1, Speed.FromCentimetersPerHour(meterpersecond.CentimetersPerHour).MetersPerSecond, CentimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromCentimetersPerMinutes(meterpersecond.CentimetersPerMinutes).MetersPerSecond, CentimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromCentimetersPerMinute(meterpersecond.CentimetersPerMinute).MetersPerSecond, CentimetersPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromCentimetersPerSecond(meterpersecond.CentimetersPerSecond).MetersPerSecond, CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromDecimetersPerMinutes(meterpersecond.DecimetersPerMinutes).MetersPerSecond, DecimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromDecimetersPerMinute(meterpersecond.DecimetersPerMinute).MetersPerSecond, DecimetersPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromDecimetersPerSecond(meterpersecond.DecimetersPerSecond).MetersPerSecond, DecimetersPerSecondTolerance); AssertEx.EqualTolerance(1, Speed.FromFeetPerHour(meterpersecond.FeetPerHour).MetersPerSecond, FeetPerHourTolerance); AssertEx.EqualTolerance(1, Speed.FromFeetPerMinute(meterpersecond.FeetPerMinute).MetersPerSecond, FeetPerMinuteTolerance); @@ -2077,20 +2087,20 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Speed.FromInchesPerMinute(meterpersecond.InchesPerMinute).MetersPerSecond, InchesPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromInchesPerSecond(meterpersecond.InchesPerSecond).MetersPerSecond, InchesPerSecondTolerance); AssertEx.EqualTolerance(1, Speed.FromKilometersPerHour(meterpersecond.KilometersPerHour).MetersPerSecond, KilometersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromKilometersPerMinutes(meterpersecond.KilometersPerMinutes).MetersPerSecond, KilometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromKilometersPerMinute(meterpersecond.KilometersPerMinute).MetersPerSecond, KilometersPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromKilometersPerSecond(meterpersecond.KilometersPerSecond).MetersPerSecond, KilometersPerSecondTolerance); AssertEx.EqualTolerance(1, Speed.FromKnots(meterpersecond.Knots).MetersPerSecond, KnotsTolerance); AssertEx.EqualTolerance(1, Speed.FromMach(meterpersecond.Mach).MetersPerSecond, MachTolerance); AssertEx.EqualTolerance(1, Speed.FromMetersPerHour(meterpersecond.MetersPerHour).MetersPerSecond, MetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMetersPerMinutes(meterpersecond.MetersPerMinutes).MetersPerSecond, MetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromMetersPerMinute(meterpersecond.MetersPerMinute).MetersPerSecond, MetersPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromMetersPerSecond(meterpersecond.MetersPerSecond).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromMicrometersPerMinutes(meterpersecond.MicrometersPerMinutes).MetersPerSecond, MicrometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromMicrometersPerMinute(meterpersecond.MicrometersPerMinute).MetersPerSecond, MicrometersPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromMicrometersPerSecond(meterpersecond.MicrometersPerSecond).MetersPerSecond, MicrometersPerSecondTolerance); AssertEx.EqualTolerance(1, Speed.FromMilesPerHour(meterpersecond.MilesPerHour).MetersPerSecond, MilesPerHourTolerance); AssertEx.EqualTolerance(1, Speed.FromMillimetersPerHour(meterpersecond.MillimetersPerHour).MetersPerSecond, MillimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMillimetersPerMinutes(meterpersecond.MillimetersPerMinutes).MetersPerSecond, MillimetersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromMillimetersPerMinute(meterpersecond.MillimetersPerMinute).MetersPerSecond, MillimetersPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromMillimetersPerSecond(meterpersecond.MillimetersPerSecond).MetersPerSecond, MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromNanometersPerMinutes(meterpersecond.NanometersPerMinutes).MetersPerSecond, NanometersPerMinutesTolerance); + AssertEx.EqualTolerance(1, Speed.FromNanometersPerMinute(meterpersecond.NanometersPerMinute).MetersPerSecond, NanometersPerMinuteTolerance); AssertEx.EqualTolerance(1, Speed.FromNanometersPerSecond(meterpersecond.NanometersPerSecond).MetersPerSecond, NanometersPerSecondTolerance); AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerHour(meterpersecond.UsSurveyFeetPerHour).MetersPerSecond, UsSurveyFeetPerHourTolerance); AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerMinute(meterpersecond.UsSurveyFeetPerMinute).MetersPerSecond, UsSurveyFeetPerMinuteTolerance); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs index d4567dd0c2..1d09dc4657 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new StandardVolumeFlow(double.PositiveInfinity, StandardVolumeFlowUnit.StandardCubicMeterPerSecond)); - Assert.Throws(() => new StandardVolumeFlow(double.NegativeInfinity, StandardVolumeFlowUnit.StandardCubicMeterPerSecond)); + var exception1 = Record.Exception(() => new StandardVolumeFlow(double.PositiveInfinity, StandardVolumeFlowUnit.StandardCubicMeterPerSecond)); + var exception2 = Record.Exception(() => new StandardVolumeFlow(double.NegativeInfinity, StandardVolumeFlowUnit.StandardCubicMeterPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new StandardVolumeFlow(double.NaN, StandardVolumeFlowUnit.StandardCubicMeterPerSecond)); + var exception = Record.Exception(() => new StandardVolumeFlow(double.NaN, StandardVolumeFlowUnit.StandardCubicMeterPerSecond)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromStandardCubicMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromStandardCubicMetersPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => StandardVolumeFlow.FromStandardCubicMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => StandardVolumeFlow.FromStandardCubicMetersPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => StandardVolumeFlow.FromStandardCubicMetersPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => StandardVolumeFlow.FromStandardCubicMetersPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromStandardCubicMetersPerSecond_WithNanValue_ThrowsArgumentException() + public void FromStandardCubicMetersPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => StandardVolumeFlow.FromStandardCubicMetersPerSecond(double.NaN)); + var exception = Record.Exception(() => StandardVolumeFlow.FromStandardCubicMetersPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs index 6ddf89e0b8..d90248a5ff 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs @@ -103,16 +103,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TemperatureChangeRate(double.PositiveInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); - Assert.Throws(() => new TemperatureChangeRate(double.NegativeInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + var exception1 = Record.Exception(() => new TemperatureChangeRate(double.PositiveInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + var exception2 = Record.Exception(() => new TemperatureChangeRate(double.NegativeInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TemperatureChangeRate(double.NaN, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + var exception = Record.Exception(() => new TemperatureChangeRate(double.NaN, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + + Assert.Null(exception); } [Fact] @@ -212,16 +217,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDegreesCelsiusPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromDegreesCelsiusPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.PositiveInfinity)); - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDegreesCelsiusPerSecond_WithNanValue_ThrowsArgumentException() + public void FromDegreesCelsiusPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NaN)); + var exception = Record.Exception(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs index bcad90eb83..1c4304861d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TemperatureDelta(double.PositiveInfinity, TemperatureDeltaUnit.Kelvin)); - Assert.Throws(() => new TemperatureDelta(double.NegativeInfinity, TemperatureDeltaUnit.Kelvin)); + var exception1 = Record.Exception(() => new TemperatureDelta(double.PositiveInfinity, TemperatureDeltaUnit.Kelvin)); + var exception2 = Record.Exception(() => new TemperatureDelta(double.NegativeInfinity, TemperatureDeltaUnit.Kelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TemperatureDelta(double.NaN, TemperatureDeltaUnit.Kelvin)); + var exception = Record.Exception(() => new TemperatureDelta(double.NaN, TemperatureDeltaUnit.Kelvin)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKelvins_WithInfinityValue_ThrowsArgumentException() + public void FromKelvins_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TemperatureDelta.FromKelvins(double.PositiveInfinity)); - Assert.Throws(() => TemperatureDelta.FromKelvins(double.NegativeInfinity)); + var exception1 = Record.Exception(() => TemperatureDelta.FromKelvins(double.PositiveInfinity)); + var exception2 = Record.Exception(() => TemperatureDelta.FromKelvins(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKelvins_WithNanValue_ThrowsArgumentException() + public void FromKelvins_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TemperatureDelta.FromKelvins(double.NaN)); + var exception = Record.Exception(() => TemperatureDelta.FromKelvins(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs index 316f9dff2a..6e983b0018 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs @@ -38,14 +38,14 @@ namespace UnitsNet.Tests // ReSharper disable once PartialTypeWithSinglePart public abstract partial class TemperatureGradientTestsBase : QuantityTestsBase { - protected abstract double DegreesCelciusPerKilometerInOneKelvinPerMeter { get; } - protected abstract double DegreesCelciusPerMeterInOneKelvinPerMeter { get; } + protected abstract double DegreesCelsiusPerKilometerInOneKelvinPerMeter { get; } + protected abstract double DegreesCelsiusPerMeterInOneKelvinPerMeter { get; } protected abstract double DegreesFahrenheitPerFootInOneKelvinPerMeter { get; } protected abstract double KelvinsPerMeterInOneKelvinPerMeter { get; } // ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DegreesCelciusPerKilometerTolerance { get { return 1e-5; } } - protected virtual double DegreesCelciusPerMeterTolerance { get { return 1e-5; } } + protected virtual double DegreesCelsiusPerKilometerTolerance { get { return 1e-5; } } + protected virtual double DegreesCelsiusPerMeterTolerance { get { return 1e-5; } } protected virtual double DegreesFahrenheitPerFootTolerance { get { return 1e-5; } } protected virtual double KelvinsPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global @@ -54,8 +54,8 @@ public abstract partial class TemperatureGradientTestsBase : QuantityTestsBase { return unit switch { - TemperatureGradientUnit.DegreeCelsiusPerKilometer => (DegreesCelciusPerKilometerInOneKelvinPerMeter, DegreesCelciusPerKilometerTolerance), - TemperatureGradientUnit.DegreeCelsiusPerMeter => (DegreesCelciusPerMeterInOneKelvinPerMeter, DegreesCelciusPerMeterTolerance), + TemperatureGradientUnit.DegreeCelsiusPerKilometer => (DegreesCelsiusPerKilometerInOneKelvinPerMeter, DegreesCelsiusPerKilometerTolerance), + TemperatureGradientUnit.DegreeCelsiusPerMeter => (DegreesCelsiusPerMeterInOneKelvinPerMeter, DegreesCelsiusPerMeterTolerance), TemperatureGradientUnit.DegreeFahrenheitPerFoot => (DegreesFahrenheitPerFootInOneKelvinPerMeter, DegreesFahrenheitPerFootTolerance), TemperatureGradientUnit.KelvinPerMeter => (KelvinsPerMeterInOneKelvinPerMeter, KelvinsPerMeterTolerance), _ => throw new NotSupportedException() @@ -79,16 +79,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TemperatureGradient(double.PositiveInfinity, TemperatureGradientUnit.KelvinPerMeter)); - Assert.Throws(() => new TemperatureGradient(double.NegativeInfinity, TemperatureGradientUnit.KelvinPerMeter)); + var exception1 = Record.Exception(() => new TemperatureGradient(double.PositiveInfinity, TemperatureGradientUnit.KelvinPerMeter)); + var exception2 = Record.Exception(() => new TemperatureGradient(double.NegativeInfinity, TemperatureGradientUnit.KelvinPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TemperatureGradient(double.NaN, TemperatureGradientUnit.KelvinPerMeter)); + var exception = Record.Exception(() => new TemperatureGradient(double.NaN, TemperatureGradientUnit.KelvinPerMeter)); + + Assert.Null(exception); } [Fact] @@ -130,8 +135,8 @@ public void TemperatureGradient_QuantityInfo_ReturnsQuantityInfoDescribingQuanti public void KelvinPerMeterToTemperatureGradientUnits() { TemperatureGradient kelvinpermeter = TemperatureGradient.FromKelvinsPerMeter(1); - AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneKelvinPerMeter, kelvinpermeter.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(DegreesCelciusPerMeterInOneKelvinPerMeter, kelvinpermeter.DegreesCelciusPerMeter, DegreesCelciusPerMeterTolerance); + AssertEx.EqualTolerance(DegreesCelsiusPerKilometerInOneKelvinPerMeter, kelvinpermeter.DegreesCelsiusPerKilometer, DegreesCelsiusPerKilometerTolerance); + AssertEx.EqualTolerance(DegreesCelsiusPerMeterInOneKelvinPerMeter, kelvinpermeter.DegreesCelsiusPerMeter, DegreesCelsiusPerMeterTolerance); AssertEx.EqualTolerance(DegreesFahrenheitPerFootInOneKelvinPerMeter, kelvinpermeter.DegreesFahrenheitPerFoot, DegreesFahrenheitPerFootTolerance); AssertEx.EqualTolerance(KelvinsPerMeterInOneKelvinPerMeter, kelvinpermeter.KelvinsPerMeter, KelvinsPerMeterTolerance); } @@ -140,11 +145,11 @@ public void KelvinPerMeterToTemperatureGradientUnits() public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() { var quantity00 = TemperatureGradient.From(1, TemperatureGradientUnit.DegreeCelsiusPerKilometer); - AssertEx.EqualTolerance(1, quantity00.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); + AssertEx.EqualTolerance(1, quantity00.DegreesCelsiusPerKilometer, DegreesCelsiusPerKilometerTolerance); Assert.Equal(TemperatureGradientUnit.DegreeCelsiusPerKilometer, quantity00.Unit); var quantity01 = TemperatureGradient.From(1, TemperatureGradientUnit.DegreeCelsiusPerMeter); - AssertEx.EqualTolerance(1, quantity01.DegreesCelciusPerMeter, DegreesCelciusPerMeterTolerance); + AssertEx.EqualTolerance(1, quantity01.DegreesCelsiusPerMeter, DegreesCelsiusPerMeterTolerance); Assert.Equal(TemperatureGradientUnit.DegreeCelsiusPerMeter, quantity01.Unit); var quantity02 = TemperatureGradient.From(1, TemperatureGradientUnit.DegreeFahrenheitPerFoot); @@ -158,24 +163,29 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKelvinsPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromKelvinsPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TemperatureGradient.FromKelvinsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => TemperatureGradient.FromKelvinsPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => TemperatureGradient.FromKelvinsPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => TemperatureGradient.FromKelvinsPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKelvinsPerMeter_WithNanValue_ThrowsArgumentException() + public void FromKelvinsPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TemperatureGradient.FromKelvinsPerMeter(double.NaN)); + var exception = Record.Exception(() => TemperatureGradient.FromKelvinsPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] public void As() { var kelvinpermeter = TemperatureGradient.FromKelvinsPerMeter(1); - AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneKelvinPerMeter, kelvinpermeter.As(TemperatureGradientUnit.DegreeCelsiusPerKilometer), DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(DegreesCelciusPerMeterInOneKelvinPerMeter, kelvinpermeter.As(TemperatureGradientUnit.DegreeCelsiusPerMeter), DegreesCelciusPerMeterTolerance); + AssertEx.EqualTolerance(DegreesCelsiusPerKilometerInOneKelvinPerMeter, kelvinpermeter.As(TemperatureGradientUnit.DegreeCelsiusPerKilometer), DegreesCelsiusPerKilometerTolerance); + AssertEx.EqualTolerance(DegreesCelsiusPerMeterInOneKelvinPerMeter, kelvinpermeter.As(TemperatureGradientUnit.DegreeCelsiusPerMeter), DegreesCelsiusPerMeterTolerance); AssertEx.EqualTolerance(DegreesFahrenheitPerFootInOneKelvinPerMeter, kelvinpermeter.As(TemperatureGradientUnit.DegreeFahrenheitPerFoot), DegreesFahrenheitPerFootTolerance); AssertEx.EqualTolerance(KelvinsPerMeterInOneKelvinPerMeter, kelvinpermeter.As(TemperatureGradientUnit.KelvinPerMeter), KelvinsPerMeterTolerance); } @@ -203,14 +213,14 @@ public void Parse() try { var parsed = TemperatureGradient.Parse("1 ∆°C/km", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); + AssertEx.EqualTolerance(1, parsed.DegreesCelsiusPerKilometer, DegreesCelsiusPerKilometerTolerance); Assert.Equal(TemperatureGradientUnit.DegreeCelsiusPerKilometer, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { var parsed = TemperatureGradient.Parse("1 ∆°C/m", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.DegreesCelciusPerMeter, DegreesCelciusPerMeterTolerance); + AssertEx.EqualTolerance(1, parsed.DegreesCelsiusPerMeter, DegreesCelsiusPerMeterTolerance); Assert.Equal(TemperatureGradientUnit.DegreeCelsiusPerMeter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } @@ -235,13 +245,13 @@ public void TryParse() { { Assert.True(TemperatureGradient.TryParse("1 ∆°C/km", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); + AssertEx.EqualTolerance(1, parsed.DegreesCelsiusPerKilometer, DegreesCelsiusPerKilometerTolerance); Assert.Equal(TemperatureGradientUnit.DegreeCelsiusPerKilometer, parsed.Unit); } { Assert.True(TemperatureGradient.TryParse("1 ∆°C/m", CultureInfo.GetCultureInfo("en-US"), out var parsed)); - AssertEx.EqualTolerance(1, parsed.DegreesCelciusPerMeter, DegreesCelciusPerMeterTolerance); + AssertEx.EqualTolerance(1, parsed.DegreesCelsiusPerMeter, DegreesCelsiusPerMeterTolerance); Assert.Equal(TemperatureGradientUnit.DegreeCelsiusPerMeter, parsed.Unit); } @@ -359,8 +369,8 @@ public virtual void ToUnit_FromDefaultQuantity_ReturnsQuantityWithGivenUnit(Temp public void ConversionRoundTrip() { TemperatureGradient kelvinpermeter = TemperatureGradient.FromKelvinsPerMeter(1); - AssertEx.EqualTolerance(1, TemperatureGradient.FromDegreesCelciusPerKilometer(kelvinpermeter.DegreesCelciusPerKilometer).KelvinsPerMeter, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(1, TemperatureGradient.FromDegreesCelciusPerMeter(kelvinpermeter.DegreesCelciusPerMeter).KelvinsPerMeter, DegreesCelciusPerMeterTolerance); + AssertEx.EqualTolerance(1, TemperatureGradient.FromDegreesCelsiusPerKilometer(kelvinpermeter.DegreesCelsiusPerKilometer).KelvinsPerMeter, DegreesCelsiusPerKilometerTolerance); + AssertEx.EqualTolerance(1, TemperatureGradient.FromDegreesCelsiusPerMeter(kelvinpermeter.DegreesCelsiusPerMeter).KelvinsPerMeter, DegreesCelsiusPerMeterTolerance); AssertEx.EqualTolerance(1, TemperatureGradient.FromDegreesFahrenheitPerFoot(kelvinpermeter.DegreesFahrenheitPerFoot).KelvinsPerMeter, DegreesFahrenheitPerFootTolerance); AssertEx.EqualTolerance(1, TemperatureGradient.FromKelvinsPerMeter(kelvinpermeter.KelvinsPerMeter).KelvinsPerMeter, KelvinsPerMeterTolerance); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs index 7bdd29dc4c..82937f5a70 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs @@ -103,16 +103,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Temperature(double.PositiveInfinity, TemperatureUnit.Kelvin)); - Assert.Throws(() => new Temperature(double.NegativeInfinity, TemperatureUnit.Kelvin)); + var exception1 = Record.Exception(() => new Temperature(double.PositiveInfinity, TemperatureUnit.Kelvin)); + var exception2 = Record.Exception(() => new Temperature(double.NegativeInfinity, TemperatureUnit.Kelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Temperature(double.NaN, TemperatureUnit.Kelvin)); + var exception = Record.Exception(() => new Temperature(double.NaN, TemperatureUnit.Kelvin)); + + Assert.Null(exception); } [Fact] @@ -212,16 +217,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromKelvins_WithInfinityValue_ThrowsArgumentException() + public void FromKelvins_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Temperature.FromKelvins(double.PositiveInfinity)); - Assert.Throws(() => Temperature.FromKelvins(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Temperature.FromKelvins(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Temperature.FromKelvins(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromKelvins_WithNanValue_ThrowsArgumentException() + public void FromKelvins_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Temperature.FromKelvins(double.NaN)); + var exception = Record.Exception(() => Temperature.FromKelvins(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs index 9227245c2b..5b2a396e05 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs @@ -71,16 +71,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ThermalConductivity(double.PositiveInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); - Assert.Throws(() => new ThermalConductivity(double.NegativeInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + var exception1 = Record.Exception(() => new ThermalConductivity(double.PositiveInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + var exception2 = Record.Exception(() => new ThermalConductivity(double.NegativeInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ThermalConductivity(double.NaN, ThermalConductivityUnit.WattPerMeterKelvin)); + var exception = Record.Exception(() => new ThermalConductivity(double.NaN, ThermalConductivityUnit.WattPerMeterKelvin)); + + Assert.Null(exception); } [Fact] @@ -140,16 +145,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromWattsPerMeterKelvin_WithInfinityValue_ThrowsArgumentException() + public void FromWattsPerMeterKelvin_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.PositiveInfinity)); - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ThermalConductivity.FromWattsPerMeterKelvin(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromWattsPerMeterKelvin_WithNanValue_ThrowsArgumentException() + public void FromWattsPerMeterKelvin_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NaN)); + var exception = Record.Exception(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs index ddfa254927..f85319ac12 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ThermalResistance(double.PositiveInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); - Assert.Throws(() => new ThermalResistance(double.NegativeInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + var exception1 = Record.Exception(() => new ThermalResistance(double.PositiveInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + var exception2 = Record.Exception(() => new ThermalResistance(double.NegativeInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new ThermalResistance(double.NaN, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + var exception = Record.Exception(() => new ThermalResistance(double.NaN, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromSquareMeterKelvinsPerKilowatt_WithInfinityValue_ThrowsArgumentException() + public void FromSquareMeterKelvinsPerKilowatt_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.PositiveInfinity)); - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NegativeInfinity)); + var exception1 = Record.Exception(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.PositiveInfinity)); + var exception2 = Record.Exception(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromSquareMeterKelvinsPerKilowatt_WithNanValue_ThrowsArgumentException() + public void FromSquareMeterKelvinsPerKilowatt_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NaN)); + var exception = Record.Exception(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs index 9a2f2bf6d8..8f0a386c7f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs @@ -147,16 +147,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TorquePerLength(double.PositiveInfinity, TorquePerLengthUnit.NewtonMeterPerMeter)); - Assert.Throws(() => new TorquePerLength(double.NegativeInfinity, TorquePerLengthUnit.NewtonMeterPerMeter)); + var exception1 = Record.Exception(() => new TorquePerLength(double.PositiveInfinity, TorquePerLengthUnit.NewtonMeterPerMeter)); + var exception2 = Record.Exception(() => new TorquePerLength(double.NegativeInfinity, TorquePerLengthUnit.NewtonMeterPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new TorquePerLength(double.NaN, TorquePerLengthUnit.NewtonMeterPerMeter)); + var exception = Record.Exception(() => new TorquePerLength(double.NaN, TorquePerLengthUnit.NewtonMeterPerMeter)); + + Assert.Null(exception); } [Fact] @@ -311,16 +316,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonMetersPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonMetersPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TorquePerLength.FromNewtonMetersPerMeter(double.PositiveInfinity)); - Assert.Throws(() => TorquePerLength.FromNewtonMetersPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => TorquePerLength.FromNewtonMetersPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => TorquePerLength.FromNewtonMetersPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonMetersPerMeter_WithNanValue_ThrowsArgumentException() + public void FromNewtonMetersPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => TorquePerLength.FromNewtonMetersPerMeter(double.NaN)); + var exception = Record.Exception(() => TorquePerLength.FromNewtonMetersPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs index 7875a5097f..77191658b1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs @@ -163,16 +163,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Torque(double.PositiveInfinity, TorqueUnit.NewtonMeter)); - Assert.Throws(() => new Torque(double.NegativeInfinity, TorqueUnit.NewtonMeter)); + var exception1 = Record.Exception(() => new Torque(double.PositiveInfinity, TorqueUnit.NewtonMeter)); + var exception2 = Record.Exception(() => new Torque(double.NegativeInfinity, TorqueUnit.NewtonMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Torque(double.NaN, TorqueUnit.NewtonMeter)); + var exception = Record.Exception(() => new Torque(double.NaN, TorqueUnit.NewtonMeter)); + + Assert.Null(exception); } [Fact] @@ -347,16 +352,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNewtonMeters_WithInfinityValue_ThrowsArgumentException() + public void FromNewtonMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Torque.FromNewtonMeters(double.PositiveInfinity)); - Assert.Throws(() => Torque.FromNewtonMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Torque.FromNewtonMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Torque.FromNewtonMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNewtonMeters_WithNanValue_ThrowsArgumentException() + public void FromNewtonMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Torque.FromNewtonMeters(double.NaN)); + var exception = Record.Exception(() => Torque.FromNewtonMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs index 394321a806..582a87ef91 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Turbidity(double.PositiveInfinity, TurbidityUnit.NTU)); - Assert.Throws(() => new Turbidity(double.NegativeInfinity, TurbidityUnit.NTU)); + var exception1 = Record.Exception(() => new Turbidity(double.PositiveInfinity, TurbidityUnit.NTU)); + var exception2 = Record.Exception(() => new Turbidity(double.NegativeInfinity, TurbidityUnit.NTU)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Turbidity(double.NaN, TurbidityUnit.NTU)); + var exception = Record.Exception(() => new Turbidity(double.NaN, TurbidityUnit.NTU)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromNTU_WithInfinityValue_ThrowsArgumentException() + public void FromNTU_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Turbidity.FromNTU(double.PositiveInfinity)); - Assert.Throws(() => Turbidity.FromNTU(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Turbidity.FromNTU(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Turbidity.FromNTU(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromNTU_WithNanValue_ThrowsArgumentException() + public void FromNTU_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Turbidity.FromNTU(double.NaN)); + var exception = Record.Exception(() => Turbidity.FromNTU(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs index eade4a13f4..75243790a9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs @@ -67,16 +67,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VitaminA(double.PositiveInfinity, VitaminAUnit.InternationalUnit)); - Assert.Throws(() => new VitaminA(double.NegativeInfinity, VitaminAUnit.InternationalUnit)); + var exception1 = Record.Exception(() => new VitaminA(double.PositiveInfinity, VitaminAUnit.InternationalUnit)); + var exception2 = Record.Exception(() => new VitaminA(double.NegativeInfinity, VitaminAUnit.InternationalUnit)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VitaminA(double.NaN, VitaminAUnit.InternationalUnit)); + var exception = Record.Exception(() => new VitaminA(double.NaN, VitaminAUnit.InternationalUnit)); + + Assert.Null(exception); } [Fact] @@ -131,16 +136,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromInternationalUnits_WithInfinityValue_ThrowsArgumentException() + public void FromInternationalUnits_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VitaminA.FromInternationalUnits(double.PositiveInfinity)); - Assert.Throws(() => VitaminA.FromInternationalUnits(double.NegativeInfinity)); + var exception1 = Record.Exception(() => VitaminA.FromInternationalUnits(double.PositiveInfinity)); + var exception2 = Record.Exception(() => VitaminA.FromInternationalUnits(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromInternationalUnits_WithNanValue_ThrowsArgumentException() + public void FromInternationalUnits_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VitaminA.FromInternationalUnits(double.NaN)); + var exception = Record.Exception(() => VitaminA.FromInternationalUnits(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs index e3f0c10976..887809dba8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs @@ -143,16 +143,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumeConcentration(double.PositiveInfinity, VolumeConcentrationUnit.DecimalFraction)); - Assert.Throws(() => new VolumeConcentration(double.NegativeInfinity, VolumeConcentrationUnit.DecimalFraction)); + var exception1 = Record.Exception(() => new VolumeConcentration(double.PositiveInfinity, VolumeConcentrationUnit.DecimalFraction)); + var exception2 = Record.Exception(() => new VolumeConcentration(double.NegativeInfinity, VolumeConcentrationUnit.DecimalFraction)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumeConcentration(double.NaN, VolumeConcentrationUnit.DecimalFraction)); + var exception = Record.Exception(() => new VolumeConcentration(double.NaN, VolumeConcentrationUnit.DecimalFraction)); + + Assert.Null(exception); } [Fact] @@ -302,16 +307,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() + public void FromDecimalFractions_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.PositiveInfinity)); - Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.NegativeInfinity)); + var exception1 = Record.Exception(() => VolumeConcentration.FromDecimalFractions(double.PositiveInfinity)); + var exception2 = Record.Exception(() => VolumeConcentration.FromDecimalFractions(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() + public void FromDecimalFractions_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumeConcentration.FromDecimalFractions(double.NaN)); + var exception = Record.Exception(() => VolumeConcentration.FromDecimalFractions(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs index 9fe1fa7c96..4a98311664 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs @@ -71,16 +71,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumeFlowPerArea(double.PositiveInfinity, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter)); - Assert.Throws(() => new VolumeFlowPerArea(double.NegativeInfinity, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter)); + var exception1 = Record.Exception(() => new VolumeFlowPerArea(double.PositiveInfinity, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter)); + var exception2 = Record.Exception(() => new VolumeFlowPerArea(double.NegativeInfinity, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumeFlowPerArea(double.NaN, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter)); + var exception = Record.Exception(() => new VolumeFlowPerArea(double.NaN, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter)); + + Assert.Null(exception); } [Fact] @@ -140,16 +145,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCubicMetersPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + public void FromCubicMetersPerSecondPerSquareMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCubicMetersPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException() + public void FromCubicMetersPerSecondPerSquareMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NaN)); + var exception = Record.Exception(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs index 04592a2148..18f5796513 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs @@ -331,16 +331,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumeFlow(double.PositiveInfinity, VolumeFlowUnit.CubicMeterPerSecond)); - Assert.Throws(() => new VolumeFlow(double.NegativeInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + var exception1 = Record.Exception(() => new VolumeFlow(double.PositiveInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + var exception2 = Record.Exception(() => new VolumeFlow(double.NegativeInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumeFlow(double.NaN, VolumeFlowUnit.CubicMeterPerSecond)); + var exception = Record.Exception(() => new VolumeFlow(double.NaN, VolumeFlowUnit.CubicMeterPerSecond)); + + Assert.Null(exception); } [Fact] @@ -725,16 +730,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCubicMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + public void FromCubicMetersPerSecond_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NegativeInfinity)); + var exception1 = Record.Exception(() => VolumeFlow.FromCubicMetersPerSecond(double.PositiveInfinity)); + var exception2 = Record.Exception(() => VolumeFlow.FromCubicMetersPerSecond(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCubicMetersPerSecond_WithNanValue_ThrowsArgumentException() + public void FromCubicMetersPerSecond_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NaN)); + var exception = Record.Exception(() => VolumeFlow.FromCubicMetersPerSecond(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs index 006ee6ab74..2277fcc6e5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumePerLength(double.PositiveInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); - Assert.Throws(() => new VolumePerLength(double.NegativeInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); + var exception1 = Record.Exception(() => new VolumePerLength(double.PositiveInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); + var exception2 = Record.Exception(() => new VolumePerLength(double.NegativeInfinity, VolumePerLengthUnit.CubicMeterPerMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumePerLength(double.NaN, VolumePerLengthUnit.CubicMeterPerMeter)); + var exception = Record.Exception(() => new VolumePerLength(double.NaN, VolumePerLengthUnit.CubicMeterPerMeter)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCubicMetersPerMeter_WithInfinityValue_ThrowsArgumentException() + public void FromCubicMetersPerMeter_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.PositiveInfinity)); - Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.NegativeInfinity)); + var exception1 = Record.Exception(() => VolumePerLength.FromCubicMetersPerMeter(double.PositiveInfinity)); + var exception2 = Record.Exception(() => VolumePerLength.FromCubicMetersPerMeter(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCubicMetersPerMeter_WithNanValue_ThrowsArgumentException() + public void FromCubicMetersPerMeter_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumePerLength.FromCubicMetersPerMeter(double.NaN)); + var exception = Record.Exception(() => VolumePerLength.FromCubicMetersPerMeter(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index d1252a6a5d..bd4e998ef2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -279,16 +279,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Volume(double.PositiveInfinity, VolumeUnit.CubicMeter)); - Assert.Throws(() => new Volume(double.NegativeInfinity, VolumeUnit.CubicMeter)); + var exception1 = Record.Exception(() => new Volume(double.PositiveInfinity, VolumeUnit.CubicMeter)); + var exception2 = Record.Exception(() => new Volume(double.NegativeInfinity, VolumeUnit.CubicMeter)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new Volume(double.NaN, VolumeUnit.CubicMeter)); + var exception = Record.Exception(() => new Volume(double.NaN, VolumeUnit.CubicMeter)); + + Assert.Null(exception); } [Fact] @@ -608,16 +613,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromCubicMeters_WithInfinityValue_ThrowsArgumentException() + public void FromCubicMeters_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Volume.FromCubicMeters(double.PositiveInfinity)); - Assert.Throws(() => Volume.FromCubicMeters(double.NegativeInfinity)); + var exception1 = Record.Exception(() => Volume.FromCubicMeters(double.PositiveInfinity)); + var exception2 = Record.Exception(() => Volume.FromCubicMeters(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromCubicMeters_WithNanValue_ThrowsArgumentException() + public void FromCubicMeters_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => Volume.FromCubicMeters(double.NaN)); + var exception = Record.Exception(() => Volume.FromCubicMeters(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs index 41555fb522..a19d57356b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs @@ -99,16 +99,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumetricHeatCapacity(double.PositiveInfinity, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); - Assert.Throws(() => new VolumetricHeatCapacity(double.NegativeInfinity, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + var exception1 = Record.Exception(() => new VolumetricHeatCapacity(double.PositiveInfinity, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + var exception2 = Record.Exception(() => new VolumetricHeatCapacity(double.NegativeInfinity, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new VolumetricHeatCapacity(double.NaN, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + var exception = Record.Exception(() => new VolumetricHeatCapacity(double.NaN, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + + Assert.Null(exception); } [Fact] @@ -203,16 +208,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromJoulesPerCubicMeterKelvin_WithInfinityValue_ThrowsArgumentException() + public void FromJoulesPerCubicMeterKelvin_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.PositiveInfinity)); - Assert.Throws(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.NegativeInfinity)); + var exception1 = Record.Exception(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.PositiveInfinity)); + var exception2 = Record.Exception(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromJoulesPerCubicMeterKelvin_WithNanValue_ThrowsArgumentException() + public void FromJoulesPerCubicMeterKelvin_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.NaN)); + var exception = Record.Exception(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs index 29709c0913..891a03e312 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs @@ -87,16 +87,21 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() } [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() + public void Ctor_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new WarpingMomentOfInertia(double.PositiveInfinity, WarpingMomentOfInertiaUnit.MeterToTheSixth)); - Assert.Throws(() => new WarpingMomentOfInertia(double.NegativeInfinity, WarpingMomentOfInertiaUnit.MeterToTheSixth)); + var exception1 = Record.Exception(() => new WarpingMomentOfInertia(double.PositiveInfinity, WarpingMomentOfInertiaUnit.MeterToTheSixth)); + var exception2 = Record.Exception(() => new WarpingMomentOfInertia(double.NegativeInfinity, WarpingMomentOfInertiaUnit.MeterToTheSixth)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() + public void Ctor_WithNaNValue_DoNotThrowsArgumentException() { - Assert.Throws(() => new WarpingMomentOfInertia(double.NaN, WarpingMomentOfInertiaUnit.MeterToTheSixth)); + var exception = Record.Exception(() => new WarpingMomentOfInertia(double.NaN, WarpingMomentOfInertiaUnit.MeterToTheSixth)); + + Assert.Null(exception); } [Fact] @@ -176,16 +181,21 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() } [Fact] - public void FromMetersToTheSixth_WithInfinityValue_ThrowsArgumentException() + public void FromMetersToTheSixth_WithInfinityValue_DoNotThrowsArgumentException() { - Assert.Throws(() => WarpingMomentOfInertia.FromMetersToTheSixth(double.PositiveInfinity)); - Assert.Throws(() => WarpingMomentOfInertia.FromMetersToTheSixth(double.NegativeInfinity)); + var exception1 = Record.Exception(() => WarpingMomentOfInertia.FromMetersToTheSixth(double.PositiveInfinity)); + var exception2 = Record.Exception(() => WarpingMomentOfInertia.FromMetersToTheSixth(double.NegativeInfinity)); + + Assert.Null(exception1); + Assert.Null(exception2); } [Fact] - public void FromMetersToTheSixth_WithNanValue_ThrowsArgumentException() + public void FromMetersToTheSixth_WithNanValue_DoNotThrowsArgumentException() { - Assert.Throws(() => WarpingMomentOfInertia.FromMetersToTheSixth(double.NaN)); + var exception = Record.Exception(() => WarpingMomentOfInertia.FromMetersToTheSixth(double.NaN)); + + Assert.Null(exception); } [Fact] diff --git a/UnitsNet.Tests/QuantityTest.cs b/UnitsNet.Tests/QuantityTest.cs index 9edc704dea..3e9ca33dbe 100644 --- a/UnitsNet.Tests/QuantityTest.cs +++ b/UnitsNet.Tests/QuantityTest.cs @@ -20,19 +20,21 @@ public class QuantityTest [InlineData(double.NaN)] [InlineData(double.PositiveInfinity)] [InlineData(double.NegativeInfinity)] - public void From_GivenNaNOrInfinity_ThrowsArgumentException(double value) + public void From_GivenNaNOrInfinity_DoNotThrowsArgumentException(double value) { - Assert.Throws(() => Quantity.From(value, LengthUnit.Centimeter)); + var exception = Record.Exception(() => Quantity.From(value, LengthUnit.Centimeter)); + + Assert.Null(exception); } [Theory] [InlineData(double.NaN)] [InlineData(double.PositiveInfinity)] [InlineData(double.NegativeInfinity)] - public void TryFrom_GivenNaNOrInfinity_ReturnsFalseAndNullQuantity(double value) + public void TryFrom_GivenNaNOrInfinity_ReturnsTrueAndQuantity(double value) { - Assert.False(Quantity.TryFrom(value, LengthUnit.Centimeter, out IQuantity? parsedLength)); - Assert.Null(parsedLength); + Assert.True(Quantity.TryFrom(value, LengthUnit.Centimeter, out IQuantity? parsedLength)); + Assert.NotNull(parsedLength); } [Fact] diff --git a/UnitsNet.Tests/QuantityTests.cs b/UnitsNet.Tests/QuantityTests.cs index 8153ee3ab6..eac72fb99a 100644 --- a/UnitsNet.Tests/QuantityTests.cs +++ b/UnitsNet.Tests/QuantityTests.cs @@ -218,6 +218,19 @@ public void TryFromUnitAbbreviation_AmbiguousAbbreviation_ReturnsFalse() Assert.Null(q); } + [Fact] + public void AllowSpecialValue() + { + try + { + var r = Ratio.FromDecimalFractions(double.NaN); + } + catch (ArgumentException) + { + Assert.True(false, "Special double values (NaN, -Inf, +Inf) must be allowed."); + } + } + private static Length ParseLength(string str) { return Length.Parse(str, CultureInfo.InvariantCulture); diff --git a/UnitsNet/CustomCode/Quantity.cs b/UnitsNet/CustomCode/Quantity.cs index 15e8fab141..51afc17a5f 100644 --- a/UnitsNet/CustomCode/Quantity.cs +++ b/UnitsNet/CustomCode/Quantity.cs @@ -128,9 +128,7 @@ public static bool TryFrom(double value, Enum unit, [NotNullWhen(true)] out IQua // Implicit cast to QuantityValue would prevent TryFrom from being called, // so we need to explicitly check this here for double arguments. - return !double.IsNaN(value) && - !double.IsInfinity(value) && - TryFrom((QuantityValue)value, unit, out quantity); + return TryFrom((QuantityValue)value, unit, out quantity); } /// diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs index d298fa0a0e..2c3c85d9f1 100644 --- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs @@ -99,7 +99,7 @@ static AbsorbedDoseOfIonizingRadiation() /// If value is NaN or Infinity. public AbsorbedDoseOfIonizingRadiation(double value, AbsorbedDoseOfIonizingRadiationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -118,7 +118,7 @@ public AbsorbedDoseOfIonizingRadiation(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index ce03b1f8be..82cd08f957 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -105,7 +105,7 @@ static Acceleration() /// If value is NaN or Infinity. public Acceleration(double value, AccelerationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -124,7 +124,7 @@ public Acceleration(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 3dff1d8f94..4a0f4a288e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -105,7 +105,7 @@ static AmountOfSubstance() /// If value is NaN or Infinity. public AmountOfSubstance(double value, AmountOfSubstanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -124,7 +124,7 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 3311db2870..23c1c0d5ec 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -84,7 +84,7 @@ static AmplitudeRatio() /// If value is NaN or Infinity. public AmplitudeRatio(double value, AmplitudeRatioUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index a4fb3cc421..5bfb70c16a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -104,7 +104,7 @@ static Angle() /// If value is NaN or Infinity. public Angle(double value, AngleUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -123,7 +123,7 @@ public Angle(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 2863b0be5f..4350ba5376 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -83,7 +83,7 @@ static ApparentEnergy() /// If value is NaN or Infinity. public ApparentEnergy(double value, ApparentEnergyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -102,7 +102,7 @@ public ApparentEnergy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index fb6c0eb086..3b0fd4c400 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -86,7 +86,7 @@ static ApparentPower() /// If value is NaN or Infinity. public ApparentPower(double value, ApparentPowerUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public ApparentPower(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index 195f583d77..2e1bd2d4db 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -111,7 +111,7 @@ static Area() /// If value is NaN or Infinity. public Area(double value, AreaUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -130,7 +130,7 @@ public Area(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 29ad148ae0..e055232358 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -89,7 +89,7 @@ static AreaDensity() /// If value is NaN or Infinity. public AreaDensity(double value, AreaDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -108,7 +108,7 @@ public AreaDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index a120b4caf0..3946253a3d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -92,7 +92,7 @@ static AreaMomentOfInertia() /// If value is NaN or Infinity. public AreaMomentOfInertia(double value, AreaMomentOfInertiaUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -111,7 +111,7 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 8641493c0f..d2a38fc8de 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -90,7 +90,7 @@ static BrakeSpecificFuelConsumption() /// If value is NaN or Infinity. public BrakeSpecificFuelConsumption(double value, BrakeSpecificFuelConsumptionUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -109,7 +109,7 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index ee13557165..b590aee179 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -90,7 +90,7 @@ static Capacitance() /// If value is NaN or Infinity. public Capacitance(double value, CapacitanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -109,7 +109,7 @@ public Capacitance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index f54b257578..9624136a81 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -95,7 +95,7 @@ static CoefficientOfThermalExpansion() /// If value is NaN or Infinity. public CoefficientOfThermalExpansion(double value, CoefficientOfThermalExpansionUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -114,7 +114,7 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs index 66529b83b8..14ea5a41bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs @@ -87,7 +87,7 @@ static Compressibility() /// If value is NaN or Infinity. public Compressibility(double value, CompressibilityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -106,7 +106,7 @@ public Compressibility(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 423151009a..091e1606f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -80,13 +80,13 @@ static Density() Info = new QuantityInfo("Density", new UnitInfo[] { - new UnitInfo(DensityUnit.CentigramPerDeciliter, "CentigramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.CentigramPerDeciliter, "CentigramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.CentigramPerLiter, "CentigramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.CentigramPerMilliliter, "CentigramsPerMilliliter", BaseUnits.Undefined, "Density"), - new UnitInfo(DensityUnit.DecigramPerDeciliter, "DecigramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.DecigramPerDeciliter, "DecigramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.DecigramPerLiter, "DecigramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.DecigramPerMilliliter, "DecigramsPerMilliliter", BaseUnits.Undefined, "Density"), - new UnitInfo(DensityUnit.FemtogramPerDeciliter, "FemtogramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.FemtogramPerDeciliter, "FemtogramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.FemtogramPerLiter, "FemtogramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.FemtogramPerMilliliter, "FemtogramsPerMilliliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.GramPerCubicCentimeter, "GramsPerCubicCentimeter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Gram), "Density"), @@ -94,7 +94,7 @@ static Density() new UnitInfo(DensityUnit.GramPerCubicInch, "GramsPerCubicInch", new BaseUnits(length: LengthUnit.Inch, mass: MassUnit.Gram), "Density"), new UnitInfo(DensityUnit.GramPerCubicMeter, "GramsPerCubicMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Gram), "Density"), new UnitInfo(DensityUnit.GramPerCubicMillimeter, "GramsPerCubicMillimeter", new BaseUnits(length: LengthUnit.Millimeter, mass: MassUnit.Gram), "Density"), - new UnitInfo(DensityUnit.GramPerDeciliter, "GramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.GramPerDeciliter, "GramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.GramPerLiter, "GramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.GramPerMilliliter, "GramsPerMilliliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.KilogramPerCubicCentimeter, "KilogramsPerCubicCentimeter", BaseUnits.Undefined, "Density"), @@ -105,17 +105,17 @@ static Density() new UnitInfo(DensityUnit.KilopoundPerCubicInch, "KilopoundsPerCubicInch", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.KilopoundPerCubicYard, "KilopoundsPerCubicYard", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MicrogramPerCubicMeter, "MicrogramsPerCubicMeter", BaseUnits.Undefined, "Density"), - new UnitInfo(DensityUnit.MicrogramPerDeciliter, "MicrogramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.MicrogramPerDeciliter, "MicrogramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MicrogramPerLiter, "MicrogramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MicrogramPerMilliliter, "MicrogramsPerMilliliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MilligramPerCubicMeter, "MilligramsPerCubicMeter", BaseUnits.Undefined, "Density"), - new UnitInfo(DensityUnit.MilligramPerDeciliter, "MilligramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.MilligramPerDeciliter, "MilligramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MilligramPerLiter, "MilligramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MilligramPerMilliliter, "MilligramsPerMilliliter", BaseUnits.Undefined, "Density"), - new UnitInfo(DensityUnit.NanogramPerDeciliter, "NanogramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.NanogramPerDeciliter, "NanogramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.NanogramPerLiter, "NanogramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.NanogramPerMilliliter, "NanogramsPerMilliliter", BaseUnits.Undefined, "Density"), - new UnitInfo(DensityUnit.PicogramPerDeciliter, "PicogramsPerDeciLiter", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.PicogramPerDeciliter, "PicogramsPerDeciliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.PicogramPerLiter, "PicogramsPerLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.PicogramPerMilliliter, "PicogramsPerMilliliter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.PoundPerCubicCentimeter, "PoundsPerCubicCentimeter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Pound), "Density"), @@ -151,7 +151,7 @@ static Density() /// If value is NaN or Infinity. public Density(double value, DensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -170,7 +170,7 @@ public Density(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -242,7 +242,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); + public double CentigramsPerDeciliter => As(DensityUnit.CentigramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -257,7 +257,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); + public double DecigramsPerDeciliter => As(DensityUnit.DecigramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -272,7 +272,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double FemtogramsPerDeciLiter => As(DensityUnit.FemtogramPerDeciliter); + public double FemtogramsPerDeciliter => As(DensityUnit.FemtogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -312,7 +312,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); + public double GramsPerDeciliter => As(DensityUnit.GramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -367,7 +367,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); + public double MicrogramsPerDeciliter => As(DensityUnit.MicrogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -387,7 +387,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); + public double MilligramsPerDeciliter => As(DensityUnit.MilligramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -402,7 +402,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); + public double NanogramsPerDeciliter => As(DensityUnit.NanogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -417,7 +417,7 @@ public Density(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); + public double PicogramsPerDeciliter => As(DensityUnit.PicogramPerDeciliter); /// /// Gets a value of this quantity converted into @@ -676,7 +676,7 @@ public static string GetAbbreviation(DensityUnit unit, IFormatProvider? provider /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeciliter) + public static Density FromCentigramsPerDeciliter(QuantityValue centigramsperdeciliter) { double value = (double) centigramsperdeciliter; return new Density(value, DensityUnit.CentigramPerDeciliter); @@ -706,7 +706,7 @@ public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermil /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdeciliter) + public static Density FromDecigramsPerDeciliter(QuantityValue decigramsperdeciliter) { double value = (double) decigramsperdeciliter; return new Density(value, DensityUnit.DecigramPerDeciliter); @@ -736,7 +736,7 @@ public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilli /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromFemtogramsPerDeciLiter(QuantityValue femtogramsperdeciliter) + public static Density FromFemtogramsPerDeciliter(QuantityValue femtogramsperdeciliter) { double value = (double) femtogramsperdeciliter; return new Density(value, DensityUnit.FemtogramPerDeciliter); @@ -816,7 +816,7 @@ public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmil /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) + public static Density FromGramsPerDeciliter(QuantityValue gramsperdeciliter) { double value = (double) gramsperdeciliter; return new Density(value, DensityUnit.GramPerDeciliter); @@ -926,7 +926,7 @@ public static Density FromMicrogramsPerCubicMeter(QuantityValue microgramspercub /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeciliter) + public static Density FromMicrogramsPerDeciliter(QuantityValue microgramsperdeciliter) { double value = (double) microgramsperdeciliter; return new Density(value, DensityUnit.MicrogramPerDeciliter); @@ -966,7 +966,7 @@ public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercub /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeciliter) + public static Density FromMilligramsPerDeciliter(QuantityValue milligramsperdeciliter) { double value = (double) milligramsperdeciliter; return new Density(value, DensityUnit.MilligramPerDeciliter); @@ -996,7 +996,7 @@ public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermil /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdeciliter) + public static Density FromNanogramsPerDeciliter(QuantityValue nanogramsperdeciliter) { double value = (double) nanogramsperdeciliter; return new Density(value, DensityUnit.NanogramPerDeciliter); @@ -1026,7 +1026,7 @@ public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilli /// Creates a from . /// /// If value is NaN or Infinity. - public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdeciliter) + public static Density FromPicogramsPerDeciliter(QuantityValue picogramsperdeciliter) { double value = (double) picogramsperdeciliter; return new Density(value, DensityUnit.PicogramPerDeciliter); diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 3d4ae1465e..23f5ca369f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -109,7 +109,7 @@ static Duration() /// If value is NaN or Infinity. public Duration(double value, DurationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -128,7 +128,7 @@ public Duration(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 595cbeaad1..817c95d006 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -99,7 +99,7 @@ static DynamicViscosity() /// If value is NaN or Infinity. public DynamicViscosity(double value, DynamicViscosityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -118,7 +118,7 @@ public DynamicViscosity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 0ce3a0f80f..57f4ca11cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -84,7 +84,7 @@ static ElectricAdmittance() /// If value is NaN or Infinity. public ElectricAdmittance(double value, ElectricAdmittanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index b5a88574de..01d6a795d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -103,7 +103,7 @@ static ElectricCharge() /// If value is NaN or Infinity. public ElectricCharge(double value, ElectricChargeUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -122,7 +122,7 @@ public ElectricCharge(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index a290973a58..af02fd255f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -84,7 +84,7 @@ static ElectricChargeDensity() /// If value is NaN or Infinity. public ElectricChargeDensity(double value, ElectricChargeDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index c8a4d1dcb4..920182ba90 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -88,7 +88,7 @@ static ElectricConductance() /// If value is NaN or Infinity. public ElectricConductance(double value, ElectricConductanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -107,7 +107,7 @@ public ElectricConductance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index deb46b99fd..171e7fe67c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -89,7 +89,7 @@ static ElectricConductivity() /// If value is NaN or Infinity. public ElectricConductivity(double value, ElectricConductivityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -108,7 +108,7 @@ public ElectricConductivity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index bf5fb2e7dd..bcf22620a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -100,7 +100,7 @@ static ElectricCurrent() /// If value is NaN or Infinity. public ElectricCurrent(double value, ElectricCurrentUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -119,7 +119,7 @@ public ElectricCurrent(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 9c24238d60..90d5083694 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -86,7 +86,7 @@ static ElectricCurrentDensity() /// If value is NaN or Infinity. public ElectricCurrentDensity(double value, ElectricCurrentDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 7617d04940..8298166188 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -94,7 +94,7 @@ static ElectricCurrentGradient() /// If value is NaN or Infinity. public ElectricCurrentGradient(double value, ElectricCurrentGradientUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -113,7 +113,7 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 97d8662782..6c0eb5f4c1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -84,7 +84,7 @@ static ElectricField() /// If value is NaN or Infinity. public ElectricField(double value, ElectricFieldUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public ElectricField(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index c124373991..c7340e537d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -88,7 +88,7 @@ static ElectricInductance() /// If value is NaN or Infinity. public ElectricInductance(double value, ElectricInductanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -107,7 +107,7 @@ public ElectricInductance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 04a4c8820a..dd3983378f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -95,7 +95,7 @@ static ElectricPotential() /// If value is NaN or Infinity. public ElectricPotential(double value, ElectricPotentialUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -114,7 +114,7 @@ public ElectricPotential(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index a03ff4520c..642c8f81b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -85,7 +85,7 @@ static ElectricPotentialAc() /// If value is NaN or Infinity. public ElectricPotentialAc(double value, ElectricPotentialAcUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -104,7 +104,7 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 96db13ce29..eb3232e1b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -65,26 +65,26 @@ static ElectricPotentialChangeRate() Info = new QuantityInfo("ElectricPotentialChangeRate", new UnitInfo[] { - new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerHour, "KilovoltsPerHours", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond, "KilovoltsPerMicroseconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerMinute, "KilovoltsPerMinutes", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerSecond, "KilovoltsPerSeconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerHour, "MegavoltsPerHours", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond, "MegavoltsPerMicroseconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerMinute, "MegavoltsPerMinutes", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerSecond, "MegavoltsPerSeconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerHour, "MicrovoltsPerHours", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond, "MicrovoltsPerMicroseconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerMinute, "MicrovoltsPerMinutes", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerSecond, "MicrovoltsPerSeconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerHour, "MillivoltsPerHours", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond, "MillivoltsPerMicroseconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerMinute, "MillivoltsPerMinutes", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerSecond, "MillivoltsPerSeconds", BaseUnits.Undefined, "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerHour, "VoltsPerHours", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Hour, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerMicrosecond, "VoltsPerMicroseconds", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Microsecond, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerMinute, "VoltsPerMinutes", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Minute, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), - new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerSecond, "VoltsPerSeconds", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerHour, "KilovoltsPerHour", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond, "KilovoltsPerMicrosecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerMinute, "KilovoltsPerMinute", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.KilovoltPerSecond, "KilovoltsPerSecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerHour, "MegavoltsPerHour", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond, "MegavoltsPerMicrosecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerMinute, "MegavoltsPerMinute", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MegavoltPerSecond, "MegavoltsPerSecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerHour, "MicrovoltsPerHour", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond, "MicrovoltsPerMicrosecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerMinute, "MicrovoltsPerMinute", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MicrovoltPerSecond, "MicrovoltsPerSecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerHour, "MillivoltsPerHour", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond, "MillivoltsPerMicrosecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerMinute, "MillivoltsPerMinute", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.MillivoltPerSecond, "MillivoltsPerSecond", BaseUnits.Undefined, "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerHour, "VoltsPerHour", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Hour, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerMicrosecond, "VoltsPerMicrosecond", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Microsecond, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerMinute, "VoltsPerMinute", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Minute, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), + new UnitInfo(ElectricPotentialChangeRateUnit.VoltPerSecond, "VoltsPerSecond", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricPotentialChangeRate"), }, BaseUnit, Zero, BaseDimensions); @@ -100,7 +100,7 @@ static ElectricPotentialChangeRate() /// If value is NaN or Infinity. public ElectricPotentialChangeRate(double value, ElectricPotentialChangeRateUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -119,7 +119,7 @@ public ElectricPotentialChangeRate(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -191,102 +191,102 @@ public ElectricPotentialChangeRate(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerHours => As(ElectricPotentialChangeRateUnit.KilovoltPerHour); + public double KilovoltsPerHour => As(ElectricPotentialChangeRateUnit.KilovoltPerHour); /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); + public double KilovoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerMinutes => As(ElectricPotentialChangeRateUnit.KilovoltPerMinute); + public double KilovoltsPerMinute => As(ElectricPotentialChangeRateUnit.KilovoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double KilovoltsPerSeconds => As(ElectricPotentialChangeRateUnit.KilovoltPerSecond); + public double KilovoltsPerSecond => As(ElectricPotentialChangeRateUnit.KilovoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerHours => As(ElectricPotentialChangeRateUnit.MegavoltPerHour); + public double MegavoltsPerHour => As(ElectricPotentialChangeRateUnit.MegavoltPerHour); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); + public double MegavoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerMinutes => As(ElectricPotentialChangeRateUnit.MegavoltPerMinute); + public double MegavoltsPerMinute => As(ElectricPotentialChangeRateUnit.MegavoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double MegavoltsPerSeconds => As(ElectricPotentialChangeRateUnit.MegavoltPerSecond); + public double MegavoltsPerSecond => As(ElectricPotentialChangeRateUnit.MegavoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerHours => As(ElectricPotentialChangeRateUnit.MicrovoltPerHour); + public double MicrovoltsPerHour => As(ElectricPotentialChangeRateUnit.MicrovoltPerHour); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); + public double MicrovoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerMinutes => As(ElectricPotentialChangeRateUnit.MicrovoltPerMinute); + public double MicrovoltsPerMinute => As(ElectricPotentialChangeRateUnit.MicrovoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double MicrovoltsPerSeconds => As(ElectricPotentialChangeRateUnit.MicrovoltPerSecond); + public double MicrovoltsPerSecond => As(ElectricPotentialChangeRateUnit.MicrovoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerHours => As(ElectricPotentialChangeRateUnit.MillivoltPerHour); + public double MillivoltsPerHour => As(ElectricPotentialChangeRateUnit.MillivoltPerHour); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); + public double MillivoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerMinutes => As(ElectricPotentialChangeRateUnit.MillivoltPerMinute); + public double MillivoltsPerMinute => As(ElectricPotentialChangeRateUnit.MillivoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double MillivoltsPerSeconds => As(ElectricPotentialChangeRateUnit.MillivoltPerSecond); + public double MillivoltsPerSecond => As(ElectricPotentialChangeRateUnit.MillivoltPerSecond); /// /// Gets a value of this quantity converted into /// - public double VoltsPerHours => As(ElectricPotentialChangeRateUnit.VoltPerHour); + public double VoltsPerHour => As(ElectricPotentialChangeRateUnit.VoltPerHour); /// /// Gets a value of this quantity converted into /// - public double VoltsPerMicroseconds => As(ElectricPotentialChangeRateUnit.VoltPerMicrosecond); + public double VoltsPerMicrosecond => As(ElectricPotentialChangeRateUnit.VoltPerMicrosecond); /// /// Gets a value of this quantity converted into /// - public double VoltsPerMinutes => As(ElectricPotentialChangeRateUnit.VoltPerMinute); + public double VoltsPerMinute => As(ElectricPotentialChangeRateUnit.VoltPerMinute); /// /// Gets a value of this quantity converted into /// - public double VoltsPerSeconds => As(ElectricPotentialChangeRateUnit.VoltPerSecond); + public double VoltsPerSecond => As(ElectricPotentialChangeRateUnit.VoltPerSecond); #endregion @@ -373,9 +373,9 @@ public static string GetAbbreviation(ElectricPotentialChangeRateUnit unit, IForm /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerHours(QuantityValue kilovoltsperhours) + public static ElectricPotentialChangeRate FromKilovoltsPerHour(QuantityValue kilovoltsperhour) { - double value = (double) kilovoltsperhours; + double value = (double) kilovoltsperhour; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.KilovoltPerHour); } @@ -383,9 +383,9 @@ public static ElectricPotentialChangeRate FromKilovoltsPerHours(QuantityValue ki /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerMicroseconds(QuantityValue kilovoltspermicroseconds) + public static ElectricPotentialChangeRate FromKilovoltsPerMicrosecond(QuantityValue kilovoltspermicrosecond) { - double value = (double) kilovoltspermicroseconds; + double value = (double) kilovoltspermicrosecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond); } @@ -393,9 +393,9 @@ public static ElectricPotentialChangeRate FromKilovoltsPerMicroseconds(QuantityV /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerMinutes(QuantityValue kilovoltsperminutes) + public static ElectricPotentialChangeRate FromKilovoltsPerMinute(QuantityValue kilovoltsperminute) { - double value = (double) kilovoltsperminutes; + double value = (double) kilovoltsperminute; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.KilovoltPerMinute); } @@ -403,9 +403,9 @@ public static ElectricPotentialChangeRate FromKilovoltsPerMinutes(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromKilovoltsPerSeconds(QuantityValue kilovoltsperseconds) + public static ElectricPotentialChangeRate FromKilovoltsPerSecond(QuantityValue kilovoltspersecond) { - double value = (double) kilovoltsperseconds; + double value = (double) kilovoltspersecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.KilovoltPerSecond); } @@ -413,9 +413,9 @@ public static ElectricPotentialChangeRate FromKilovoltsPerSeconds(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerHours(QuantityValue megavoltsperhours) + public static ElectricPotentialChangeRate FromMegavoltsPerHour(QuantityValue megavoltsperhour) { - double value = (double) megavoltsperhours; + double value = (double) megavoltsperhour; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MegavoltPerHour); } @@ -423,9 +423,9 @@ public static ElectricPotentialChangeRate FromMegavoltsPerHours(QuantityValue me /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerMicroseconds(QuantityValue megavoltspermicroseconds) + public static ElectricPotentialChangeRate FromMegavoltsPerMicrosecond(QuantityValue megavoltspermicrosecond) { - double value = (double) megavoltspermicroseconds; + double value = (double) megavoltspermicrosecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MegavoltPerMicrosecond); } @@ -433,9 +433,9 @@ public static ElectricPotentialChangeRate FromMegavoltsPerMicroseconds(QuantityV /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerMinutes(QuantityValue megavoltsperminutes) + public static ElectricPotentialChangeRate FromMegavoltsPerMinute(QuantityValue megavoltsperminute) { - double value = (double) megavoltsperminutes; + double value = (double) megavoltsperminute; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MegavoltPerMinute); } @@ -443,9 +443,9 @@ public static ElectricPotentialChangeRate FromMegavoltsPerMinutes(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMegavoltsPerSeconds(QuantityValue megavoltsperseconds) + public static ElectricPotentialChangeRate FromMegavoltsPerSecond(QuantityValue megavoltspersecond) { - double value = (double) megavoltsperseconds; + double value = (double) megavoltspersecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MegavoltPerSecond); } @@ -453,9 +453,9 @@ public static ElectricPotentialChangeRate FromMegavoltsPerSeconds(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerHours(QuantityValue microvoltsperhours) + public static ElectricPotentialChangeRate FromMicrovoltsPerHour(QuantityValue microvoltsperhour) { - double value = (double) microvoltsperhours; + double value = (double) microvoltsperhour; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MicrovoltPerHour); } @@ -463,9 +463,9 @@ public static ElectricPotentialChangeRate FromMicrovoltsPerHours(QuantityValue m /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerMicroseconds(QuantityValue microvoltspermicroseconds) + public static ElectricPotentialChangeRate FromMicrovoltsPerMicrosecond(QuantityValue microvoltspermicrosecond) { - double value = (double) microvoltspermicroseconds; + double value = (double) microvoltspermicrosecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MicrovoltPerMicrosecond); } @@ -473,9 +473,9 @@ public static ElectricPotentialChangeRate FromMicrovoltsPerMicroseconds(Quantity /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerMinutes(QuantityValue microvoltsperminutes) + public static ElectricPotentialChangeRate FromMicrovoltsPerMinute(QuantityValue microvoltsperminute) { - double value = (double) microvoltsperminutes; + double value = (double) microvoltsperminute; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MicrovoltPerMinute); } @@ -483,9 +483,9 @@ public static ElectricPotentialChangeRate FromMicrovoltsPerMinutes(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMicrovoltsPerSeconds(QuantityValue microvoltsperseconds) + public static ElectricPotentialChangeRate FromMicrovoltsPerSecond(QuantityValue microvoltspersecond) { - double value = (double) microvoltsperseconds; + double value = (double) microvoltspersecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MicrovoltPerSecond); } @@ -493,9 +493,9 @@ public static ElectricPotentialChangeRate FromMicrovoltsPerSeconds(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerHours(QuantityValue millivoltsperhours) + public static ElectricPotentialChangeRate FromMillivoltsPerHour(QuantityValue millivoltsperhour) { - double value = (double) millivoltsperhours; + double value = (double) millivoltsperhour; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MillivoltPerHour); } @@ -503,9 +503,9 @@ public static ElectricPotentialChangeRate FromMillivoltsPerHours(QuantityValue m /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerMicroseconds(QuantityValue millivoltspermicroseconds) + public static ElectricPotentialChangeRate FromMillivoltsPerMicrosecond(QuantityValue millivoltspermicrosecond) { - double value = (double) millivoltspermicroseconds; + double value = (double) millivoltspermicrosecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MillivoltPerMicrosecond); } @@ -513,9 +513,9 @@ public static ElectricPotentialChangeRate FromMillivoltsPerMicroseconds(Quantity /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerMinutes(QuantityValue millivoltsperminutes) + public static ElectricPotentialChangeRate FromMillivoltsPerMinute(QuantityValue millivoltsperminute) { - double value = (double) millivoltsperminutes; + double value = (double) millivoltsperminute; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MillivoltPerMinute); } @@ -523,9 +523,9 @@ public static ElectricPotentialChangeRate FromMillivoltsPerMinutes(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromMillivoltsPerSeconds(QuantityValue millivoltsperseconds) + public static ElectricPotentialChangeRate FromMillivoltsPerSecond(QuantityValue millivoltspersecond) { - double value = (double) millivoltsperseconds; + double value = (double) millivoltspersecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.MillivoltPerSecond); } @@ -533,9 +533,9 @@ public static ElectricPotentialChangeRate FromMillivoltsPerSeconds(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerHours(QuantityValue voltsperhours) + public static ElectricPotentialChangeRate FromVoltsPerHour(QuantityValue voltsperhour) { - double value = (double) voltsperhours; + double value = (double) voltsperhour; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.VoltPerHour); } @@ -543,9 +543,9 @@ public static ElectricPotentialChangeRate FromVoltsPerHours(QuantityValue voltsp /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerMicroseconds(QuantityValue voltspermicroseconds) + public static ElectricPotentialChangeRate FromVoltsPerMicrosecond(QuantityValue voltspermicrosecond) { - double value = (double) voltspermicroseconds; + double value = (double) voltspermicrosecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.VoltPerMicrosecond); } @@ -553,9 +553,9 @@ public static ElectricPotentialChangeRate FromVoltsPerMicroseconds(QuantityValue /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerMinutes(QuantityValue voltsperminutes) + public static ElectricPotentialChangeRate FromVoltsPerMinute(QuantityValue voltsperminute) { - double value = (double) voltsperminutes; + double value = (double) voltsperminute; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.VoltPerMinute); } @@ -563,9 +563,9 @@ public static ElectricPotentialChangeRate FromVoltsPerMinutes(QuantityValue volt /// Creates a from . /// /// If value is NaN or Infinity. - public static ElectricPotentialChangeRate FromVoltsPerSeconds(QuantityValue voltsperseconds) + public static ElectricPotentialChangeRate FromVoltsPerSecond(QuantityValue voltspersecond) { - double value = (double) voltsperseconds; + double value = (double) voltspersecond; return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnit.VoltPerSecond); } @@ -767,7 +767,7 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Get ratio value from dividing by . public static double operator /(ElectricPotentialChangeRate left, ElectricPotentialChangeRate right) { - return left.VoltsPerSeconds / right.VoltsPerSeconds; + return left.VoltsPerSecond / right.VoltsPerSecond; } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index a4c48d4abc..fae46812ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -85,7 +85,7 @@ static ElectricPotentialDc() /// If value is NaN or Infinity. public ElectricPotentialDc(double value, ElectricPotentialDcUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -104,7 +104,7 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index c1b4e12e8e..dfdbb436cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -93,7 +93,7 @@ static ElectricResistance() /// If value is NaN or Infinity. public ElectricResistance(double value, ElectricResistanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -112,7 +112,7 @@ public ElectricResistance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 89193b7021..a768739661 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -97,7 +97,7 @@ static ElectricResistivity() /// If value is NaN or Infinity. public ElectricResistivity(double value, ElectricResistivityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -116,7 +116,7 @@ public ElectricResistivity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 422c6d8c52..6f43ffefe7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -86,7 +86,7 @@ static ElectricSurfaceChargeDensity() /// If value is NaN or Infinity. public ElectricSurfaceChargeDensity(double value, ElectricSurfaceChargeDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index e36ff1fdf0..5ecdc6dee6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -135,7 +135,7 @@ static Energy() /// If value is NaN or Infinity. public Energy(double value, EnergyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -154,7 +154,7 @@ public Energy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs index 26b61f515a..7200c3d2e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -98,7 +98,7 @@ static EnergyDensity() /// If value is NaN or Infinity. public EnergyDensity(double value, EnergyDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -117,7 +117,7 @@ public EnergyDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 310a82e47f..3fdd8dc5c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -94,7 +94,7 @@ static Entropy() /// If value is NaN or Infinity. public Entropy(double value, EntropyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -113,7 +113,7 @@ public Entropy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 2cd32df359..b051006985 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -110,7 +110,7 @@ static Force() /// If value is NaN or Infinity. public Force(double value, ForceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -129,7 +129,7 @@ public Force(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index a6e1e5b012..4519c95dec 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -102,7 +102,7 @@ static ForceChangeRate() /// If value is NaN or Infinity. public ForceChangeRate(double value, ForceChangeRateUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -121,7 +121,7 @@ public ForceChangeRate(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index a12fcec880..271abd4ff4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -128,7 +128,7 @@ static ForcePerLength() /// If value is NaN or Infinity. public ForcePerLength(double value, ForcePerLengthUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -147,7 +147,7 @@ public ForcePerLength(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 424ad268cb..ac5fb15c23 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -99,7 +99,7 @@ static Frequency() /// If value is NaN or Infinity. public Frequency(double value, FrequencyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -118,7 +118,7 @@ public Frequency(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index c2e1665afc..65b7903c2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -68,7 +68,7 @@ static FuelEfficiency() Info = new QuantityInfo("FuelEfficiency", new UnitInfo[] { - new UnitInfo(FuelEfficiencyUnit.KilometerPerLiter, "KilometersPerLiters", BaseUnits.Undefined, "FuelEfficiency"), + new UnitInfo(FuelEfficiencyUnit.KilometerPerLiter, "KilometersPerLiter", BaseUnits.Undefined, "FuelEfficiency"), new UnitInfo(FuelEfficiencyUnit.LiterPer100Kilometers, "LitersPer100Kilometers", BaseUnits.Undefined, "FuelEfficiency"), new UnitInfo(FuelEfficiencyUnit.MilePerUkGallon, "MilesPerUkGallon", BaseUnits.Undefined, "FuelEfficiency"), new UnitInfo(FuelEfficiencyUnit.MilePerUsGallon, "MilesPerUsGallon", BaseUnits.Undefined, "FuelEfficiency"), @@ -87,7 +87,7 @@ static FuelEfficiency() /// If value is NaN or Infinity. public FuelEfficiency(double value, FuelEfficiencyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -106,7 +106,7 @@ public FuelEfficiency(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -178,7 +178,7 @@ public FuelEfficiency(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double KilometersPerLiters => As(FuelEfficiencyUnit.KilometerPerLiter); + public double KilometersPerLiter => As(FuelEfficiencyUnit.KilometerPerLiter); /// /// Gets a value of this quantity converted into @@ -248,9 +248,9 @@ public static string GetAbbreviation(FuelEfficiencyUnit unit, IFormatProvider? p /// Creates a from . /// /// If value is NaN or Infinity. - public static FuelEfficiency FromKilometersPerLiters(QuantityValue kilometersperliters) + public static FuelEfficiency FromKilometersPerLiter(QuantityValue kilometersperliter) { - double value = (double) kilometersperliters; + double value = (double) kilometersperliter; return new FuelEfficiency(value, FuelEfficiencyUnit.KilometerPerLiter); } diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 52133329b8..041f94fbbd 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -104,7 +104,7 @@ static HeatFlux() /// If value is NaN or Infinity. public HeatFlux(double value, HeatFluxUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -123,7 +123,7 @@ public HeatFlux(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 5b0d0d812a..e245fd7248 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -86,7 +86,7 @@ static HeatTransferCoefficient() /// If value is NaN or Infinity. public HeatTransferCoefficient(double value, HeatTransferCoefficientUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index d1a7b11de6..6300efafe5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -87,7 +87,7 @@ static Illuminance() /// If value is NaN or Infinity. public Illuminance(double value, IlluminanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -106,7 +106,7 @@ public Illuminance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs index 18c29b13a3..b22505bba6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs @@ -93,7 +93,7 @@ static Impulse() /// If value is NaN or Infinity. public Impulse(double value, ImpulseUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -112,7 +112,7 @@ public Impulse(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 1b2faee843..67d2bbb5a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -94,7 +94,7 @@ static Irradiance() /// If value is NaN or Infinity. public Irradiance(double value, IrradianceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -113,7 +113,7 @@ public Irradiance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index 55d780854a..c19a7ea2b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -90,7 +90,7 @@ static Irradiation() /// If value is NaN or Infinity. public Irradiation(double value, IrradiationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -109,7 +109,7 @@ public Irradiation(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs index 5618e8c0c5..37b40f3f35 100644 --- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs @@ -91,7 +91,7 @@ static Jerk() /// If value is NaN or Infinity. public Jerk(double value, JerkUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -110,7 +110,7 @@ public Jerk(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index deedb07266..9c57ad8ecc 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -101,7 +101,7 @@ static KinematicViscosity() /// If value is NaN or Infinity. public KinematicViscosity(double value, KinematicViscosityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -120,7 +120,7 @@ public KinematicViscosity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs index 7792c37d4b..a0ae353186 100644 --- a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs @@ -86,7 +86,7 @@ static LeakRate() /// If value is NaN or Infinity. public LeakRate(double value, LeakRateUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public LeakRate(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index ec8a4ad7ff..e2f82dd5ff 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -139,7 +139,7 @@ static Length() /// If value is NaN or Infinity. public Length(double value, LengthUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -158,7 +158,7 @@ public Length(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index fd5a9fcd0c..bdd0dab15e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -82,7 +82,7 @@ static Level() /// If value is NaN or Infinity. public Level(double value, LevelUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -101,7 +101,7 @@ public Level(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index c4da627aa7..6b92af85a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -105,7 +105,7 @@ static LinearDensity() /// If value is NaN or Infinity. public LinearDensity(double value, LinearDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -124,7 +124,7 @@ public LinearDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index 2d2d1651e3..96f3857c3d 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -108,7 +108,7 @@ static LinearPowerDensity() /// If value is NaN or Infinity. public LinearPowerDensity(double value, LinearPowerDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -127,7 +127,7 @@ public LinearPowerDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs index 879d452115..1df5b7a1a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -99,7 +99,7 @@ static Luminance() /// If value is NaN or Infinity. public Luminance(double value, LuminanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -118,7 +118,7 @@ public Luminance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 3b36a03ea2..f9615cbf5d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -97,7 +97,7 @@ static Luminosity() /// If value is NaN or Infinity. public Luminosity(double value, LuminosityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -116,7 +116,7 @@ public Luminosity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 855c605541..648e957e1d 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -84,7 +84,7 @@ static LuminousFlux() /// If value is NaN or Infinity. public LuminousFlux(double value, LuminousFluxUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public LuminousFlux(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index 09735d275e..96ee4951cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -91,7 +91,7 @@ static LuminousIntensity() /// If value is NaN or Infinity. public LuminousIntensity(double value, LuminousIntensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -110,7 +110,7 @@ public LuminousIntensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 20bb8e38a0..44dde647a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -89,7 +89,7 @@ static MagneticField() /// If value is NaN or Infinity. public MagneticField(double value, MagneticFieldUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -108,7 +108,7 @@ public MagneticField(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 61c2da9fd0..5e787f545e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -84,7 +84,7 @@ static MagneticFlux() /// If value is NaN or Infinity. public MagneticFlux(double value, MagneticFluxUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public MagneticFlux(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index ba18aa9554..513f7ad77a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -84,7 +84,7 @@ static Magnetization() /// If value is NaN or Infinity. public Magnetization(double value, MagnetizationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public Magnetization(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 750b8a6985..af04728649 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -127,7 +127,7 @@ static Mass() /// If value is NaN or Infinity. public Mass(double value, MassUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -146,7 +146,7 @@ public Mass(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 090cec7288..f8ee175af2 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -140,7 +140,7 @@ static MassConcentration() /// If value is NaN or Infinity. public MassConcentration(double value, MassConcentrationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -159,7 +159,7 @@ public MassConcentration(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 8b72d48a92..4231859097 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -127,7 +127,7 @@ static MassFlow() /// If value is NaN or Infinity. public MassFlow(double value, MassFlowUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -146,7 +146,7 @@ public MassFlow(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index bc68c04747..7f29655414 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -100,7 +100,7 @@ static MassFlux() /// If value is NaN or Infinity. public MassFlux(double value, MassFluxUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -119,7 +119,7 @@ public MassFlux(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 3095de01bf..3d11a8d6ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -113,7 +113,7 @@ static MassFraction() /// If value is NaN or Infinity. public MassFraction(double value, MassFractionUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -132,7 +132,7 @@ public MassFraction(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 19f5d0d383..cece155b32 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -108,7 +108,7 @@ static MassMomentOfInertia() /// If value is NaN or Infinity. public MassMomentOfInertia(double value, MassMomentOfInertiaUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -127,7 +127,7 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs index 44b51bcede..6873dd2891 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs @@ -85,7 +85,7 @@ static Molality() /// If value is NaN or Infinity. public Molality(double value, MolalityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -104,7 +104,7 @@ public Molality(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index bbec973db3..aec5941186 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -83,7 +83,7 @@ static MolarEnergy() /// If value is NaN or Infinity. public MolarEnergy(double value, MolarEnergyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -102,7 +102,7 @@ public MolarEnergy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index 3558fbc02d..812e236cab 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -83,7 +83,7 @@ static MolarEntropy() /// If value is NaN or Infinity. public MolarEntropy(double value, MolarEntropyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -102,7 +102,7 @@ public MolarEntropy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs index 00f765bec9..41af47b11d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs @@ -98,7 +98,7 @@ static MolarFlow() /// If value is NaN or Infinity. public MolarFlow(double value, MolarFlowUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -117,7 +117,7 @@ public MolarFlow(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 3e29004ac2..285f387898 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -101,7 +101,7 @@ static MolarMass() /// If value is NaN or Infinity. public MolarMass(double value, MolarMassUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -120,7 +120,7 @@ public MolarMass(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 478de5bb67..85997751a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -101,7 +101,7 @@ static Molarity() /// If value is NaN or Infinity. public Molarity(double value, MolarityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -120,7 +120,7 @@ public Molarity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index b9013703e4..3a2fc624f6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -84,7 +84,7 @@ static Permeability() /// If value is NaN or Infinity. public Permeability(double value, PermeabilityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public Permeability(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 16cbd25cfb..1cfd9c6dcf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -84,7 +84,7 @@ static Permittivity() /// If value is NaN or Infinity. public Permittivity(double value, PermittivityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public Permittivity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs index 5001ca2528..475e411e73 100644 --- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs @@ -88,7 +88,7 @@ static PorousMediumPermeability() /// If value is NaN or Infinity. public PorousMediumPermeability(double value, PorousMediumPermeabilityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -107,7 +107,7 @@ public PorousMediumPermeability(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index 40b9812e0a..a18ed33c53 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -124,7 +124,7 @@ static PowerDensity() /// If value is NaN or Infinity. public PowerDensity(double value, PowerDensityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -143,7 +143,7 @@ public PowerDensity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index a29c91647c..e167b84c17 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -82,7 +82,7 @@ static PowerRatio() /// If value is NaN or Infinity. public PowerRatio(double value, PowerRatioUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -101,7 +101,7 @@ public PowerRatio(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index db3e6c06e9..c03ed75484 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -141,7 +141,7 @@ static Pressure() /// If value is NaN or Infinity. public Pressure(double value, PressureUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -160,7 +160,7 @@ public Pressure(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index a2a19ffac1..13c093d8ea 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -105,7 +105,7 @@ static PressureChangeRate() /// If value is NaN or Infinity. public PressureChangeRate(double value, PressureChangeRateUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -124,7 +124,7 @@ public PressureChangeRate(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs index ef1853eca5..cc0cbae92a 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs @@ -88,7 +88,7 @@ static RadiationExposure() /// If value is NaN or Infinity. public RadiationExposure(double value, RadiationExposureUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -107,7 +107,7 @@ public RadiationExposure(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs index 3c72a27641..82bd83970b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs @@ -109,7 +109,7 @@ static Radioactivity() /// If value is NaN or Infinity. public Radioactivity(double value, RadioactivityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -128,7 +128,7 @@ public Radioactivity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index 64de7446aa..ad3129455b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -86,7 +86,7 @@ static Ratio() /// If value is NaN or Infinity. public Ratio(double value, RatioUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public Ratio(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index d46826ecd4..fc45a08177 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -82,7 +82,7 @@ static RatioChangeRate() /// If value is NaN or Infinity. public RatioChangeRate(double value, RatioChangeRateUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -101,7 +101,7 @@ public RatioChangeRate(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index d6dd38c49f..6a4a87bff1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -83,7 +83,7 @@ static ReactiveEnergy() /// If value is NaN or Infinity. public ReactiveEnergy(double value, ReactiveEnergyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -102,7 +102,7 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index 08ceeb1b59..87a57bab66 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -84,7 +84,7 @@ static ReactivePower() /// If value is NaN or Infinity. public ReactivePower(double value, ReactivePowerUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public ReactivePower(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index 95bb62799d..d738a440ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -102,7 +102,7 @@ static ReciprocalArea() /// If value is NaN or Infinity. public ReciprocalArea(double value, ReciprocalAreaUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -121,7 +121,7 @@ public ReciprocalArea(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index 105635debb..338ba936b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -102,7 +102,7 @@ static ReciprocalLength() /// If value is NaN or Infinity. public ReciprocalLength(double value, ReciprocalLengthUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -121,7 +121,7 @@ public ReciprocalLength(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index bcb5812a57..f869e249e9 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -81,7 +81,7 @@ static RelativeHumidity() /// If value is NaN or Infinity. public RelativeHumidity(double value, RelativeHumidityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -100,7 +100,7 @@ public RelativeHumidity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index e3087be300..2908c46eaf 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -84,7 +84,7 @@ static RotationalAcceleration() /// If value is NaN or Infinity. public RotationalAcceleration(double value, RotationalAccelerationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index 8501363750..764cfd2154 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -100,7 +100,7 @@ static RotationalSpeed() /// If value is NaN or Infinity. public RotationalSpeed(double value, RotationalSpeedUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -119,7 +119,7 @@ public RotationalSpeed(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 64f19e8372..f695eb00af 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -121,7 +121,7 @@ static RotationalStiffness() /// If value is NaN or Infinity. public RotationalStiffness(double value, RotationalStiffnessUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -140,7 +140,7 @@ public RotationalStiffness(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index e5a6418615..7994f6fea6 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -91,7 +91,7 @@ static RotationalStiffnessPerLength() /// If value is NaN or Infinity. public RotationalStiffnessPerLength(double value, RotationalStiffnessPerLengthUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -110,7 +110,7 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs index 457c258fda..410c1f7ecc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -81,7 +81,7 @@ static Scalar() /// If value is NaN or Infinity. public Scalar(double value, ScalarUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -100,7 +100,7 @@ public Scalar(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 894e8b3f5f..38b0c43c5d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -84,7 +84,7 @@ static SolidAngle() /// If value is NaN or Infinity. public SolidAngle(double value, SolidAngleUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public SolidAngle(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 74313501ec..ae041cfd4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -122,7 +122,7 @@ static SpecificEnergy() /// If value is NaN or Infinity. public SpecificEnergy(double value, SpecificEnergyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -141,7 +141,7 @@ public SpecificEnergy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index c358ed82be..947b7d5784 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -96,7 +96,7 @@ static SpecificEntropy() /// If value is NaN or Infinity. public SpecificEntropy(double value, SpecificEntropyUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -115,7 +115,7 @@ public SpecificEntropy(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index 068f959660..8966135ee6 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -87,7 +87,7 @@ static SpecificFuelConsumption() /// If value is NaN or Infinity. public SpecificFuelConsumption(double value, SpecificFuelConsumptionUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -106,7 +106,7 @@ public SpecificFuelConsumption(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 1236972c5d..fe1120be0d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -89,7 +89,7 @@ static SpecificVolume() /// If value is NaN or Infinity. public SpecificVolume(double value, SpecificVolumeUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -108,7 +108,7 @@ public SpecificVolume(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index 2072c61c37..dd50467cf8 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -109,7 +109,7 @@ static SpecificWeight() /// If value is NaN or Infinity. public SpecificWeight(double value, SpecificWeightUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -128,7 +128,7 @@ public SpecificWeight(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 2f291ae723..f1672b27ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -81,9 +81,9 @@ static Speed() new UnitInfo[] { new UnitInfo(SpeedUnit.CentimeterPerHour, "CentimetersPerHour", BaseUnits.Undefined, "Speed"), - new UnitInfo(SpeedUnit.CentimeterPerMinute, "CentimetersPerMinutes", BaseUnits.Undefined, "Speed"), + new UnitInfo(SpeedUnit.CentimeterPerMinute, "CentimetersPerMinute", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.CentimeterPerSecond, "CentimetersPerSecond", BaseUnits.Undefined, "Speed"), - new UnitInfo(SpeedUnit.DecimeterPerMinute, "DecimetersPerMinutes", BaseUnits.Undefined, "Speed"), + new UnitInfo(SpeedUnit.DecimeterPerMinute, "DecimetersPerMinute", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.DecimeterPerSecond, "DecimetersPerSecond", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.FootPerHour, "FeetPerHour", new BaseUnits(length: LengthUnit.Foot, time: DurationUnit.Hour), "Speed"), new UnitInfo(SpeedUnit.FootPerMinute, "FeetPerMinute", new BaseUnits(length: LengthUnit.Foot, time: DurationUnit.Minute), "Speed"), @@ -92,20 +92,20 @@ static Speed() new UnitInfo(SpeedUnit.InchPerMinute, "InchesPerMinute", new BaseUnits(length: LengthUnit.Inch, time: DurationUnit.Minute), "Speed"), new UnitInfo(SpeedUnit.InchPerSecond, "InchesPerSecond", new BaseUnits(length: LengthUnit.Inch, time: DurationUnit.Second), "Speed"), new UnitInfo(SpeedUnit.KilometerPerHour, "KilometersPerHour", BaseUnits.Undefined, "Speed"), - new UnitInfo(SpeedUnit.KilometerPerMinute, "KilometersPerMinutes", BaseUnits.Undefined, "Speed"), + new UnitInfo(SpeedUnit.KilometerPerMinute, "KilometersPerMinute", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.KilometerPerSecond, "KilometersPerSecond", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.Knot, "Knots", new BaseUnits(length: LengthUnit.NauticalMile, time: DurationUnit.Hour), "Speed"), new UnitInfo(SpeedUnit.Mach, "Mach", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.MeterPerHour, "MetersPerHour", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Hour), "Speed"), - new UnitInfo(SpeedUnit.MeterPerMinute, "MetersPerMinutes", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Minute), "Speed"), + new UnitInfo(SpeedUnit.MeterPerMinute, "MetersPerMinute", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Minute), "Speed"), new UnitInfo(SpeedUnit.MeterPerSecond, "MetersPerSecond", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second), "Speed"), - new UnitInfo(SpeedUnit.MicrometerPerMinute, "MicrometersPerMinutes", BaseUnits.Undefined, "Speed"), + new UnitInfo(SpeedUnit.MicrometerPerMinute, "MicrometersPerMinute", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.MicrometerPerSecond, "MicrometersPerSecond", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.MilePerHour, "MilesPerHour", new BaseUnits(length: LengthUnit.Mile, time: DurationUnit.Hour), "Speed"), new UnitInfo(SpeedUnit.MillimeterPerHour, "MillimetersPerHour", BaseUnits.Undefined, "Speed"), - new UnitInfo(SpeedUnit.MillimeterPerMinute, "MillimetersPerMinutes", BaseUnits.Undefined, "Speed"), + new UnitInfo(SpeedUnit.MillimeterPerMinute, "MillimetersPerMinute", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.MillimeterPerSecond, "MillimetersPerSecond", BaseUnits.Undefined, "Speed"), - new UnitInfo(SpeedUnit.NanometerPerMinute, "NanometersPerMinutes", BaseUnits.Undefined, "Speed"), + new UnitInfo(SpeedUnit.NanometerPerMinute, "NanometersPerMinute", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.NanometerPerSecond, "NanometersPerSecond", BaseUnits.Undefined, "Speed"), new UnitInfo(SpeedUnit.UsSurveyFootPerHour, "UsSurveyFeetPerHour", new BaseUnits(length: LengthUnit.UsSurveyFoot, time: DurationUnit.Hour), "Speed"), new UnitInfo(SpeedUnit.UsSurveyFootPerMinute, "UsSurveyFeetPerMinute", new BaseUnits(length: LengthUnit.UsSurveyFoot, time: DurationUnit.Minute), "Speed"), @@ -128,7 +128,7 @@ static Speed() /// If value is NaN or Infinity. public Speed(double value, SpeedUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -147,7 +147,7 @@ public Speed(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -224,7 +224,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); + public double CentimetersPerMinute => As(SpeedUnit.CentimeterPerMinute); /// /// Gets a value of this quantity converted into @@ -234,7 +234,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); + public double DecimetersPerMinute => As(SpeedUnit.DecimeterPerMinute); /// /// Gets a value of this quantity converted into @@ -279,7 +279,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); + public double KilometersPerMinute => As(SpeedUnit.KilometerPerMinute); /// /// Gets a value of this quantity converted into @@ -304,7 +304,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double MetersPerMinutes => As(SpeedUnit.MeterPerMinute); + public double MetersPerMinute => As(SpeedUnit.MeterPerMinute); /// /// Gets a value of this quantity converted into @@ -314,7 +314,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); + public double MicrometersPerMinute => As(SpeedUnit.MicrometerPerMinute); /// /// Gets a value of this quantity converted into @@ -334,7 +334,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); + public double MillimetersPerMinute => As(SpeedUnit.MillimeterPerMinute); /// /// Gets a value of this quantity converted into @@ -344,7 +344,7 @@ public Speed(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); + public double NanometersPerMinute => As(SpeedUnit.NanometerPerMinute); /// /// Gets a value of this quantity converted into @@ -502,9 +502,9 @@ public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminutes) + public static Speed FromCentimetersPerMinute(QuantityValue centimetersperminute) { - double value = (double) centimetersperminutes; + double value = (double) centimetersperminute; return new Speed(value, SpeedUnit.CentimeterPerMinute); } @@ -522,9 +522,9 @@ public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) + public static Speed FromDecimetersPerMinute(QuantityValue decimetersperminute) { - double value = (double) decimetersperminutes; + double value = (double) decimetersperminute; return new Speed(value, SpeedUnit.DecimeterPerMinute); } @@ -612,9 +612,9 @@ public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) + public static Speed FromKilometersPerMinute(QuantityValue kilometersperminute) { - double value = (double) kilometersperminutes; + double value = (double) kilometersperminute; return new Speed(value, SpeedUnit.KilometerPerMinute); } @@ -662,9 +662,9 @@ public static Speed FromMetersPerHour(QuantityValue metersperhour) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) + public static Speed FromMetersPerMinute(QuantityValue metersperminute) { - double value = (double) metersperminutes; + double value = (double) metersperminute; return new Speed(value, SpeedUnit.MeterPerMinute); } @@ -682,9 +682,9 @@ public static Speed FromMetersPerSecond(QuantityValue meterspersecond) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminutes) + public static Speed FromMicrometersPerMinute(QuantityValue micrometersperminute) { - double value = (double) micrometersperminutes; + double value = (double) micrometersperminute; return new Speed(value, SpeedUnit.MicrometerPerMinute); } @@ -722,9 +722,9 @@ public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminutes) + public static Speed FromMillimetersPerMinute(QuantityValue millimetersperminute) { - double value = (double) millimetersperminutes; + double value = (double) millimetersperminute; return new Speed(value, SpeedUnit.MillimeterPerMinute); } @@ -742,9 +742,9 @@ public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) /// Creates a from . /// /// If value is NaN or Infinity. - public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) + public static Speed FromNanometersPerMinute(QuantityValue nanometersperminute) { - double value = (double) nanometersperminutes; + double value = (double) nanometersperminute; return new Speed(value, SpeedUnit.NanometerPerMinute); } diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index b7db4ce03b..5b998472ed 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -89,7 +89,7 @@ static StandardVolumeFlow() /// If value is NaN or Infinity. public StandardVolumeFlow(double value, StandardVolumeFlowUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -108,7 +108,7 @@ public StandardVolumeFlow(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index f8df052091..56d52222c8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -90,7 +90,7 @@ static Temperature() /// If value is NaN or Infinity. public Temperature(double value, TemperatureUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -109,7 +109,7 @@ public Temperature(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index 788e9ecc32..05799ba7c5 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -97,7 +97,7 @@ static TemperatureChangeRate() /// If value is NaN or Infinity. public TemperatureChangeRate(double value, TemperatureChangeRateUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -116,7 +116,7 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index 32c9ae4a4c..58e87f0ade 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -99,7 +99,7 @@ static TemperatureDelta() /// If value is NaN or Infinity. public TemperatureDelta(double value, TemperatureDeltaUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -118,7 +118,7 @@ public TemperatureDelta(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index 181e98c115..00dff749f4 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -71,8 +71,8 @@ static TemperatureGradient() Info = new QuantityInfo("TemperatureGradient", new UnitInfo[] { - new UnitInfo(TemperatureGradientUnit.DegreeCelsiusPerKilometer, "DegreesCelciusPerKilometer", new BaseUnits(length: LengthUnit.Kilometer, temperature: TemperatureUnit.DegreeCelsius), "TemperatureGradient"), - new UnitInfo(TemperatureGradientUnit.DegreeCelsiusPerMeter, "DegreesCelciusPerMeter", new BaseUnits(length: LengthUnit.Meter, temperature: TemperatureUnit.DegreeCelsius), "TemperatureGradient"), + new UnitInfo(TemperatureGradientUnit.DegreeCelsiusPerKilometer, "DegreesCelsiusPerKilometer", new BaseUnits(length: LengthUnit.Kilometer, temperature: TemperatureUnit.DegreeCelsius), "TemperatureGradient"), + new UnitInfo(TemperatureGradientUnit.DegreeCelsiusPerMeter, "DegreesCelsiusPerMeter", new BaseUnits(length: LengthUnit.Meter, temperature: TemperatureUnit.DegreeCelsius), "TemperatureGradient"), new UnitInfo(TemperatureGradientUnit.DegreeFahrenheitPerFoot, "DegreesFahrenheitPerFoot", new BaseUnits(length: LengthUnit.Foot, temperature: TemperatureUnit.DegreeFahrenheit), "TemperatureGradient"), new UnitInfo(TemperatureGradientUnit.KelvinPerMeter, "KelvinsPerMeter", new BaseUnits(length: LengthUnit.Meter, temperature: TemperatureUnit.Kelvin), "TemperatureGradient"), }, @@ -90,7 +90,7 @@ static TemperatureGradient() /// If value is NaN or Infinity. public TemperatureGradient(double value, TemperatureGradientUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -109,7 +109,7 @@ public TemperatureGradient(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } @@ -181,12 +181,12 @@ public TemperatureGradient(double value, UnitSystem unitSystem) /// /// Gets a value of this quantity converted into /// - public double DegreesCelciusPerKilometer => As(TemperatureGradientUnit.DegreeCelsiusPerKilometer); + public double DegreesCelsiusPerKilometer => As(TemperatureGradientUnit.DegreeCelsiusPerKilometer); /// /// Gets a value of this quantity converted into /// - public double DegreesCelciusPerMeter => As(TemperatureGradientUnit.DegreeCelsiusPerMeter); + public double DegreesCelsiusPerMeter => As(TemperatureGradientUnit.DegreeCelsiusPerMeter); /// /// Gets a value of this quantity converted into @@ -251,9 +251,9 @@ public static string GetAbbreviation(TemperatureGradientUnit unit, IFormatProvid /// Creates a from . /// /// If value is NaN or Infinity. - public static TemperatureGradient FromDegreesCelciusPerKilometer(QuantityValue degreescelciusperkilometer) + public static TemperatureGradient FromDegreesCelsiusPerKilometer(QuantityValue degreescelsiusperkilometer) { - double value = (double) degreescelciusperkilometer; + double value = (double) degreescelsiusperkilometer; return new TemperatureGradient(value, TemperatureGradientUnit.DegreeCelsiusPerKilometer); } @@ -261,9 +261,9 @@ public static TemperatureGradient FromDegreesCelciusPerKilometer(QuantityValue d /// Creates a from . /// /// If value is NaN or Infinity. - public static TemperatureGradient FromDegreesCelciusPerMeter(QuantityValue degreescelciuspermeter) + public static TemperatureGradient FromDegreesCelsiusPerMeter(QuantityValue degreescelsiuspermeter) { - double value = (double) degreescelciuspermeter; + double value = (double) degreescelsiuspermeter; return new TemperatureGradient(value, TemperatureGradientUnit.DegreeCelsiusPerMeter); } diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 2025bb0dfd..e402a5be18 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -85,7 +85,7 @@ static ThermalConductivity() /// If value is NaN or Infinity. public ThermalConductivity(double value, ThermalConductivityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -104,7 +104,7 @@ public ThermalConductivity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index 1046e5363c..06713100d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -86,7 +86,7 @@ static ThermalResistance() /// If value is NaN or Infinity. public ThermalResistance(double value, ThermalResistanceUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public ThermalResistance(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 7a4fd8c7af..87eaaf99b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -114,7 +114,7 @@ static Torque() /// If value is NaN or Infinity. public Torque(double value, TorqueUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -133,7 +133,7 @@ public Torque(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs index 0eec675773..2e3582a04f 100644 --- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -101,7 +101,7 @@ static TorquePerLength() /// If value is NaN or Infinity. public TorquePerLength(double value, TorquePerLengthUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -120,7 +120,7 @@ public TorquePerLength(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index bf842a20be..10ceccf7d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -84,7 +84,7 @@ static Turbidity() /// If value is NaN or Infinity. public Turbidity(double value, TurbidityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -103,7 +103,7 @@ public Turbidity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index ce62457a5f..ca08eed1ed 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -81,7 +81,7 @@ static VitaminA() /// If value is NaN or Infinity. public VitaminA(double value, VitaminAUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -100,7 +100,7 @@ public VitaminA(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index d3e788cfdc..b7517fca06 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -146,7 +146,7 @@ static Volume() /// If value is NaN or Infinity. public Volume(double value, VolumeUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -165,7 +165,7 @@ public Volume(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index 6f1fc9723f..3b813902a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -110,7 +110,7 @@ static VolumeConcentration() /// If value is NaN or Infinity. public VolumeConcentration(double value, VolumeConcentrationUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -129,7 +129,7 @@ public VolumeConcentration(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 9cf7d31375..bce0ff4739 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -157,7 +157,7 @@ static VolumeFlow() /// If value is NaN or Infinity. public VolumeFlow(double value, VolumeFlowUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -176,7 +176,7 @@ public VolumeFlow(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index fc1ce4c428..41bd9801db 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -82,7 +82,7 @@ static VolumeFlowPerArea() /// If value is NaN or Infinity. public VolumeFlowPerArea(double value, VolumeFlowPerAreaUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -101,7 +101,7 @@ public VolumeFlowPerArea(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index 59f6fb4496..72f78ac97e 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -89,7 +89,7 @@ static VolumePerLength() /// If value is NaN or Infinity. public VolumePerLength(double value, VolumePerLengthUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -108,7 +108,7 @@ public VolumePerLength(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index 798996c6b5..093ee8b1cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -92,7 +92,7 @@ static VolumetricHeatCapacity() /// If value is NaN or Infinity. public VolumetricHeatCapacity(double value, VolumetricHeatCapacityUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -111,7 +111,7 @@ public VolumetricHeatCapacity(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index cc92626c1e..c7c1034b2e 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -86,7 +86,7 @@ static WarpingMomentOfInertia() /// If value is NaN or Infinity. public WarpingMomentOfInertia(double value, WarpingMomentOfInertiaUnit unit) { - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = unit; } @@ -105,7 +105,7 @@ public WarpingMomentOfInertia(double value, UnitSystem unitSystem) var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - _value = Guard.EnsureValidNumber(value, nameof(value)); + _value = value; _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); } diff --git a/UnitsNet/GeneratedCode/Resources/Density.restext b/UnitsNet/GeneratedCode/Resources/Density.restext index 9f0383bee7..7e09c13c23 100644 --- a/UnitsNet/GeneratedCode/Resources/Density.restext +++ b/UnitsNet/GeneratedCode/Resources/Density.restext @@ -1,10 +1,10 @@ -CentigramsPerDeciLiter=cg/dl +CentigramsPerDeciliter=cg/dl CentigramsPerLiter=cg/L CentigramsPerMilliliter=cg/ml -DecigramsPerDeciLiter=dg/dl +DecigramsPerDeciliter=dg/dl DecigramsPerLiter=dg/L DecigramsPerMilliliter=dg/ml -FemtogramsPerDeciLiter=fg/dl +FemtogramsPerDeciliter=fg/dl FemtogramsPerLiter=fg/L FemtogramsPerMilliliter=fg/ml GramsPerCubicCentimeter=g/cm³ @@ -12,7 +12,7 @@ GramsPerCubicFoot=g/ft³ GramsPerCubicInch=g/in³ GramsPerCubicMeter=g/m³ GramsPerCubicMillimeter=g/mm³ -GramsPerDeciLiter=g/dl +GramsPerDeciliter=g/dl GramsPerLiter=g/L GramsPerMilliliter=g/ml KilogramsPerCubicCentimeter=kg/cm³ @@ -23,17 +23,17 @@ KilopoundsPerCubicFoot=kip/ft³ KilopoundsPerCubicInch=kip/in³ KilopoundsPerCubicYard=kip/yd³ MicrogramsPerCubicMeter=µg/m³ -MicrogramsPerDeciLiter=µg/dl +MicrogramsPerDeciliter=µg/dl MicrogramsPerLiter=µg/L MicrogramsPerMilliliter=µg/ml MilligramsPerCubicMeter=mg/m³ -MilligramsPerDeciLiter=mg/dl +MilligramsPerDeciliter=mg/dl MilligramsPerLiter=mg/L MilligramsPerMilliliter=mg/ml -NanogramsPerDeciLiter=ng/dl +NanogramsPerDeciliter=ng/dl NanogramsPerLiter=ng/L NanogramsPerMilliliter=ng/ml -PicogramsPerDeciLiter=pg/dl +PicogramsPerDeciliter=pg/dl PicogramsPerLiter=pg/L PicogramsPerMilliliter=pg/ml PoundsPerCubicCentimeter=lb/cm³ diff --git a/UnitsNet/GeneratedCode/Resources/ElectricPotentialChangeRate.restext b/UnitsNet/GeneratedCode/Resources/ElectricPotentialChangeRate.restext index 23e9c0726c..e1bfdee63f 100644 --- a/UnitsNet/GeneratedCode/Resources/ElectricPotentialChangeRate.restext +++ b/UnitsNet/GeneratedCode/Resources/ElectricPotentialChangeRate.restext @@ -1,20 +1,20 @@ -KilovoltsPerHours=kV/h -KilovoltsPerMicroseconds=kV/μs -KilovoltsPerMinutes=kV/min -KilovoltsPerSeconds=kV/s -MegavoltsPerHours=MV/h -MegavoltsPerMicroseconds=MV/μs -MegavoltsPerMinutes=MV/min -MegavoltsPerSeconds=MV/s -MicrovoltsPerHours=µV/h -MicrovoltsPerMicroseconds=µV/μs -MicrovoltsPerMinutes=µV/min -MicrovoltsPerSeconds=µV/s -MillivoltsPerHours=mV/h -MillivoltsPerMicroseconds=mV/μs -MillivoltsPerMinutes=mV/min -MillivoltsPerSeconds=mV/s -VoltsPerHours=V/h -VoltsPerMicroseconds=V/μs -VoltsPerMinutes=V/min -VoltsPerSeconds=V/s +KilovoltsPerHour=kV/h +KilovoltsPerMicrosecond=kV/μs +KilovoltsPerMinute=kV/min +KilovoltsPerSecond=kV/s +MegavoltsPerHour=MV/h +MegavoltsPerMicrosecond=MV/μs +MegavoltsPerMinute=MV/min +MegavoltsPerSecond=MV/s +MicrovoltsPerHour=µV/h +MicrovoltsPerMicrosecond=µV/μs +MicrovoltsPerMinute=µV/min +MicrovoltsPerSecond=µV/s +MillivoltsPerHour=mV/h +MillivoltsPerMicrosecond=mV/μs +MillivoltsPerMinute=mV/min +MillivoltsPerSecond=mV/s +VoltsPerHour=V/h +VoltsPerMicrosecond=V/μs +VoltsPerMinute=V/min +VoltsPerSecond=V/s diff --git a/UnitsNet/GeneratedCode/Resources/FuelEfficiency.restext b/UnitsNet/GeneratedCode/Resources/FuelEfficiency.restext index 600f577506..3440466d12 100644 --- a/UnitsNet/GeneratedCode/Resources/FuelEfficiency.restext +++ b/UnitsNet/GeneratedCode/Resources/FuelEfficiency.restext @@ -1,4 +1,4 @@ -KilometersPerLiters=km/L +KilometersPerLiter=km/L LitersPer100Kilometers=L/100km MilesPerUkGallon=mpg (imp.) MilesPerUsGallon=mpg (U.S.) diff --git a/UnitsNet/GeneratedCode/Resources/Speed.restext b/UnitsNet/GeneratedCode/Resources/Speed.restext index c98cc42920..f4fee81ddf 100644 --- a/UnitsNet/GeneratedCode/Resources/Speed.restext +++ b/UnitsNet/GeneratedCode/Resources/Speed.restext @@ -1,7 +1,7 @@ CentimetersPerHour=cm/h -CentimetersPerMinutes=cm/min +CentimetersPerMinute=cm/min CentimetersPerSecond=cm/s -DecimetersPerMinutes=dm/min +DecimetersPerMinute=dm/min DecimetersPerSecond=dm/s FeetPerHour=ft/h FeetPerMinute=ft/min @@ -10,20 +10,20 @@ InchesPerHour=in/h InchesPerMinute=in/min InchesPerSecond=in/s KilometersPerHour=km/h -KilometersPerMinutes=km/min +KilometersPerMinute=km/min KilometersPerSecond=km/s Knots=kn,kt,knot,knots Mach=M,Ma,MN,MACH MetersPerHour=m/h -MetersPerMinutes=m/min +MetersPerMinute=m/min MetersPerSecond=m/s -MicrometersPerMinutes=µm/min +MicrometersPerMinute=µm/min MicrometersPerSecond=µm/s MilesPerHour=mph MillimetersPerHour=mm/h -MillimetersPerMinutes=mm/min +MillimetersPerMinute=mm/min MillimetersPerSecond=mm/s -NanometersPerMinutes=nm/min +NanometersPerMinute=nm/min NanometersPerSecond=nm/s UsSurveyFeetPerHour=ftUS/h UsSurveyFeetPerMinute=ftUS/min diff --git a/UnitsNet/GeneratedCode/Resources/Speed.ru-RU.restext b/UnitsNet/GeneratedCode/Resources/Speed.ru-RU.restext index 96968602f0..407649cdd5 100644 --- a/UnitsNet/GeneratedCode/Resources/Speed.ru-RU.restext +++ b/UnitsNet/GeneratedCode/Resources/Speed.ru-RU.restext @@ -1,24 +1,24 @@ CentimetersPerHour=см/ч -CentimetersPerMinutes=см/мин +CentimetersPerMinute=см/мин CentimetersPerSecond=см/с -DecimetersPerMinutes=дм/мин +DecimetersPerMinute=дм/мин DecimetersPerSecond=дм/с FeetPerHour=фут/ч FeetPerMinute=фут/мин FeetPerSecond=фут/с KilometersPerHour=км/ч -KilometersPerMinutes=км/мин +KilometersPerMinute=км/мин KilometersPerSecond=км/с Knots=уз. Mach=мах MetersPerHour=м/ч -MetersPerMinutes=м/мин +MetersPerMinute=м/мин MetersPerSecond=м/с -MicrometersPerMinutes=мкм/мин +MicrometersPerMinute=мкм/мин MicrometersPerSecond=мкм/с MilesPerHour=миль/ч MillimetersPerHour=мм/ч -MillimetersPerMinutes=мм/мин +MillimetersPerMinute=мм/мин MillimetersPerSecond=мм/с -NanometersPerMinutes=нм/мин +NanometersPerMinute=нм/мин NanometersPerSecond=нм/с diff --git a/UnitsNet/GeneratedCode/Resources/TemperatureGradient.restext b/UnitsNet/GeneratedCode/Resources/TemperatureGradient.restext index 207a5d5278..30ecf9bc77 100644 --- a/UnitsNet/GeneratedCode/Resources/TemperatureGradient.restext +++ b/UnitsNet/GeneratedCode/Resources/TemperatureGradient.restext @@ -1,4 +1,4 @@ -DegreesCelciusPerKilometer=∆°C/km -DegreesCelciusPerMeter=∆°C/m +DegreesCelsiusPerKilometer=∆°C/km +DegreesCelsiusPerMeter=∆°C/m DegreesFahrenheitPerFoot=∆°F/ft KelvinsPerMeter=∆°K/m diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index 16663d7980..a5ea81418a 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -60,7 +60,7 @@ namespace UnitsNet private QuantityValue(double val) : this() { - _doubleValue = Guard.EnsureValidNumber(val, nameof(val)); + _doubleValue = val; Type = UnderlyingDataType.Double; }