diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index c78845e10f..93d9ed5461 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -85,7 +85,7 @@ static Acceleration() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Acceleration() #endif Acceleration(double numericValue, AccelerationUnit unit) { + if(unit == AccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 2ae69c2105..25a934310e 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -85,7 +85,7 @@ static AmountOfSubstance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static AmountOfSubstance() #endif AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit) { + if(unit == AmountOfSubstanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 21908ddbc5..2a923e3bf9 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -84,7 +84,7 @@ static AmplitudeRatio() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static AmplitudeRatio() #endif AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit) { + if(unit == AmplitudeRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 31f12e70d5..5cf37f370d 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -84,7 +84,7 @@ static Angle() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Angle() #endif Angle(double numericValue, AngleUnit unit) { + if(unit == AngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index d3b738c28f..57c4f21f3c 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -85,7 +85,7 @@ static ApparentEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ApparentEnergy() #endif ApparentEnergy(double numericValue, ApparentEnergyUnit unit) { + if(unit == ApparentEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 0c92300625..2c0e3e803e 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -85,7 +85,7 @@ static ApparentPower() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ApparentPower() #endif ApparentPower(double numericValue, ApparentPowerUnit unit) { + if(unit == ApparentPowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 55d5d0612c..4e8d498356 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -85,7 +85,7 @@ static Area() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Area() #endif Area(double numericValue, AreaUnit unit) { + if(unit == AreaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index cb1cfba4d1..276b89294b 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -85,7 +85,7 @@ static AreaDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static AreaDensity() #endif AreaDensity(double numericValue, AreaDensityUnit unit) { + if(unit == AreaDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 0c8c11b930..060e0cb7c5 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -85,7 +85,7 @@ static AreaMomentOfInertia() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static AreaMomentOfInertia() #endif AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit) { + if(unit == AreaMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index c80cb9103d..bb1962d612 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -84,7 +84,7 @@ static BitRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static BitRate() #endif BitRate(decimal numericValue, BitRateUnit unit) { + if(unit == BitRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index 8451783471..ab489620e6 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -85,7 +85,7 @@ static BrakeSpecificFuelConsumption() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static BrakeSpecificFuelConsumption() #endif BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsumptionUnit unit) { + if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 207d620ce3..40cd1c2f5d 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -85,7 +85,7 @@ static Capacitance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Capacitance() #endif Capacitance(double numericValue, CapacitanceUnit unit) { + if(unit == CapacitanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 424502289b..51d3a376f5 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -85,7 +85,7 @@ static Density() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Density() #endif Density(double numericValue, DensityUnit unit) { + if(unit == DensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index fb65aefdf7..2dd85fa7a0 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -85,7 +85,7 @@ static Duration() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Duration() #endif Duration(double numericValue, DurationUnit unit) { + if(unit == DurationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 019b542850..0d68bf7301 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -85,7 +85,7 @@ static DynamicViscosity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static DynamicViscosity() #endif DynamicViscosity(double numericValue, DynamicViscosityUnit unit) { + if(unit == DynamicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index d80d3e16b4..e9d80577b0 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricAdmittance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricAdmittance() #endif ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit) { + if(unit == ElectricAdmittanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 1c871dbf10..803d924b53 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCharge() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCharge() #endif ElectricCharge(double numericValue, ElectricChargeUnit unit) { + if(unit == ElectricChargeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 0c96f85a45..456266e71f 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricChargeDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricChargeDensity() #endif ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit unit) { + if(unit == ElectricChargeDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index faf9943273..bdf193ed08 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricConductance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricConductance() #endif ElectricConductance(double numericValue, ElectricConductanceUnit unit) { + if(unit == ElectricConductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index b7eecdd660..e738ae597b 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricConductivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricConductivity() #endif ElectricConductivity(double numericValue, ElectricConductivityUnit unit) { + if(unit == ElectricConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index c89040b50b..7e095a01fa 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCurrent() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCurrent() #endif ElectricCurrent(double numericValue, ElectricCurrentUnit unit) { + if(unit == ElectricCurrentUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 07dc957242..80a5896afc 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCurrentDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCurrentDensity() #endif ElectricCurrentDensity(double numericValue, ElectricCurrentDensityUnit unit) { + if(unit == ElectricCurrentDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 98ba0877fa..e3150cf62e 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCurrentGradient() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCurrentGradient() #endif ElectricCurrentGradient(double numericValue, ElectricCurrentGradientUnit unit) { + if(unit == ElectricCurrentGradientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index c7f4415c0d..1dd721f78d 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -85,7 +85,7 @@ static ElectricField() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricField() #endif ElectricField(double numericValue, ElectricFieldUnit unit) { + if(unit == ElectricFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 5e99aca8fc..604be2d0e7 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricInductance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricInductance() #endif ElectricInductance(double numericValue, ElectricInductanceUnit unit) { + if(unit == ElectricInductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 1335fe4f02..cee26f9c96 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -85,7 +85,7 @@ static ElectricPotential() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricPotential() #endif ElectricPotential(double numericValue, ElectricPotentialUnit unit) { + if(unit == ElectricPotentialUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index ede77df0b7..845b7f15a1 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -84,7 +84,7 @@ static ElectricPotentialAc() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static ElectricPotentialAc() #endif ElectricPotentialAc(double numericValue, ElectricPotentialAcUnit unit) { + if(unit == ElectricPotentialAcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 646534343f..adf2dd26c7 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -84,7 +84,7 @@ static ElectricPotentialDc() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static ElectricPotentialDc() #endif ElectricPotentialDc(double numericValue, ElectricPotentialDcUnit unit) { + if(unit == ElectricPotentialDcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index edfbe3cf3c..38f5aa4f63 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricResistance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricResistance() #endif ElectricResistance(double numericValue, ElectricResistanceUnit unit) { + if(unit == ElectricResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 1bf2b97e84..a1196038e5 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricResistivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricResistivity() #endif ElectricResistivity(double numericValue, ElectricResistivityUnit unit) { + if(unit == ElectricResistivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 300d8ebd52..21a5e464e8 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -85,7 +85,7 @@ static Energy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Energy() #endif Energy(double numericValue, EnergyUnit unit) { + if(unit == EnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index 58134e394d..e695b349f6 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -85,7 +85,7 @@ static Entropy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Entropy() #endif Entropy(double numericValue, EntropyUnit unit) { + if(unit == EntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 423da91f80..dc687014d4 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -85,7 +85,7 @@ static Force() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Force() #endif Force(double numericValue, ForceUnit unit) { + if(unit == ForceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 8d40ac8eed..185b004d19 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -85,7 +85,7 @@ static ForceChangeRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ForceChangeRate() #endif ForceChangeRate(double numericValue, ForceChangeRateUnit unit) { + if(unit == ForceChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index b125ddab77..095821a376 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -85,7 +85,7 @@ static ForcePerLength() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ForcePerLength() #endif ForcePerLength(double numericValue, ForcePerLengthUnit unit) { + if(unit == ForcePerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index ad20b1e708..28f561007c 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -85,7 +85,7 @@ static Frequency() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Frequency() #endif Frequency(double numericValue, FrequencyUnit unit) { + if(unit == FrequencyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 3924581ad1..60a80f59bc 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -85,7 +85,7 @@ static HeatFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static HeatFlux() #endif HeatFlux(double numericValue, HeatFluxUnit unit) { + if(unit == HeatFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 0af5b86e65..79fbb16f01 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -85,7 +85,7 @@ static HeatTransferCoefficient() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static HeatTransferCoefficient() #endif HeatTransferCoefficient(double numericValue, HeatTransferCoefficientUnit unit) { + if(unit == HeatTransferCoefficientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index fa620ee0f1..b04962702f 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -85,7 +85,7 @@ static Illuminance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Illuminance() #endif Illuminance(double numericValue, IlluminanceUnit unit) { + if(unit == IlluminanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index f970685a84..8faa30c6e9 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -84,7 +84,7 @@ static Information() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Information() #endif Information(decimal numericValue, InformationUnit unit) { + if(unit == InformationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index e88be7e7e5..8ac3e0e0eb 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -85,7 +85,7 @@ static Irradiance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Irradiance() #endif Irradiance(double numericValue, IrradianceUnit unit) { + if(unit == IrradianceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 185c9dc106..7f2d9760b2 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -85,7 +85,7 @@ static Irradiation() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Irradiation() #endif Irradiation(double numericValue, IrradiationUnit unit) { + if(unit == IrradiationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 31ab830023..32a767342a 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -85,7 +85,7 @@ static KinematicViscosity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static KinematicViscosity() #endif KinematicViscosity(double numericValue, KinematicViscosityUnit unit) { + if(unit == KinematicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index f151d87f4b..d35d311ac1 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -85,7 +85,7 @@ static LapseRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LapseRate() #endif LapseRate(double numericValue, LapseRateUnit unit) { + if(unit == LapseRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index df3c766803..6f27d38fca 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -85,7 +85,7 @@ static Length() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Length() #endif Length(double numericValue, LengthUnit unit) { + if(unit == LengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 135559cb2b..5d5b97c5d6 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -84,7 +84,7 @@ static Level() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Level() #endif Level(double numericValue, LevelUnit unit) { + if(unit == LevelUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index ed61cef9dc..12fb970428 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -85,7 +85,7 @@ static LinearDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LinearDensity() #endif LinearDensity(double numericValue, LinearDensityUnit unit) { + if(unit == LinearDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index bbe14681e8..1b85162ec6 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -85,7 +85,7 @@ static LuminousFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LuminousFlux() #endif LuminousFlux(double numericValue, LuminousFluxUnit unit) { + if(unit == LuminousFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 105d0ab1b6..7ab5e508c0 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -85,7 +85,7 @@ static LuminousIntensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LuminousIntensity() #endif LuminousIntensity(double numericValue, LuminousIntensityUnit unit) { + if(unit == LuminousIntensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 777010fce3..9670600aa0 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -85,7 +85,7 @@ static MagneticField() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MagneticField() #endif MagneticField(double numericValue, MagneticFieldUnit unit) { + if(unit == MagneticFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index eab4ccba84..ecf97a2aa1 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -85,7 +85,7 @@ static MagneticFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MagneticFlux() #endif MagneticFlux(double numericValue, MagneticFluxUnit unit) { + if(unit == MagneticFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 3fe35ea7f5..0cdd76a5f7 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -85,7 +85,7 @@ static Magnetization() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Magnetization() #endif Magnetization(double numericValue, MagnetizationUnit unit) { + if(unit == MagnetizationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 9aeaac81ef..c0292d940d 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -85,7 +85,7 @@ static Mass() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Mass() #endif Mass(double numericValue, MassUnit unit) { + if(unit == MassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index 4920b42077..d94bf06be9 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -85,7 +85,7 @@ static MassFlow() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MassFlow() #endif MassFlow(double numericValue, MassFlowUnit unit) { + if(unit == MassFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index b7eaf6eeff..7fc96defff 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -85,7 +85,7 @@ static MassFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MassFlux() #endif MassFlux(double numericValue, MassFluxUnit unit) { + if(unit == MassFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 6dd62ed4b8..5a7d16d447 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -85,7 +85,7 @@ static MassMomentOfInertia() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MassMomentOfInertia() #endif MassMomentOfInertia(double numericValue, MassMomentOfInertiaUnit unit) { + if(unit == MassMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 7d9bdf58b3..75d55e12a4 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -85,7 +85,7 @@ static MolarEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MolarEnergy() #endif MolarEnergy(double numericValue, MolarEnergyUnit unit) { + if(unit == MolarEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index a198221bc0..d268149d27 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -85,7 +85,7 @@ static MolarEntropy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MolarEntropy() #endif MolarEntropy(double numericValue, MolarEntropyUnit unit) { + if(unit == MolarEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index caaf577f31..3bec571f22 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -85,7 +85,7 @@ static MolarMass() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MolarMass() #endif MolarMass(double numericValue, MolarMassUnit unit) { + if(unit == MolarMassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index 5a11b934cf..f25cefd5d0 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -85,7 +85,7 @@ static Molarity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Molarity() #endif Molarity(double numericValue, MolarityUnit unit) { + if(unit == MolarityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 605d01f70f..33554f2ecc 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -85,7 +85,7 @@ static Permeability() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Permeability() #endif Permeability(double numericValue, PermeabilityUnit unit) { + if(unit == PermeabilityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 5e478eebca..b52fa37930 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -85,7 +85,7 @@ static Permittivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Permittivity() #endif Permittivity(double numericValue, PermittivityUnit unit) { + if(unit == PermittivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index ba59d32489..f83a8256d0 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -85,7 +85,7 @@ static Power() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Power() #endif Power(decimal numericValue, PowerUnit unit) { + if(unit == PowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 8d8ab2583b..bb32edabf2 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -85,7 +85,7 @@ static PowerDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static PowerDensity() #endif PowerDensity(double numericValue, PowerDensityUnit unit) { + if(unit == PowerDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 76a694a796..7f00035b07 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -84,7 +84,7 @@ static PowerRatio() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static PowerRatio() #endif PowerRatio(double numericValue, PowerRatioUnit unit) { + if(unit == PowerRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index ec02f2f093..9b1ed49c46 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -85,7 +85,7 @@ static Pressure() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Pressure() #endif Pressure(double numericValue, PressureUnit unit) { + if(unit == PressureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 5eb9d4e36f..d4272d02f0 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -85,7 +85,7 @@ static PressureChangeRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static PressureChangeRate() #endif PressureChangeRate(double numericValue, PressureChangeRateUnit unit) { + if(unit == PressureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 9a9ed80adf..738f138e7c 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -84,7 +84,7 @@ static Ratio() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Ratio() #endif Ratio(double numericValue, RatioUnit unit) { + if(unit == RatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index f0c04d4347..dbff2b914b 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -85,7 +85,7 @@ static ReactiveEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ReactiveEnergy() #endif ReactiveEnergy(double numericValue, ReactiveEnergyUnit unit) { + if(unit == ReactiveEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index 58efa1c60c..71565b2f36 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -85,7 +85,7 @@ static ReactivePower() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ReactivePower() #endif ReactivePower(double numericValue, ReactivePowerUnit unit) { + if(unit == ReactivePowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 62db2b62c3..02fb49c631 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -85,7 +85,7 @@ static RotationalAcceleration() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalAcceleration() #endif RotationalAcceleration(double numericValue, RotationalAccelerationUnit unit) { + if(unit == RotationalAccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 62a31f62bf..1e39a23e6c 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -85,7 +85,7 @@ static RotationalSpeed() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalSpeed() #endif RotationalSpeed(double numericValue, RotationalSpeedUnit unit) { + if(unit == RotationalSpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 6b9bff2b71..8bf6de9434 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -85,7 +85,7 @@ static RotationalStiffness() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalStiffness() #endif RotationalStiffness(double numericValue, RotationalStiffnessUnit unit) { + if(unit == RotationalStiffnessUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 67cbb7fb44..450cad0399 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -85,7 +85,7 @@ static RotationalStiffnessPerLength() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalStiffnessPerLength() #endif RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPerLengthUnit unit) { + if(unit == RotationalStiffnessPerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index ecdbbb4195..cfd85fc85e 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -84,7 +84,7 @@ static SolidAngle() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static SolidAngle() #endif SolidAngle(double numericValue, SolidAngleUnit unit) { + if(unit == SolidAngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index 6ec937c74f..ed49eb7f15 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -85,7 +85,7 @@ static SpecificEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificEnergy() #endif SpecificEnergy(double numericValue, SpecificEnergyUnit unit) { + if(unit == SpecificEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 3842b05971..0ea0131f12 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -85,7 +85,7 @@ static SpecificEntropy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificEntropy() #endif SpecificEntropy(double numericValue, SpecificEntropyUnit unit) { + if(unit == SpecificEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 2f1280f0aa..0bf0c2a59c 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -85,7 +85,7 @@ static SpecificVolume() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificVolume() #endif SpecificVolume(double numericValue, SpecificVolumeUnit unit) { + if(unit == SpecificVolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 339c20529d..976d3902b6 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -85,7 +85,7 @@ static SpecificWeight() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificWeight() #endif SpecificWeight(double numericValue, SpecificWeightUnit unit) { + if(unit == SpecificWeightUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 1910b3ae57..9c5f5665d6 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -85,7 +85,7 @@ static Speed() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Speed() #endif Speed(double numericValue, SpeedUnit unit) { + if(unit == SpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 2ee2dd11d2..050bbc24f3 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -85,7 +85,7 @@ static Temperature() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Temperature() #endif Temperature(double numericValue, TemperatureUnit unit) { + if(unit == TemperatureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 3fafb7743b..49b9afafce 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -85,7 +85,7 @@ static TemperatureChangeRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static TemperatureChangeRate() #endif TemperatureChangeRate(double numericValue, TemperatureChangeRateUnit unit) { + if(unit == TemperatureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 8728ee1613..0d3bfa2d7b 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -84,7 +84,7 @@ static TemperatureDelta() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static TemperatureDelta() #endif TemperatureDelta(double numericValue, TemperatureDeltaUnit unit) { + if(unit == TemperatureDeltaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index e433887e49..f2c943ea0d 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -85,7 +85,7 @@ static ThermalConductivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ThermalConductivity() #endif ThermalConductivity(double numericValue, ThermalConductivityUnit unit) { + if(unit == ThermalConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 9652cb4f1d..24ad6aa00f 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -85,7 +85,7 @@ static ThermalResistance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ThermalResistance() #endif ThermalResistance(double numericValue, ThermalResistanceUnit unit) { + if(unit == ThermalResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index d0187fa896..c21a58e936 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -85,7 +85,7 @@ static Torque() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Torque() #endif Torque(double numericValue, TorqueUnit unit) { + if(unit == TorqueUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 43a11b2394..1df049ea0a 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -84,7 +84,7 @@ static VitaminA() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static VitaminA() #endif VitaminA(double numericValue, VitaminAUnit unit) { + if(unit == VitaminAUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index f4b37e14a4..33fcc4ecd0 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -85,7 +85,7 @@ static Volume() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Volume() #endif Volume(double numericValue, VolumeUnit unit) { + if(unit == VolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 6d1309ae28..b89e54f5a6 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -85,7 +85,7 @@ static VolumeFlow() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static VolumeFlow() #endif VolumeFlow(double numericValue, VolumeFlowUnit unit) { + if(unit == VolumeFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index d5d8d54956..ba2c5b5060 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -83,6 +83,12 @@ public abstract partial class AccelerationTestsBase protected virtual double StandardGravityTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Acceleration((double)0.0, AccelerationUnit.Undefined)); + } + [Fact] public void MeterPerSecondSquaredToAccelerationUnits() { @@ -296,6 +302,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AccelerationUnit.Undefined, Acceleration.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index ad91ab381d..fde1d52585 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -85,6 +85,12 @@ public abstract partial class AmountOfSubstanceTestsBase protected virtual double PoundMolesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AmountOfSubstance((double)0.0, AmountOfSubstanceUnit.Undefined)); + } + [Fact] public void MoleToAmountOfSubstanceUnits() { @@ -306,6 +312,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AmountOfSubstanceUnit.Undefined, AmountOfSubstance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 56400c05f3..7bd0e75139 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class AmplitudeRatioTestsBase protected virtual double DecibelVoltsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AmplitudeRatio((double)0.0, AmplitudeRatioUnit.Undefined)); + } + [Fact] public void DecibelVoltToAmplitudeRatioUnits() { @@ -211,6 +217,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AmplitudeRatioUnit.Undefined, AmplitudeRatio.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index b024d92619..f8e6959e4f 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -85,6 +85,12 @@ public abstract partial class AngleTestsBase protected virtual double RevolutionsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Angle((double)0.0, AngleUnit.Undefined)); + } + [Fact] public void DegreeToAngleUnits() { @@ -306,6 +312,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AngleUnit.Undefined, Angle.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index 6fab19f62f..a7b21d9922 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class ApparentEnergyTestsBase protected virtual double VoltampereHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ApparentEnergy((double)0.0, ApparentEnergyUnit.Undefined)); + } + [Fact] public void VoltampereHourToApparentEnergyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ApparentEnergyUnit.Undefined, ApparentEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index 91ad20b6c2..8a46336a98 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ApparentPowerTestsBase protected virtual double VoltamperesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ApparentPower((double)0.0, ApparentPowerUnit.Undefined)); + } + [Fact] public void VoltampereToApparentPowerUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ApparentPowerUnit.Undefined, ApparentPower.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index 0d2dea3d1a..07df5efd07 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class AreaDensityTestsBase protected virtual double KilogramsPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AreaDensity((double)0.0, AreaDensityUnit.Undefined)); + } + [Fact] public void KilogramPerSquareMeterToAreaDensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaDensityUnit.Undefined, AreaDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index 95e82fc60a..19253d24cd 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -69,6 +69,12 @@ public abstract partial class AreaMomentOfInertiaTestsBase protected virtual double MillimetersToTheFourthTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AreaMomentOfInertia((double)0.0, AreaMomentOfInertiaUnit.Undefined)); + } + [Fact] public void MeterToTheFourthToAreaMomentOfInertiaUnits() { @@ -226,6 +232,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaMomentOfInertiaUnit.Undefined, AreaMomentOfInertia.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index fd609e9363..229f2a8862 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -83,6 +83,12 @@ public abstract partial class AreaTestsBase protected virtual double UsSurveySquareFeetTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Area((double)0.0, AreaUnit.Undefined)); + } + [Fact] public void SquareMeterToAreaUnits() { @@ -296,6 +302,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaUnit.Undefined, Area.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index 4ffd779db9..12d6add74c 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class BitRateTestsBase protected virtual double TerabytesPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new BitRate((decimal)0.0, BitRateUnit.Undefined)); + } + [Fact] public void BitPerSecondToBitRateUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(BitRateUnit.Undefined, BitRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index f6970db1c4..07bc6fd165 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class BrakeSpecificFuelConsumptionTestsBase protected virtual double PoundsPerMechanicalHorsepowerHourTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new BrakeSpecificFuelConsumption((double)0.0, BrakeSpecificFuelConsumptionUnit.Undefined)); + } + [Fact] public void KilogramPerJouleToBrakeSpecificFuelConsumptionUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(BrakeSpecificFuelConsumptionUnit.Undefined, BrakeSpecificFuelConsumption.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index bf1403edc7..e0b8ea9f19 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class CapacitanceTestsBase protected virtual double FaradsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Capacitance((double)0.0, CapacitanceUnit.Undefined)); + } + [Fact] public void FaradToCapacitanceUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(CapacitanceUnit.Undefined, Capacitance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index 367edee704..c638a5da1c 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -133,6 +133,12 @@ public abstract partial class DensityTestsBase protected virtual double TonnesPerCubicMillimeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Density((double)0.0, DensityUnit.Undefined)); + } + [Fact] public void KilogramPerCubicMeterToDensityUnits() { @@ -546,6 +552,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DensityUnit.Undefined, Density.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index d5c69edeb0..f806a5304f 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -77,6 +77,12 @@ public abstract partial class DurationTestsBase protected virtual double Years365Tolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Duration((double)0.0, DurationUnit.Undefined)); + } + [Fact] public void SecondToDurationUnits() { @@ -266,6 +272,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DurationUnit.Undefined, Duration.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index 3d0034f8bd..be764da352 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -69,6 +69,12 @@ public abstract partial class DynamicViscosityTestsBase protected virtual double PoiseTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new DynamicViscosity((double)0.0, DynamicViscosityUnit.Undefined)); + } + [Fact] public void NewtonSecondPerMeterSquaredToDynamicViscosityUnits() { @@ -226,6 +232,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DynamicViscosityUnit.Undefined, DynamicViscosity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index 52ce56c277..96dedd353c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ElectricAdmittanceTestsBase protected virtual double SiemensTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricAdmittance((double)0.0, ElectricAdmittanceUnit.Undefined)); + } + [Fact] public void SiemensToElectricAdmittanceUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricAdmittanceUnit.Undefined, ElectricAdmittance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index f8db7c5e41..dbb00507bd 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricChargeDensityTestsBase protected virtual double CoulombsPerCubicMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricChargeDensity((double)0.0, ElectricChargeDensityUnit.Undefined)); + } + [Fact] public void CoulombPerCubicMeterToElectricChargeDensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricChargeDensityUnit.Undefined, ElectricChargeDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index dca2f01ccc..f29eb270ae 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricChargeTestsBase protected virtual double CoulombsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCharge((double)0.0, ElectricChargeUnit.Undefined)); + } + [Fact] public void CoulombToElectricChargeUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricChargeUnit.Undefined, ElectricCharge.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index dc0bf955c7..2da4b3b45d 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class ElectricConductanceTestsBase protected virtual double SiemensTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductance((double)0.0, ElectricConductanceUnit.Undefined)); + } + [Fact] public void SiemensToElectricConductanceUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricConductanceUnit.Undefined, ElectricConductance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index e2b68f3af9..30448d33a6 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricConductivityTestsBase protected virtual double SiemensPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductivity((double)0.0, ElectricConductivityUnit.Undefined)); + } + [Fact] public void SiemensPerMeterToElectricConductivityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricConductivityUnit.Undefined, ElectricConductivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index ec9b3c9491..5d27add425 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricCurrentDensityTestsBase protected virtual double AmperesPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentDensity((double)0.0, ElectricCurrentDensityUnit.Undefined)); + } + [Fact] public void AmperePerSquareMeterToElectricCurrentDensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentDensityUnit.Undefined, ElectricCurrentDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 87a2096ef1..2b10f1c8e2 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricCurrentGradientTestsBase protected virtual double AmperesPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentGradient((double)0.0, ElectricCurrentGradientUnit.Undefined)); + } + [Fact] public void AmperePerSecondToElectricCurrentGradientUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentGradientUnit.Undefined, ElectricCurrentGradient.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index fbdc010cd2..593380c1e0 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class ElectricCurrentTestsBase protected virtual double PicoamperesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrent((double)0.0, ElectricCurrentUnit.Undefined)); + } + [Fact] public void AmpereToElectricCurrentUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentUnit.Undefined, ElectricCurrent.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index ee0f64934c..ec025d2ebe 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricFieldTestsBase protected virtual double VoltsPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricField((double)0.0, ElectricFieldUnit.Undefined)); + } + [Fact] public void VoltPerMeterToElectricFieldUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricFieldUnit.Undefined, ElectricField.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index 21cb45fb10..da5260e825 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricInductanceTestsBase protected virtual double HenriesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricInductance((double)0.0, ElectricInductanceUnit.Undefined)); + } + [Fact] public void HenryToElectricInductanceUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricInductanceUnit.Undefined, ElectricInductance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index 4e00d0f1d4..6135c12ca4 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ElectricPotentialAcTestsBase protected virtual double VoltsAcTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialAc((double)0.0, ElectricPotentialAcUnit.Undefined)); + } + [Fact] public void VoltAcToElectricPotentialAcUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialAcUnit.Undefined, ElectricPotentialAc.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index 31ae99171d..abdb8e516f 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ElectricPotentialDcTestsBase protected virtual double VoltsDcTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialDc((double)0.0, ElectricPotentialDcUnit.Undefined)); + } + [Fact] public void VoltDcToElectricPotentialDcUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialDcUnit.Undefined, ElectricPotentialDc.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index 3418f8e556..ef42925c11 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ElectricPotentialTestsBase protected virtual double VoltsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotential((double)0.0, ElectricPotentialUnit.Undefined)); + } + [Fact] public void VoltToElectricPotentialUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialUnit.Undefined, ElectricPotential.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index 58d093de1f..4ab6ca465b 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ElectricResistanceTestsBase protected virtual double OhmsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistance((double)0.0, ElectricResistanceUnit.Undefined)); + } + [Fact] public void OhmToElectricResistanceUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricResistanceUnit.Undefined, ElectricResistance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index e3f152c82d..93f601197c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ElectricResistivityTestsBase protected virtual double OhmMetersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistivity((double)0.0, ElectricResistivityUnit.Undefined)); + } + [Fact] public void OhmMeterToElectricResistivityUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricResistivityUnit.Undefined, ElectricResistivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 185cb209b8..973c61ae6c 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -101,6 +101,12 @@ public abstract partial class EnergyTestsBase protected virtual double WattHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Energy((double)0.0, EnergyUnit.Undefined)); + } + [Fact] public void JouleToEnergyUnits() { @@ -386,6 +392,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(EnergyUnit.Undefined, Energy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index 9be160a987..b1e00b640f 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -71,6 +71,12 @@ public abstract partial class EntropyTestsBase protected virtual double MegajoulesPerKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Entropy((double)0.0, EntropyUnit.Undefined)); + } + [Fact] public void JoulePerKelvinToEntropyUnits() { @@ -236,6 +242,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(EntropyUnit.Undefined, Entropy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index 71a10c50cd..c87b6b2446 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -79,6 +79,12 @@ public abstract partial class ForceChangeRateTestsBase protected virtual double NewtonsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ForceChangeRate((double)0.0, ForceChangeRateUnit.Undefined)); + } + [Fact] public void NewtonPerSecondToForceChangeRateUnits() { @@ -276,6 +282,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForceChangeRateUnit.Undefined, ForceChangeRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index 475ba70f58..3971157664 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -75,6 +75,12 @@ public abstract partial class ForcePerLengthTestsBase protected virtual double NewtonsPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ForcePerLength((double)0.0, ForcePerLengthUnit.Undefined)); + } + [Fact] public void NewtonPerMeterToForcePerLengthUnits() { @@ -256,6 +262,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForcePerLengthUnit.Undefined, ForcePerLength.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 675e78b0aa..6ddcd62956 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -77,6 +77,12 @@ public abstract partial class ForceTestsBase protected virtual double TonnesForceTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Force((double)0.0, ForceUnit.Undefined)); + } + [Fact] public void NewtonToForceUnits() { @@ -266,6 +272,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForceUnit.Undefined, Force.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index 57829de236..f691f536d3 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class FrequencyTestsBase protected virtual double TerahertzTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Frequency((double)0.0, FrequencyUnit.Undefined)); + } + [Fact] public void HertzToFrequencyUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(FrequencyUnit.Undefined, Frequency.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index 745ab078d4..c2af4c817f 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -89,6 +89,12 @@ public abstract partial class HeatFluxTestsBase protected virtual double WattsPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new HeatFlux((double)0.0, HeatFluxUnit.Undefined)); + } + [Fact] public void WattPerSquareMeterToHeatFluxUnits() { @@ -326,6 +332,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(HeatFluxUnit.Undefined, HeatFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index fbb8dfae1a..34b0b8f95a 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class HeatTransferCoefficientTestsBase protected virtual double WattsPerSquareMeterKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new HeatTransferCoefficient((double)0.0, HeatTransferCoefficientUnit.Undefined)); + } + [Fact] public void WattPerSquareMeterKelvinToHeatTransferCoefficientUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(HeatTransferCoefficientUnit.Undefined, HeatTransferCoefficient.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index bb41e712c1..1c6f6800ea 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class IlluminanceTestsBase protected virtual double MilliluxTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Illuminance((double)0.0, IlluminanceUnit.Undefined)); + } + [Fact] public void LuxToIlluminanceUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IlluminanceUnit.Undefined, Illuminance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 9838aae21a..421a6f0a72 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class InformationTestsBase protected virtual double TerabytesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Information((decimal)0.0, InformationUnit.Undefined)); + } + [Fact] public void BitToInformationUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(InformationUnit.Undefined, Information.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index abafe1662d..02d02ab401 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class IrradianceTestsBase protected virtual double WattsPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Irradiance((double)0.0, IrradianceUnit.Undefined)); + } + [Fact] public void WattPerSquareMeterToIrradianceUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IrradianceUnit.Undefined, Irradiance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index 9beaf2316b..9ca8965d52 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class IrradiationTestsBase protected virtual double WattHoursPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Irradiation((double)0.0, IrradiationUnit.Undefined)); + } + [Fact] public void JoulePerSquareMeterToIrradiationUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IrradiationUnit.Undefined, Irradiation.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 8658aff7ea..92f9a6a96d 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class KinematicViscosityTestsBase protected virtual double StokesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new KinematicViscosity((double)0.0, KinematicViscosityUnit.Undefined)); + } + [Fact] public void SquareMeterPerSecondToKinematicViscosityUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(KinematicViscosityUnit.Undefined, KinematicViscosity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 7d2fcf1f37..41a859da8e 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class LapseRateTestsBase protected virtual double DegreesCelciusPerKilometerTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LapseRate((double)0.0, LapseRateUnit.Undefined)); + } + [Fact] public void DegreeCelsiusPerKilometerToLapseRateUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LapseRateUnit.Undefined, LapseRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index 3b3e68c55a..a758944098 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -101,6 +101,12 @@ public abstract partial class LengthTestsBase protected virtual double YardsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Length((double)0.0, LengthUnit.Undefined)); + } + [Fact] public void MeterToLengthUnits() { @@ -386,6 +392,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LengthUnit.Undefined, Length.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 3bb2e29d6e..9e936cd71b 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class LevelTestsBase protected virtual double NepersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Level((double)0.0, LevelUnit.Undefined)); + } + [Fact] public void DecibelToLevelUnits() { @@ -191,6 +197,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LevelUnit.Undefined, Level.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index f539cd5237..42d59694cc 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class LinearDensityTestsBase protected virtual double PoundsPerFootTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LinearDensity((double)0.0, LinearDensityUnit.Undefined)); + } + [Fact] public void KilogramPerMeterToLinearDensityUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LinearDensityUnit.Undefined, LinearDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index 1d8377c939..0e7f2ffc33 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class LuminousFluxTestsBase protected virtual double LumensTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LuminousFlux((double)0.0, LuminousFluxUnit.Undefined)); + } + [Fact] public void LumenToLuminousFluxUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LuminousFluxUnit.Undefined, LuminousFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index 43a3f8571f..291b37b47f 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class LuminousIntensityTestsBase protected virtual double CandelaTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LuminousIntensity((double)0.0, LuminousIntensityUnit.Undefined)); + } + [Fact] public void CandelaToLuminousIntensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LuminousIntensityUnit.Undefined, LuminousIntensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index aa8c49db3f..28eba96a39 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class MagneticFieldTestsBase protected virtual double TeslasTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MagneticField((double)0.0, MagneticFieldUnit.Undefined)); + } + [Fact] public void TeslaToMagneticFieldUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagneticFieldUnit.Undefined, MagneticField.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index 0324d949a3..ef47677788 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class MagneticFluxTestsBase protected virtual double WebersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MagneticFlux((double)0.0, MagneticFluxUnit.Undefined)); + } + [Fact] public void WeberToMagneticFluxUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagneticFluxUnit.Undefined, MagneticFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index 9d0205fa94..f2cf6b5e78 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class MagnetizationTestsBase protected virtual double AmperesPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Magnetization((double)0.0, MagnetizationUnit.Undefined)); + } + [Fact] public void AmperePerMeterToMagnetizationUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagnetizationUnit.Undefined, Magnetization.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 9fd4c1d834..072cd491cd 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -87,6 +87,12 @@ public abstract partial class MassFlowTestsBase protected virtual double TonnesPerHourTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MassFlow((double)0.0, MassFlowUnit.Undefined)); + } + [Fact] public void GramPerSecondToMassFlowUnits() { @@ -316,6 +322,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassFlowUnit.Undefined, MassFlow.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index d8edec8a0b..2f4868ad6c 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class MassFluxTestsBase protected virtual double KilogramsPerSecondPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MassFlux((double)0.0, MassFluxUnit.Undefined)); + } + [Fact] public void KilogramPerSecondPerSquareMeterToMassFluxUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassFluxUnit.Undefined, MassFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index ab3adee533..8177a148a0 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class MassMomentOfInertiaTestsBase protected virtual double TonneSquareMilimetersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MassMomentOfInertia((double)0.0, MassMomentOfInertiaUnit.Undefined)); + } + [Fact] public void KilogramSquareMeterToMassMomentOfInertiaUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassMomentOfInertiaUnit.Undefined, MassMomentOfInertia.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index 13586290ae..03d53b92f2 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -99,6 +99,12 @@ public abstract partial class MassTestsBase protected virtual double TonnesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Mass((double)0.0, MassUnit.Undefined)); + } + [Fact] public void KilogramToMassUnits() { @@ -376,6 +382,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassUnit.Undefined, Mass.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index d513b87f1d..63fdc2a981 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class MolarEnergyTestsBase protected virtual double MegajoulesPerMoleTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MolarEnergy((double)0.0, MolarEnergyUnit.Undefined)); + } + [Fact] public void JoulePerMoleToMolarEnergyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarEnergyUnit.Undefined, MolarEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index fc31da2b01..1fc4cbf18e 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class MolarEntropyTestsBase protected virtual double MegajoulesPerMoleKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MolarEntropy((double)0.0, MolarEntropyUnit.Undefined)); + } + [Fact] public void JoulePerMoleKelvinToMolarEntropyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarEntropyUnit.Undefined, MolarEntropy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index fd8a848e71..2816dbc406 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -81,6 +81,12 @@ public abstract partial class MolarMassTestsBase protected virtual double PoundsPerMoleTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MolarMass((double)0.0, MolarMassUnit.Undefined)); + } + [Fact] public void KilogramPerMoleToMolarMassUnits() { @@ -286,6 +292,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarMassUnit.Undefined, MolarMass.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index 2d0bdd0d89..05fbb01ed6 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class MolarityTestsBase protected virtual double PicomolesPerLiterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Molarity((double)0.0, MolarityUnit.Undefined)); + } + [Fact] public void MolesPerCubicMeterToMolarityUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarityUnit.Undefined, Molarity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index f307316701..4891e3888d 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class PermeabilityTestsBase protected virtual double HenriesPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Permeability((double)0.0, PermeabilityUnit.Undefined)); + } + [Fact] public void HenryPerMeterToPermeabilityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PermeabilityUnit.Undefined, Permeability.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index 2ab368854a..43a78f4d07 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class PermittivityTestsBase protected virtual double FaradsPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Permittivity((double)0.0, PermittivityUnit.Undefined)); + } + [Fact] public void FaradPerMeterToPermittivityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PermittivityUnit.Undefined, Permittivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 8bc82409e1..814290401b 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -145,6 +145,12 @@ public abstract partial class PowerDensityTestsBase protected virtual double WattsPerLiterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new PowerDensity((double)0.0, PowerDensityUnit.Undefined)); + } + [Fact] public void WattPerCubicMeterToPowerDensityUnits() { @@ -606,6 +612,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerDensityUnit.Undefined, PowerDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index 998f067817..d680f2a4be 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class PowerRatioTestsBase protected virtual double DecibelWattsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new PowerRatio((double)0.0, PowerRatioUnit.Undefined)); + } + [Fact] public void DecibelWattToPowerRatioUnits() { @@ -191,6 +197,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerRatioUnit.Undefined, PowerRatio.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index 965e63128c..e8a5d7314b 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -97,6 +97,12 @@ public abstract partial class PowerTestsBase protected virtual double WattsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Power((decimal)0.0, PowerUnit.Undefined)); + } + [Fact] public void WattToPowerUnits() { @@ -366,6 +372,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerUnit.Undefined, Power.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index 879d0f0cd0..709037cb5b 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class PressureChangeRateTestsBase protected virtual double PascalsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new PressureChangeRate((double)0.0, PressureChangeRateUnit.Undefined)); + } + [Fact] public void PascalPerSecondToPressureChangeRateUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PressureChangeRateUnit.Undefined, PressureChangeRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index 3789e36921..3272a3b016 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -131,6 +131,12 @@ public abstract partial class PressureTestsBase protected virtual double TorrsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Pressure((double)0.0, PressureUnit.Undefined)); + } + [Fact] public void PascalToPressureUnits() { @@ -536,6 +542,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PressureUnit.Undefined, Pressure.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index 2c2397753a..eb06b07354 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -69,6 +69,12 @@ public abstract partial class RatioTestsBase protected virtual double PercentTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Ratio((double)0.0, RatioUnit.Undefined)); + } + [Fact] public void DecimalFractionToRatioUnits() { @@ -226,6 +232,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RatioUnit.Undefined, Ratio.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index 78212a0e1f..576d61d7d8 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class ReactiveEnergyTestsBase protected virtual double VoltampereReactiveHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ReactiveEnergy((double)0.0, ReactiveEnergyUnit.Undefined)); + } + [Fact] public void VoltampereReactiveHourToReactiveEnergyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ReactiveEnergyUnit.Undefined, ReactiveEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index 9b325f9183..4d148a5aea 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ReactivePowerTestsBase protected virtual double VoltamperesReactiveTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ReactivePower((double)0.0, ReactivePowerUnit.Undefined)); + } + [Fact] public void VoltampereReactiveToReactivePowerUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ReactivePowerUnit.Undefined, ReactivePower.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index 3e23884d1c..8fdfcf9640 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class RotationalAccelerationTestsBase protected virtual double RevolutionsPerMinutePerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalAcceleration((double)0.0, RotationalAccelerationUnit.Undefined)); + } + [Fact] public void RadianPerSecondSquaredToRotationalAccelerationUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalAccelerationUnit.Undefined, RotationalAcceleration.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index c031eebfde..4da0c2a40f 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -83,6 +83,12 @@ public abstract partial class RotationalSpeedTestsBase protected virtual double RevolutionsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalSpeed((double)0.0, RotationalSpeedUnit.Undefined)); + } + [Fact] public void RadianPerSecondToRotationalSpeedUnits() { @@ -296,6 +302,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalSpeedUnit.Undefined, RotationalSpeed.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 2d0dab215e..6ddb83a45d 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class RotationalStiffnessPerLengthTestsBase protected virtual double NewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffnessPerLength((double)0.0, RotationalStiffnessPerLengthUnit.Undefined)); + } + [Fact] public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalStiffnessPerLengthUnit.Undefined, RotationalStiffnessPerLength.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index cf8e152fa6..f780416a16 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class RotationalStiffnessTestsBase protected virtual double NewtonMetersPerRadianTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffness((double)0.0, RotationalStiffnessUnit.Undefined)); + } + [Fact] public void NewtonMeterPerRadianToRotationalStiffnessUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalStiffnessUnit.Undefined, RotationalStiffness.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index f673e26e4e..fd7eaa5e7e 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class SolidAngleTestsBase protected virtual double SteradiansTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SolidAngle((double)0.0, SolidAngleUnit.Undefined)); + } + [Fact] public void SteradianToSolidAngleUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SolidAngleUnit.Undefined, SolidAngle.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index 1072b5c4a3..46c74ab544 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class SpecificEnergyTestsBase protected virtual double WattHoursPerKilogramTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificEnergy((double)0.0, SpecificEnergyUnit.Undefined)); + } + [Fact] public void JoulePerKilogramToSpecificEnergyUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificEnergyUnit.Undefined, SpecificEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 9c49f40558..824d0434ff 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class SpecificEntropyTestsBase protected virtual double MegajoulesPerKilogramKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificEntropy((double)0.0, SpecificEntropyUnit.Undefined)); + } + [Fact] public void JoulePerKilogramKelvinToSpecificEntropyUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificEntropyUnit.Undefined, SpecificEntropy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 8a91d36863..9b0c7d3f3a 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class SpecificVolumeTestsBase protected virtual double CubicMetersPerKilogramTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificVolume((double)0.0, SpecificVolumeUnit.Undefined)); + } + [Fact] public void CubicMeterPerKilogramToSpecificVolumeUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificVolumeUnit.Undefined, SpecificVolume.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index 6221a093a1..2a1e87bdf5 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -91,6 +91,12 @@ public abstract partial class SpecificWeightTestsBase protected virtual double TonnesForcePerCubicMillimeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificWeight((double)0.0, SpecificWeightUnit.Undefined)); + } + [Fact] public void NewtonPerCubicMeterToSpecificWeightUnits() { @@ -336,6 +342,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificWeightUnit.Undefined, SpecificWeight.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index b26aec893d..186d6cd018 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -121,6 +121,12 @@ public abstract partial class SpeedTestsBase protected virtual double YardsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Speed((double)0.0, SpeedUnit.Undefined)); + } + [Fact] public void MeterPerSecondToSpeedUnits() { @@ -486,6 +492,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpeedUnit.Undefined, Speed.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index 7d5d3aea7f..7d5e999225 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -77,6 +77,12 @@ public abstract partial class TemperatureChangeRateTestsBase protected virtual double NanodegreesCelsiusPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new TemperatureChangeRate((double)0.0, TemperatureChangeRateUnit.Undefined)); + } + [Fact] public void DegreeCelsiusPerSecondToTemperatureChangeRateUnits() { @@ -266,6 +272,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureChangeRateUnit.Undefined, TemperatureChangeRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index d22896a6c6..3266bb7e50 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class TemperatureDeltaTestsBase protected virtual double KelvinsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new TemperatureDelta((double)0.0, TemperatureDeltaUnit.Undefined)); + } + [Fact] public void KelvinToTemperatureDeltaUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureDeltaUnit.Undefined, TemperatureDelta.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 43f99b4864..4c2bf7e7db 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class TemperatureTestsBase protected virtual double KelvinsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Temperature((double)0.0, TemperatureUnit.Undefined)); + } + [Fact] public void KelvinToTemperatureUnits() { @@ -234,6 +240,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureUnit.Undefined, Temperature.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index 8c8c4384b2..83373ac345 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class ThermalConductivityTestsBase protected virtual double WattsPerMeterKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ThermalConductivity((double)0.0, ThermalConductivityUnit.Undefined)); + } + [Fact] public void WattPerMeterKelvinToThermalConductivityUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ThermalConductivityUnit.Undefined, ThermalConductivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index 5a7b6d6e70..c9402bb963 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ThermalResistanceTestsBase protected virtual double SquareMeterKelvinsPerKilowattTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ThermalResistance((double)0.0, ThermalResistanceUnit.Undefined)); + } + [Fact] public void SquareMeterKelvinPerKilowattToThermalResistanceUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ThermalResistanceUnit.Undefined, ThermalResistance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index 297647516e..e698b9395d 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -99,6 +99,12 @@ public abstract partial class TorqueTestsBase protected virtual double TonneForceMillimetersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Torque((double)0.0, TorqueUnit.Undefined)); + } + [Fact] public void NewtonMeterToTorqueUnits() { @@ -376,6 +382,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TorqueUnit.Undefined, Torque.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index 8d5d86f2e6..d3c8577c7c 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class VitaminATestsBase protected virtual double InternationalUnitsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new VitaminA((double)0.0, VitaminAUnit.Undefined)); + } + [Fact] public void InternationalUnitToVitaminAUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VitaminAUnit.Undefined, VitaminA.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index 2e70cb5e58..bd35c2aed0 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class VolumeFlowTestsBase protected virtual double UsGallonsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new VolumeFlow((double)0.0, VolumeFlowUnit.Undefined)); + } + [Fact] public void CubicMeterPerSecondToVolumeFlowUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VolumeFlowUnit.Undefined, VolumeFlow.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 7c6ccebad0..572660d5ae 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -141,6 +141,12 @@ public abstract partial class VolumeTestsBase protected virtual double UsTeaspoonsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Volume((double)0.0, VolumeUnit.Undefined)); + } + [Fact] public void CubicMeterToVolumeUnits() { @@ -586,6 +592,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VolumeUnit.Undefined, Volume.Units); } - } } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 020ede7da5..5205ca1ff0 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -5,8 +5,6 @@ $baseType = $quantity.BaseType; $baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } $baseUnitSingularName = $baseUnit.SingularName - $baseUnitPluralName = $baseUnit.PluralName - $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() $unitEnumName = "$quantityName" + "Unit" # Base dimensions @@ -19,25 +17,6 @@ $baseDimensionAmountOfSubstance = if($baseDimensions.N){$baseDimensions.N} else{0}; $baseDimensionLuminousIntensity = if($baseDimensions.J){$baseDimensions.J} else{0}; - $convertToBaseType = switch ($baseType) { - "long" { "Convert.ToInt64"; break } - "double" { "Convert.ToDouble"; break } - "decimal" { "Convert.ToDecimal"; break } - default { throw "Base type not supported: $baseType" } - } - - $quantityValueType = switch ($baseType) { - "long" { "QuantityValue"; break } - "double" { "QuantityValue"; break } - "decimal" { "QuantityValue"; break } - default { throw "Base type not supported: $baseType" } - } - - $obsoleteEqualityIfDouble = '' - if ($quantity.BaseType -eq "double") { - $obsoleteEqualityIfDouble = '[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]' + "`r`n " - } - @" //------------------------------------------------------------------------------ // @@ -140,7 +119,7 @@ if ($obsoleteAttribute) /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -150,6 +129,9 @@ if ($obsoleteAttribute) #endif $quantityName($baseType numericValue, $unitEnumName unit) { + if(unit == $unitEnumName.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } @@ -218,7 +200,7 @@ if ($obsoleteAttribute) [Windows.Foundation.Metadata.DefaultOverload] public static $quantityName From$($unit.PluralName)(double $valueParamName) #else - public static $quantityName From$($unit.PluralName)($quantityValueType $valueParamName) + public static $quantityName From$($unit.PluralName)(QuantityValue $valueParamName) #endif { $baseType value = ($baseType) $valueParamName; @@ -238,7 +220,7 @@ if ($obsoleteAttribute) [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] public static $quantityName From(double value, $unitEnumName fromUnit) #else - public static $quantityName From($quantityValueType value, $unitEnumName fromUnit) + public static $quantityName From(QuantityValue value, $unitEnumName fromUnit) #endif { return new $quantityName(($baseType)value, fromUnit); diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 128543bb3f..d8ecf8a111 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -9,35 +9,6 @@ $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() $unitEnumName = "$quantityName" + "Unit" - # Base dimensions - $baseDimensions = $quantity.BaseDimensions; - $baseDimensionLength = if($baseDimensions.L){$baseDimensions.L} else{0}; - $baseDimensionMass = if($baseDimensions.M){$baseDimensions.M} else{0}; - $baseDimensionTime = if($baseDimensions.T){$baseDimensions.T} else{0}; - $baseDimensionElectricCurrent = if($baseDimensions.I){$baseDimensions.I} else{0}; - $baseDimensionTemperature = if($baseDimensions.Θ){$baseDimensions.Θ} else{0}; - $baseDimensionAmountOfSubstance = if($baseDimensions.N){$baseDimensions.N} else{0}; - $baseDimensionLuminousIntensity = if($baseDimensions.J){$baseDimensions.J} else{0}; - - $convertToBaseType = switch ($baseType) { - "long" { "Convert.ToInt64"; break } - "double" { "Convert.ToDouble"; break } - "decimal" { "Convert.ToDecimal"; break } - default { throw "Base type not supported: $baseType" } - } - - $quantityValueType = switch ($baseType) { - "long" { "QuantityValue"; break } - "double" { "QuantityValue"; break } - "decimal" { "QuantityValue"; break } - default { throw "Base type not supported: $baseType" } - } - - $obsoleteEqualityIfDouble = '' - if ($quantity.BaseType -eq "double") { - $obsoleteEqualityIfDouble = '[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]' + "`r`n " - } - @" //------------------------------------------------------------------------------ // diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index 022f406f83..96146d14e0 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -9,35 +9,6 @@ $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() $unitEnumName = "$quantityName" + "Unit" - # Base dimensions - $baseDimensions = $quantity.BaseDimensions; - $baseDimensionLength = if($baseDimensions.L){$baseDimensions.L} else{0}; - $baseDimensionMass = if($baseDimensions.M){$baseDimensions.M} else{0}; - $baseDimensionTime = if($baseDimensions.T){$baseDimensions.T} else{0}; - $baseDimensionElectricCurrent = if($baseDimensions.I){$baseDimensions.I} else{0}; - $baseDimensionTemperature = if($baseDimensions.Θ){$baseDimensions.Θ} else{0}; - $baseDimensionAmountOfSubstance = if($baseDimensions.N){$baseDimensions.N} else{0}; - $baseDimensionLuminousIntensity = if($baseDimensions.J){$baseDimensions.J} else{0}; - - $convertToBaseType = switch ($baseType) { - "long" { "Convert.ToInt64"; break } - "double" { "Convert.ToDouble"; break } - "decimal" { "Convert.ToDecimal"; break } - default { throw "Base type not supported: $baseType" } - } - - $quantityValueType = switch ($baseType) { - "long" { "QuantityValue"; break } - "double" { "QuantityValue"; break } - "decimal" { "QuantityValue"; break } - default { throw "Base type not supported: $baseType" } - } - - $obsoleteEqualityIfDouble = '' - if ($quantity.BaseType -eq "double") { - $obsoleteEqualityIfDouble = '[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]' + "`r`n " - } - @" //------------------------------------------------------------------------------ // diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index a1ae92fc08..75f3f21644 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -74,6 +74,12 @@ namespace UnitsNet.Tests "@; }@" // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new $quantityName(($baseType)0.0, $unitEnumName.Undefined)); + } + [Fact] public void $($baseUnit.SingularName)To$($quantityName)Units() { @@ -225,7 +231,6 @@ namespace UnitsNet.Tests { Assert.DoesNotContain($unitEnumName.Undefined, $quantityName.Units); } - } } "@;