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
}

0 commit comments

Comments
 (0)