Skip to content

Commit cece5fb

Browse files
tmilnthorpangularsen
authored andcommitted
Throw ArgumentException if constructed with Undefined value
1 parent e8644e0 commit cece5fb

File tree

182 files changed

+902
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+902
-261
lines changed

Common/GeneratedCode/Quantities/Acceleration.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static Acceleration()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static Acceleration()
9595
#endif
9696
Acceleration(double numericValue, AccelerationUnit unit)
9797
{
98+
if(unit == AccelerationUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static AmountOfSubstance()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static AmountOfSubstance()
9595
#endif
9696
AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit)
9797
{
98+
if(unit == AmountOfSubstanceUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static AmplitudeRatio()
8484
/// <summary>
8585
/// Creates the quantity with the given numeric value and unit.
8686
/// </summary>
87-
/// <param name="numericValue">Numeric value.</param>
87+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8888
/// <param name="unit">The unit representation to contruct this quantity with.</param>
8989
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9090
#if WINDOWS_UWP
@@ -94,6 +94,9 @@ static AmplitudeRatio()
9494
#endif
9595
AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit)
9696
{
97+
if(unit == AmplitudeRatioUnit.Undefined)
98+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
99+
97100
_value = numericValue;
98101
_unit = unit;
99102
}

Common/GeneratedCode/Quantities/Angle.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static Angle()
8484
/// <summary>
8585
/// Creates the quantity with the given numeric value and unit.
8686
/// </summary>
87-
/// <param name="numericValue">Numeric value.</param>
87+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8888
/// <param name="unit">The unit representation to contruct this quantity with.</param>
8989
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9090
#if WINDOWS_UWP
@@ -94,6 +94,9 @@ static Angle()
9494
#endif
9595
Angle(double numericValue, AngleUnit unit)
9696
{
97+
if(unit == AngleUnit.Undefined)
98+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
99+
97100
_value = numericValue;
98101
_unit = unit;
99102
}

Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ApparentEnergy()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ApparentEnergy()
9595
#endif
9696
ApparentEnergy(double numericValue, ApparentEnergyUnit unit)
9797
{
98+
if(unit == ApparentEnergyUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ApparentPower()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ApparentPower()
9595
#endif
9696
ApparentPower(double numericValue, ApparentPowerUnit unit)
9797
{
98+
if(unit == ApparentPowerUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/Area.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static Area()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static Area()
9595
#endif
9696
Area(double numericValue, AreaUnit unit)
9797
{
98+
if(unit == AreaUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static AreaDensity()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static AreaDensity()
9595
#endif
9696
AreaDensity(double numericValue, AreaDensityUnit unit)
9797
{
98+
if(unit == AreaDensityUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static AreaMomentOfInertia()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static AreaMomentOfInertia()
9595
#endif
9696
AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit)
9797
{
98+
if(unit == AreaMomentOfInertiaUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/BitRate.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static BitRate()
8484
/// <summary>
8585
/// Creates the quantity with the given numeric value and unit.
8686
/// </summary>
87-
/// <param name="numericValue">Numeric value.</param>
87+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8888
/// <param name="unit">The unit representation to contruct this quantity with.</param>
8989
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9090
#if WINDOWS_UWP
@@ -94,6 +94,9 @@ static BitRate()
9494
#endif
9595
BitRate(decimal numericValue, BitRateUnit unit)
9696
{
97+
if(unit == BitRateUnit.Undefined)
98+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
99+
97100
_value = numericValue;
98101
_unit = unit;
99102
}

Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static BrakeSpecificFuelConsumption()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static BrakeSpecificFuelConsumption()
9595
#endif
9696
BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsumptionUnit unit)
9797
{
98+
if(unit == BrakeSpecificFuelConsumptionUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/Capacitance.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static Capacitance()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static Capacitance()
9595
#endif
9696
Capacitance(double numericValue, CapacitanceUnit unit)
9797
{
98+
if(unit == CapacitanceUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/Density.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static Density()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static Density()
9595
#endif
9696
Density(double numericValue, DensityUnit unit)
9797
{
98+
if(unit == DensityUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/Duration.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static Duration()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static Duration()
9595
#endif
9696
Duration(double numericValue, DurationUnit unit)
9797
{
98+
if(unit == DurationUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static DynamicViscosity()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static DynamicViscosity()
9595
#endif
9696
DynamicViscosity(double numericValue, DynamicViscosityUnit unit)
9797
{
98+
if(unit == DynamicViscosityUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ElectricAdmittance()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ElectricAdmittance()
9595
#endif
9696
ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit)
9797
{
98+
if(unit == ElectricAdmittanceUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ElectricCharge()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ElectricCharge()
9595
#endif
9696
ElectricCharge(double numericValue, ElectricChargeUnit unit)
9797
{
98+
if(unit == ElectricChargeUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ElectricChargeDensity()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ElectricChargeDensity()
9595
#endif
9696
ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit unit)
9797
{
98+
if(unit == ElectricChargeDensityUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ElectricConductance()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ElectricConductance()
9595
#endif
9696
ElectricConductance(double numericValue, ElectricConductanceUnit unit)
9797
{
98+
if(unit == ElectricConductanceUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ElectricConductivity()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ElectricConductivity()
9595
#endif
9696
ElectricConductivity(double numericValue, ElectricConductivityUnit unit)
9797
{
98+
if(unit == ElectricConductivityUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static ElectricCurrent()
8585
/// <summary>
8686
/// Creates the quantity with the given numeric value and unit.
8787
/// </summary>
88-
/// <param name="numericValue">Numeric value.</param>
88+
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
8989
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
9191
#if WINDOWS_UWP
@@ -95,6 +95,9 @@ static ElectricCurrent()
9595
#endif
9696
ElectricCurrent(double numericValue, ElectricCurrentUnit unit)
9797
{
98+
if(unit == ElectricCurrentUnit.Undefined)
99+
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
100+
98101
_value = numericValue;
99102
_unit = unit;
100103
}

0 commit comments

Comments
 (0)