From 50994bb7a60adb4e8067891dd4eb83e86d1bc683 Mon Sep 17 00:00:00 2001 From: lipchev Date: Sat, 9 Aug 2025 22:51:44 +0300 Subject: [PATCH 1/5] - refeactored the As(UnitSystem) and ToUnit(UnitSystem) methods as extensions - removed the As(UnitSystem) method from the IQuantity interface --- .../UnitsNetGen/QuantityGenerator.cs | 21 +------ .../QuantityInfo/QuantityInfoExtensions.cs | 34 ++++++++++++ UnitsNet/Extensions/QuantityExtensions.cs | 55 +++++++++++++++++++ .../AbsorbedDoseOfIonizingRadiation.g.cs | 16 +----- .../Quantities/Acceleration.g.cs | 16 +----- .../Quantities/AmountOfSubstance.g.cs | 16 +----- .../Quantities/AmplitudeRatio.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 16 +----- .../GeneratedCode/Quantities/AreaDensity.g.cs | 16 +----- .../Quantities/AreaMomentOfInertia.g.cs | 16 +----- .../GeneratedCode/Quantities/BitRate.g.cs | 16 +----- .../BrakeSpecificFuelConsumption.g.cs | 16 +----- .../CoefficientOfThermalExpansion.g.cs | 16 +----- .../Quantities/Compressibility.g.cs | 16 +----- .../GeneratedCode/Quantities/Density.g.cs | 16 +----- .../Quantities/DoseAreaProduct.g.cs | 16 +----- .../GeneratedCode/Quantities/Duration.g.cs | 16 +----- .../Quantities/DynamicViscosity.g.cs | 16 +----- .../Quantities/ElectricAdmittance.g.cs | 16 +----- .../Quantities/ElectricApparentEnergy.g.cs | 16 +----- .../Quantities/ElectricApparentPower.g.cs | 16 +----- .../Quantities/ElectricCapacitance.g.cs | 16 +----- .../Quantities/ElectricCharge.g.cs | 16 +----- .../Quantities/ElectricChargeDensity.g.cs | 16 +----- .../Quantities/ElectricConductance.g.cs | 16 +----- .../Quantities/ElectricConductivity.g.cs | 16 +----- .../Quantities/ElectricCurrent.g.cs | 16 +----- .../Quantities/ElectricCurrentDensity.g.cs | 16 +----- .../Quantities/ElectricCurrentGradient.g.cs | 16 +----- .../Quantities/ElectricField.g.cs | 16 +----- .../Quantities/ElectricImpedance.g.cs | 16 +----- .../Quantities/ElectricInductance.g.cs | 16 +----- .../Quantities/ElectricPotential.g.cs | 16 +----- .../ElectricPotentialChangeRate.g.cs | 16 +----- .../Quantities/ElectricReactance.g.cs | 16 +----- .../Quantities/ElectricReactiveEnergy.g.cs | 16 +----- .../Quantities/ElectricReactivePower.g.cs | 16 +----- .../Quantities/ElectricResistance.g.cs | 16 +----- .../Quantities/ElectricResistivity.g.cs | 16 +----- .../ElectricSurfaceChargeDensity.g.cs | 16 +----- .../Quantities/ElectricSusceptance.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 16 +----- .../Quantities/EnergyDensity.g.cs | 16 +----- .../GeneratedCode/Quantities/Entropy.g.cs | 16 +----- .../Quantities/FluidResistance.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 16 +----- .../Quantities/ForceChangeRate.g.cs | 16 +----- .../Quantities/ForcePerLength.g.cs | 16 +----- .../GeneratedCode/Quantities/Frequency.g.cs | 16 +----- .../Quantities/FuelEfficiency.g.cs | 16 +----- .../GeneratedCode/Quantities/HeatFlux.g.cs | 16 +----- .../Quantities/HeatTransferCoefficient.g.cs | 16 +----- .../GeneratedCode/Quantities/Illuminance.g.cs | 16 +----- .../GeneratedCode/Quantities/Impulse.g.cs | 16 +----- .../GeneratedCode/Quantities/Information.g.cs | 16 +----- .../GeneratedCode/Quantities/Irradiance.g.cs | 16 +----- .../GeneratedCode/Quantities/Irradiation.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Jerk.g.cs | 16 +----- .../Quantities/KinematicViscosity.g.cs | 16 +----- .../GeneratedCode/Quantities/LeakRate.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 16 +----- .../Quantities/LinearDensity.g.cs | 16 +----- .../Quantities/LinearPowerDensity.g.cs | 16 +----- .../GeneratedCode/Quantities/Luminance.g.cs | 16 +----- .../GeneratedCode/Quantities/Luminosity.g.cs | 16 +----- .../Quantities/LuminousFlux.g.cs | 16 +----- .../Quantities/LuminousIntensity.g.cs | 16 +----- .../Quantities/MagneticField.g.cs | 16 +----- .../Quantities/MagneticFlux.g.cs | 16 +----- .../Quantities/Magnetization.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 16 +----- .../Quantities/MassConcentration.g.cs | 16 +----- .../GeneratedCode/Quantities/MassFlow.g.cs | 16 +----- .../GeneratedCode/Quantities/MassFlux.g.cs | 16 +----- .../Quantities/MassFraction.g.cs | 16 +----- .../Quantities/MassMomentOfInertia.g.cs | 16 +----- .../GeneratedCode/Quantities/Molality.g.cs | 16 +----- .../GeneratedCode/Quantities/MolarEnergy.g.cs | 16 +----- .../Quantities/MolarEntropy.g.cs | 16 +----- .../GeneratedCode/Quantities/MolarFlow.g.cs | 16 +----- .../GeneratedCode/Quantities/MolarMass.g.cs | 16 +----- .../GeneratedCode/Quantities/Molarity.g.cs | 16 +----- .../Quantities/Permeability.g.cs | 16 +----- .../Quantities/Permittivity.g.cs | 16 +----- .../Quantities/PorousMediumPermeability.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 16 +----- .../Quantities/PowerDensity.g.cs | 16 +----- .../GeneratedCode/Quantities/PowerRatio.g.cs | 16 +----- .../GeneratedCode/Quantities/Pressure.g.cs | 16 +----- .../Quantities/PressureChangeRate.g.cs | 16 +----- .../Quantities/RadiationEquivalentDose.g.cs | 16 +----- .../RadiationEquivalentDoseRate.g.cs | 16 +----- .../Quantities/RadiationExposure.g.cs | 16 +----- .../Quantities/Radioactivity.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 16 +----- .../Quantities/RatioChangeRate.g.cs | 16 +----- .../Quantities/ReciprocalArea.g.cs | 16 +----- .../Quantities/ReciprocalLength.g.cs | 16 +----- .../Quantities/RelativeHumidity.g.cs | 16 +----- .../Quantities/RotationalAcceleration.g.cs | 16 +----- .../Quantities/RotationalSpeed.g.cs | 16 +----- .../Quantities/RotationalStiffness.g.cs | 16 +----- .../RotationalStiffnessPerLength.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Scalar.g.cs | 16 +----- .../GeneratedCode/Quantities/SolidAngle.g.cs | 16 +----- .../Quantities/SpecificEnergy.g.cs | 16 +----- .../Quantities/SpecificEntropy.g.cs | 16 +----- .../Quantities/SpecificFuelConsumption.g.cs | 16 +----- .../Quantities/SpecificVolume.g.cs | 16 +----- .../Quantities/SpecificWeight.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 16 +----- .../Quantities/StandardVolumeFlow.g.cs | 16 +----- .../GeneratedCode/Quantities/Temperature.g.cs | 16 +----- .../Quantities/TemperatureChangeRate.g.cs | 16 +----- .../Quantities/TemperatureDelta.g.cs | 16 +----- .../Quantities/TemperatureGradient.g.cs | 16 +----- .../Quantities/ThermalConductivity.g.cs | 16 +----- .../Quantities/ThermalInsulance.g.cs | 16 +----- .../Quantities/ThermalResistance.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 16 +----- .../GeneratedCode/Quantities/Turbidity.g.cs | 16 +----- .../GeneratedCode/Quantities/VitaminA.g.cs | 16 +----- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 16 +----- .../Quantities/VolumeConcentration.g.cs | 16 +----- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 16 +----- .../Quantities/VolumeFlowPerArea.g.cs | 16 +----- .../Quantities/VolumePerLength.g.cs | 16 +----- .../Quantities/VolumetricHeatCapacity.g.cs | 16 +----- .../Quantities/WarpingMomentOfInertia.g.cs | 16 +----- UnitsNet/IQuantity.cs | 8 --- 132 files changed, 347 insertions(+), 1819 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 6c5cf268d0..6165f3f0ab 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -1034,15 +1034,6 @@ public double As(UnitKey unitKey) }} "); - Writer.WL( $@" - - /// - public double As(UnitSystem unitSystem) - {{ - return As(Info.GetDefaultUnit(unitSystem)); - }} -"); - Writer.WL($@" /// /// Converts this {_quantity.Name} to another {_quantity.Name} with the unit representation . @@ -1140,14 +1131,6 @@ private bool TryToUnit({_unitEnumName} unit, [NotNullWhen(true)] out {_quantity. return true; }} "); - Writer.WL($@" - /// - public {_quantity.Name} ToUnit(UnitSystem unitSystem) - {{ - return ToUnit(Info.GetDefaultUnit(unitSystem)); - }} -"); - Writer.WL($@" #region Explicit implementations @@ -1169,13 +1152,13 @@ IQuantity IQuantity.ToUnit(Enum unit) }} /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit({_unitEnumName} unit) => ToUnit(unit); /// - IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/CustomCode/QuantityInfo/QuantityInfoExtensions.cs b/UnitsNet/CustomCode/QuantityInfo/QuantityInfoExtensions.cs index e12ffc0226..19642cd76f 100644 --- a/UnitsNet/CustomCode/QuantityInfo/QuantityInfoExtensions.cs +++ b/UnitsNet/CustomCode/QuantityInfo/QuantityInfoExtensions.cs @@ -64,4 +64,38 @@ internal static TUnit GetDefaultUnit(this QuantityInfo quantityInf return firstUnitInfo.Value; } + + /// + /// Retrieves the default unit for a specified quantity and unit system. + /// + /// + /// The instance containing information about the + /// quantity. + /// + /// The for which the default unit is to be retrieved. + /// The default unit information for the specified quantity and unit system. + /// Thrown when is null. + /// Thrown when no units are found for the given . + internal static UnitInfo GetDefaultUnit(this QuantityInfo quantityInfo, UnitSystem unitSystem) + { + if (unitSystem is null) + { + throw new ArgumentNullException(nameof(unitSystem)); + } + + if (quantityInfo.BaseDimensions.IsDimensionless()) + { + return quantityInfo.BaseUnitInfo; + } + + IEnumerable unitInfos = quantityInfo.GetUnitInfosFor(unitSystem.BaseUnits); + + UnitInfo? firstUnitInfo = unitInfos.FirstOrDefault(); + if (firstUnitInfo == null) + { + throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); + } + + return firstUnitInfo; + } } diff --git a/UnitsNet/Extensions/QuantityExtensions.cs b/UnitsNet/Extensions/QuantityExtensions.cs index 41f2ace803..91872a5e23 100644 --- a/UnitsNet/Extensions/QuantityExtensions.cs +++ b/UnitsNet/Extensions/QuantityExtensions.cs @@ -17,6 +17,61 @@ internal static double GetValue(this TQuantity quantity, UnitKey toUn { return quantity.As(toUnit); } + + /// + /// Converts the quantity to a value in the unit determined by the specified . + /// If multiple units are found for the given , the first match will be used. + /// + /// The type of the quantity being converted. + /// The quantity to convert. + /// The to which the quantity value should be converted. + /// The value of the quantity in the specified unit system. + /// + /// Thrown if is null. + /// + /// + /// Thrown if no matching unit is found for the given . + /// + public static double As(this TQuantity quantity, UnitSystem unitSystem) + where TQuantity : IQuantity + { + return quantity.GetValue(quantity.QuantityInfo.GetDefaultUnit(unitSystem).UnitKey); + } + + /// + /// Converts the specified quantity to a new quantity with a unit determined by the given . + /// + /// + /// The type of the quantity to be converted. Must implement . + /// + /// The quantity to convert. + /// The used to determine the target unit. + /// + /// A new quantity of type with the unit determined by the specified + /// . + /// + /// + /// If multiple units are associated with the given , the first matching unit will be used. + /// + /// + /// Thrown if is null. + /// + /// + /// Thrown if no matching unit is found for the specified . + /// + public static TQuantity ToUnit(this TQuantity quantity, UnitSystem unitSystem) + where TQuantity : IQuantityOfType + { +#if NET + QuantityInfo quantityInfo = quantity.QuantityInfo; + UnitKey unitKey = quantityInfo.GetDefaultUnit(unitSystem).UnitKey; + return TQuantity.Create(quantity.As(unitKey), unitKey); +#else + QuantityInfo quantityInfo = ((IQuantity)quantity).QuantityInfo; + UnitKey unitKey = quantityInfo.GetDefaultUnit(unitSystem).UnitKey; + return quantity.QuantityInfo.Create(quantity.As(unitKey), unitKey); +#endif + } /// /// Returns the string representation of the specified quantity using the provided format provider. diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs index fbe9d3a4d5..b712c8ada7 100644 --- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs @@ -877,12 +877,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this AbsorbedDoseOfIonizingRadiation to another AbsorbedDoseOfIonizingRadiation with the unit representation . /// @@ -989,12 +983,6 @@ private bool TryToUnit(AbsorbedDoseOfIonizingRadiationUnit unit, [NotNullWhen(tr return true; } - /// - public AbsorbedDoseOfIonizingRadiation ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1015,13 +1003,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AbsorbedDoseOfIonizingRadiationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index f6a9d49a5c..7965f763e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -867,12 +867,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Acceleration to another Acceleration with the unit representation . /// @@ -973,12 +967,6 @@ private bool TryToUnit(AccelerationUnit unit, [NotNullWhen(true)] out Accelerati return true; } - /// - public Acceleration ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -999,13 +987,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AccelerationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 5fa15becd6..3beb62b9ee 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -922,12 +922,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this AmountOfSubstance to another AmountOfSubstance with the unit representation . /// @@ -1034,12 +1028,6 @@ private bool TryToUnit(AmountOfSubstanceUnit unit, [NotNullWhen(true)] out Amoun return true; } - /// - public AmountOfSubstance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1060,13 +1048,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 41bf9b836d..0f4f97d5ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -667,12 +667,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this AmplitudeRatio to another AmplitudeRatio with the unit representation . /// @@ -753,12 +747,6 @@ private bool TryToUnit(AmplitudeRatioUnit unit, [NotNullWhen(true)] out Amplitud return true; } - /// - public AmplitudeRatio ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -779,13 +767,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 846af3096f..6e7bd80cb6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -855,12 +855,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Angle to another Angle with the unit representation . /// @@ -963,12 +957,6 @@ private bool TryToUnit(AngleUnit unit, [NotNullWhen(true)] out Angle? converted) return true; } - /// - public Angle ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -989,13 +977,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AngleUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index c9bbcf6329..fafa3c9d99 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -951,12 +951,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Area to another Area with the unit representation . /// @@ -1057,12 +1051,6 @@ private bool TryToUnit(AreaUnit unit, [NotNullWhen(true)] out Area? converted) return true; } - /// - public Area ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1083,13 +1071,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AreaUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index b0e4e1bbf9..53288cf24e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -663,12 +663,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this AreaDensity to another AreaDensity with the unit representation . /// @@ -747,12 +741,6 @@ private bool TryToUnit(AreaDensityUnit unit, [NotNullWhen(true)] out AreaDensity return true; } - /// - public AreaDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -773,13 +761,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AreaDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 9d9f232be4..de0b3eed65 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -718,12 +718,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this AreaMomentOfInertia to another AreaMomentOfInertia with the unit representation . /// @@ -808,12 +802,6 @@ private bool TryToUnit(AreaMomentOfInertiaUnit unit, [NotNullWhen(true)] out Are return true; } - /// - public AreaMomentOfInertia ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -834,13 +822,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index fc62a899a3..91cf428cda 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -1229,12 +1229,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this BitRate to another BitRate with the unit representation . /// @@ -1385,12 +1379,6 @@ private bool TryToUnit(BitRateUnit unit, [NotNullWhen(true)] out BitRate? conver return true; } - /// - public BitRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1411,13 +1399,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(BitRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 6a44e29235..21310d33ec 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -676,12 +676,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this BrakeSpecificFuelConsumption to another BrakeSpecificFuelConsumption with the unit representation . /// @@ -760,12 +754,6 @@ private bool TryToUnit(BrakeSpecificFuelConsumptionUnit unit, [NotNullWhen(true) return true; } - /// - public BrakeSpecificFuelConsumption ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -786,13 +774,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 8f732c9f77..9a218fb580 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -711,12 +711,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this CoefficientOfThermalExpansion to another CoefficientOfThermalExpansion with the unit representation . /// @@ -801,12 +795,6 @@ private bool TryToUnit(CoefficientOfThermalExpansionUnit unit, [NotNullWhen(true return true; } - /// - public CoefficientOfThermalExpansion ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -827,13 +815,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs index 737627da9a..1c97e23ddb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs @@ -714,12 +714,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Compressibility to another Compressibility with the unit representation . /// @@ -806,12 +800,6 @@ private bool TryToUnit(CompressibilityUnit unit, [NotNullWhen(true)] out Compres return true; } - /// - public Compressibility ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -832,13 +820,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(CompressibilityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 69c65a4a4b..401f24bf0a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -1563,12 +1563,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Density to another Density with the unit representation . /// @@ -1753,12 +1747,6 @@ private bool TryToUnit(DensityUnit unit, [NotNullWhen(true)] out Density? conver return true; } - /// - public Density ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1779,13 +1767,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(DensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs index 0be48a838c..b2d46f8582 100644 --- a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs @@ -1005,12 +1005,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this DoseAreaProduct to another DoseAreaProduct with the unit representation . /// @@ -1133,12 +1127,6 @@ private bool TryToUnit(DoseAreaProductUnit unit, [NotNullWhen(true)] out DoseAre return true; } - /// - public DoseAreaProduct ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1159,13 +1147,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(DoseAreaProductUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 177523e824..042afd9ce1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -921,12 +921,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Duration to another Duration with the unit representation . /// @@ -1025,12 +1019,6 @@ private bool TryToUnit(DurationUnit unit, [NotNullWhen(true)] out Duration? conv return true; } - /// - public Duration ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1051,13 +1039,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(DurationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index e30c0a0a43..19a4186efa 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -785,12 +785,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this DynamicViscosity to another DynamicViscosity with the unit representation . /// @@ -883,12 +877,6 @@ private bool TryToUnit(DynamicViscosityUnit unit, [NotNullWhen(true)] out Dynami return true; } - /// - public DynamicViscosity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -909,13 +897,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 30e7fa91cc..3a67d84a95 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -862,12 +862,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricAdmittance to another ElectricAdmittance with the unit representation . /// @@ -972,12 +966,6 @@ private bool TryToUnit(ElectricAdmittanceUnit unit, [NotNullWhen(true)] out Elec return true; } - /// - public ElectricAdmittance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -998,13 +986,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs index 914f9d6380..e5fdb24d5f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs @@ -650,12 +650,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricApparentEnergy to another ElectricApparentEnergy with the unit representation . /// @@ -734,12 +728,6 @@ private bool TryToUnit(ElectricApparentEnergyUnit unit, [NotNullWhen(true)] out return true; } - /// - public ElectricApparentEnergy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -760,13 +748,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricApparentEnergyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs index 6a23a7aa8f..f0c9e1b655 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs @@ -701,12 +701,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricApparentPower to another ElectricApparentPower with the unit representation . /// @@ -791,12 +785,6 @@ private bool TryToUnit(ElectricApparentPowerUnit unit, [NotNullWhen(true)] out E return true; } - /// - public ElectricApparentPower ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -817,13 +805,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricApparentPowerUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs index d3b195abdd..cc3e8820a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs @@ -717,12 +717,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricCapacitance to another ElectricCapacitance with the unit representation . /// @@ -809,12 +803,6 @@ private bool TryToUnit(ElectricCapacitanceUnit unit, [NotNullWhen(true)] out Ele return true; } - /// - public ElectricCapacitance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -835,13 +823,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricCapacitanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 6334ba710e..d1ba3ffcbc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -808,12 +808,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricCharge to another ElectricCharge with the unit representation . /// @@ -908,12 +902,6 @@ private bool TryToUnit(ElectricChargeUnit unit, [NotNullWhen(true)] out Electric return true; } - /// - public ElectricCharge ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -934,13 +922,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricChargeUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index faa3420561..b2ef7ff9c8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -621,12 +621,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricChargeDensity to another ElectricChargeDensity with the unit representation . /// @@ -701,12 +695,6 @@ private bool TryToUnit(ElectricChargeDensityUnit unit, [NotNullWhen(true)] out E return true; } - /// - public ElectricChargeDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -727,13 +715,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricChargeDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 908ee65ca4..92c4b55e08 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -861,12 +861,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricConductance to another ElectricConductance with the unit representation . /// @@ -971,12 +965,6 @@ private bool TryToUnit(ElectricConductanceUnit unit, [NotNullWhen(true)] out Ele return true; } - /// - public ElectricConductance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -997,13 +985,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricConductanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index 92f96fd430..f5706c719e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -712,12 +712,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricConductivity to another ElectricConductivity with the unit representation . /// @@ -802,12 +796,6 @@ private bool TryToUnit(ElectricConductivityUnit unit, [NotNullWhen(true)] out El return true; } - /// - public ElectricConductivity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -828,13 +816,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricConductivityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 8c80e4fa27..ab6a6a8f94 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -790,12 +790,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricCurrent to another ElectricCurrent with the unit representation . /// @@ -886,12 +880,6 @@ private bool TryToUnit(ElectricCurrentUnit unit, [NotNullWhen(true)] out Electri return true; } - /// - public ElectricCurrent ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -912,13 +900,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricCurrentUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index ed55047ef8..efe5a4e818 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -653,12 +653,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricCurrentDensity to another ElectricCurrentDensity with the unit representation . /// @@ -737,12 +731,6 @@ private bool TryToUnit(ElectricCurrentDensityUnit unit, [NotNullWhen(true)] out return true; } - /// - public ElectricCurrentDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -763,13 +751,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricCurrentDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index fa857f5d19..a4d3a1fe68 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -727,12 +727,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricCurrentGradient to another ElectricCurrentGradient with the unit representation . /// @@ -819,12 +813,6 @@ private bool TryToUnit(ElectricCurrentGradientUnit unit, [NotNullWhen(true)] out return true; } - /// - public ElectricCurrentGradient ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -845,13 +833,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricCurrentGradientUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 2eeb140dad..4db2d64bc4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -621,12 +621,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricField to another ElectricField with the unit representation . /// @@ -701,12 +695,6 @@ private bool TryToUnit(ElectricFieldUnit unit, [NotNullWhen(true)] out ElectricF return true; } - /// - public ElectricField ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -727,13 +715,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricFieldUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs index ea8007ea55..638bd6ce12 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs @@ -734,12 +734,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricImpedance to another ElectricImpedance with the unit representation . /// @@ -828,12 +822,6 @@ private bool TryToUnit(ElectricImpedanceUnit unit, [NotNullWhen(true)] out Elect return true; } - /// - public ElectricImpedance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -854,13 +842,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricImpedanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 23b73bf158..207b48c188 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -685,12 +685,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricInductance to another ElectricInductance with the unit representation . /// @@ -773,12 +767,6 @@ private bool TryToUnit(ElectricInductanceUnit unit, [NotNullWhen(true)] out Elec return true; } - /// - public ElectricInductance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -799,13 +787,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricInductanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 5b34019916..266b412e47 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -735,12 +735,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricPotential to another ElectricPotential with the unit representation . /// @@ -825,12 +819,6 @@ private bool TryToUnit(ElectricPotentialUnit unit, [NotNullWhen(true)] out Elect return true; } - /// - public ElectricPotential ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -851,13 +839,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricPotentialUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 981f293340..a43cced24d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -922,12 +922,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricPotentialChangeRate to another ElectricPotentialChangeRate with the unit representation . /// @@ -1040,12 +1034,6 @@ private bool TryToUnit(ElectricPotentialChangeRateUnit unit, [NotNullWhen(true)] return true; } - /// - public ElectricPotentialChangeRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1066,13 +1054,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricPotentialChangeRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs index a51174dc90..0b0bb9e3e1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs @@ -733,12 +733,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricReactance to another ElectricReactance with the unit representation . /// @@ -827,12 +821,6 @@ private bool TryToUnit(ElectricReactanceUnit unit, [NotNullWhen(true)] out Elect return true; } - /// - public ElectricReactance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -853,13 +841,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricReactanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs index 0cd9922292..cee033f740 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs @@ -650,12 +650,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricReactiveEnergy to another ElectricReactiveEnergy with the unit representation . /// @@ -734,12 +728,6 @@ private bool TryToUnit(ElectricReactiveEnergyUnit unit, [NotNullWhen(true)] out return true; } - /// - public ElectricReactiveEnergy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -760,13 +748,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricReactiveEnergyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs index 79a161038a..fe43e07bf9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs @@ -669,12 +669,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricReactivePower to another ElectricReactivePower with the unit representation . /// @@ -755,12 +749,6 @@ private bool TryToUnit(ElectricReactivePowerUnit unit, [NotNullWhen(true)] out E return true; } - /// - public ElectricReactivePower ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -781,13 +769,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricReactivePowerUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 63394c6b68..85b851ca94 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -746,12 +746,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricResistance to another ElectricResistance with the unit representation . /// @@ -840,12 +834,6 @@ private bool TryToUnit(ElectricResistanceUnit unit, [NotNullWhen(true)] out Elec return true; } - /// - public ElectricResistance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -866,13 +854,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricResistanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index e36ec8fe98..2e1e39643a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -840,12 +840,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricResistivity to another ElectricResistivity with the unit representation . /// @@ -946,12 +940,6 @@ private bool TryToUnit(ElectricResistivityUnit unit, [NotNullWhen(true)] out Ele return true; } - /// - public ElectricResistivity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -972,13 +960,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricResistivityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index ad8aedf6ff..92b129208f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -653,12 +653,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricSurfaceChargeDensity to another ElectricSurfaceChargeDensity with the unit representation . /// @@ -737,12 +731,6 @@ private bool TryToUnit(ElectricSurfaceChargeDensityUnit unit, [NotNullWhen(true) return true; } - /// - public ElectricSurfaceChargeDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -763,13 +751,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricSurfaceChargeDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs index 28a289d017..fadf7f4003 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs @@ -861,12 +861,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ElectricSusceptance to another ElectricSusceptance with the unit representation . /// @@ -971,12 +965,6 @@ private bool TryToUnit(ElectricSusceptanceUnit unit, [NotNullWhen(true)] out Ele return true; } - /// - public ElectricSusceptance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -997,13 +985,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ElectricSusceptanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 461c050225..4b3ef44b37 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -1339,12 +1339,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Energy to another Energy with the unit representation . /// @@ -1497,12 +1491,6 @@ private bool TryToUnit(EnergyUnit unit, [NotNullWhen(true)] out Energy? converte return true; } - /// - public Energy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1523,13 +1511,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(EnergyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs index fa89880d5e..3f404ec65c 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -807,12 +807,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this EnergyDensity to another EnergyDensity with the unit representation . /// @@ -909,12 +903,6 @@ private bool TryToUnit(EnergyDensityUnit unit, [NotNullWhen(true)] out EnergyDen return true; } - /// - public EnergyDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -935,13 +923,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(EnergyDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 9d856cac66..fe5bc11a37 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -741,12 +741,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Entropy to another Entropy with the unit representation . /// @@ -833,12 +827,6 @@ private bool TryToUnit(EntropyUnit unit, [NotNullWhen(true)] out Entropy? conver return true; } - /// - public Entropy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -859,13 +847,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(EntropyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs index 636f440c35..816023176d 100644 --- a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs @@ -909,12 +909,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this FluidResistance to another FluidResistance with the unit representation . /// @@ -1025,12 +1019,6 @@ private bool TryToUnit(FluidResistanceUnit unit, [NotNullWhen(true)] out FluidRe return true; } - /// - public FluidResistance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1051,13 +1039,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(FluidResistanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index c599c8b026..6e071d196e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -932,12 +932,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Force to another Force with the unit representation . /// @@ -1040,12 +1034,6 @@ private bool TryToUnit(ForceUnit unit, [NotNullWhen(true)] out Force? converted) return true; } - /// - public Force ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1066,13 +1054,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ForceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index badcaca9b7..64691a569d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -855,12 +855,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ForceChangeRate to another ForceChangeRate with the unit representation . /// @@ -963,12 +957,6 @@ private bool TryToUnit(ForceChangeRateUnit unit, [NotNullWhen(true)] out ForceCh return true; } - /// - public ForceChangeRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -989,13 +977,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ForceChangeRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 18e744827b..639e98e336 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -1279,12 +1279,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ForcePerLength to another ForcePerLength with the unit representation . /// @@ -1433,12 +1427,6 @@ private bool TryToUnit(ForcePerLengthUnit unit, [NotNullWhen(true)] out ForcePer return true; } - /// - public ForcePerLength ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1459,13 +1447,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ForcePerLengthUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 0fafe817fc..199e45e86b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -807,12 +807,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Frequency to another Frequency with the unit representation . /// @@ -909,12 +903,6 @@ private bool TryToUnit(FrequencyUnit unit, [NotNullWhen(true)] out Frequency? co return true; } - /// - public Frequency ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -935,13 +923,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(FrequencyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 7c334103a9..b2e0366a47 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -669,12 +669,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this FuelEfficiency to another FuelEfficiency with the unit representation . /// @@ -755,12 +749,6 @@ private bool TryToUnit(FuelEfficiencyUnit unit, [NotNullWhen(true)] out FuelEffi return true; } - /// - public FuelEfficiency ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -781,13 +769,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(FuelEfficiencyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 8631b86a9b..41cf48f93b 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -903,12 +903,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this HeatFlux to another HeatFlux with the unit representation . /// @@ -1017,12 +1011,6 @@ private bool TryToUnit(HeatFluxUnit unit, [NotNullWhen(true)] out HeatFlux? conv return true; } - /// - public HeatFlux ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1043,13 +1031,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(HeatFluxUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index d12fe17f67..1df8202816 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -682,12 +682,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this HeatTransferCoefficient to another HeatTransferCoefficient with the unit representation . /// @@ -770,12 +764,6 @@ private bool TryToUnit(HeatTransferCoefficientUnit unit, [NotNullWhen(true)] out return true; } - /// - public HeatTransferCoefficient ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -796,13 +784,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(HeatTransferCoefficientUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index 9ee5838445..4b878a9e2b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -682,12 +682,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Illuminance to another Illuminance with the unit representation . /// @@ -768,12 +762,6 @@ private bool TryToUnit(IlluminanceUnit unit, [NotNullWhen(true)] out Illuminance return true; } - /// - public Illuminance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -794,13 +782,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(IlluminanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs index 5af1def28a..957904e291 100644 --- a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs @@ -810,12 +810,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Impulse to another Impulse with the unit representation . /// @@ -914,12 +908,6 @@ private bool TryToUnit(ImpulseUnit unit, [NotNullWhen(true)] out Impulse? conver return true; } - /// - public Impulse ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -940,13 +928,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ImpulseUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index dfc2c6d0b0..2ab77b20c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -1212,12 +1212,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Information to another Information with the unit representation . /// @@ -1368,12 +1362,6 @@ private bool TryToUnit(InformationUnit unit, [NotNullWhen(true)] out Information return true; } - /// - public Information ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1394,13 +1382,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(InformationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index f34428a664..466c4f55dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -826,12 +826,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Irradiance to another Irradiance with the unit representation . /// @@ -932,12 +926,6 @@ private bool TryToUnit(IrradianceUnit unit, [NotNullWhen(true)] out Irradiance? return true; } - /// - public Irradiance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -958,13 +946,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(IrradianceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index c541e7e6f2..c9c2c5cf57 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -749,12 +749,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Irradiation to another Irradiation with the unit representation . /// @@ -845,12 +839,6 @@ private bool TryToUnit(IrradiationUnit unit, [NotNullWhen(true)] out Irradiation return true; } - /// - public Irradiation ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -871,13 +859,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(IrradiationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs index 27aad7836e..98b423769e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs @@ -791,12 +791,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Jerk to another Jerk with the unit representation . /// @@ -891,12 +885,6 @@ private bool TryToUnit(JerkUnit unit, [NotNullWhen(true)] out Jerk? converted) return true; } - /// - public Jerk ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -917,13 +905,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(JerkUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index dfd1dc8da2..67f9e41e9b 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -783,12 +783,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this KinematicViscosity to another KinematicViscosity with the unit representation . /// @@ -879,12 +873,6 @@ private bool TryToUnit(KinematicViscosityUnit unit, [NotNullWhen(true)] out Kine return true; } - /// - public KinematicViscosity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -905,13 +893,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(KinematicViscosityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs index 31aedbb04b..36c273e90a 100644 --- a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs @@ -669,12 +669,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this LeakRate to another LeakRate with the unit representation . /// @@ -755,12 +749,6 @@ private bool TryToUnit(LeakRateUnit unit, [NotNullWhen(true)] out LeakRate? conv return true; } - /// - public LeakRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -781,13 +769,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LeakRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 114aa9369d..21c8da9f85 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -1413,12 +1413,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Length to another Length with the unit representation . /// @@ -1575,12 +1569,6 @@ private bool TryToUnit(LengthUnit unit, [NotNullWhen(true)] out Length? converte return true; } - /// - public Length ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1601,13 +1589,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LengthUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index a3756f2b3e..ceb603c61f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -635,12 +635,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Level to another Level with the unit representation . /// @@ -717,12 +711,6 @@ private bool TryToUnit(LevelUnit unit, [NotNullWhen(true)] out Level? converted) return true; } - /// - public Level ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -743,13 +731,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LevelUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 772d18adc0..03d971d64b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -920,12 +920,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this LinearDensity to another LinearDensity with the unit representation . /// @@ -1034,12 +1028,6 @@ private bool TryToUnit(LinearDensityUnit unit, [NotNullWhen(true)] out LinearDen return true; } - /// - public LinearDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1060,13 +1048,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LinearDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index 49c885310f..baf4c64fe5 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -1005,12 +1005,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this LinearPowerDensity to another LinearPowerDensity with the unit representation . /// @@ -1133,12 +1127,6 @@ private bool TryToUnit(LinearPowerDensityUnit unit, [NotNullWhen(true)] out Line return true; } - /// - public LinearPowerDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1159,13 +1147,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LinearPowerDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs index d7abbb4fa8..46f241165c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -778,12 +778,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Luminance to another Luminance with the unit representation . /// @@ -876,12 +870,6 @@ private bool TryToUnit(LuminanceUnit unit, [NotNullWhen(true)] out Luminance? co return true; } - /// - public Luminance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -902,13 +890,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LuminanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index fc52c77bf5..ab73293e45 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -829,12 +829,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Luminosity to another Luminosity with the unit representation . /// @@ -935,12 +929,6 @@ private bool TryToUnit(LuminosityUnit unit, [NotNullWhen(true)] out Luminosity? return true; } - /// - public Luminosity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -961,13 +949,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LuminosityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 397551e87c..391a68d63f 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -641,12 +641,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this LuminousFlux to another LuminousFlux with the unit representation . /// @@ -721,12 +715,6 @@ private bool TryToUnit(LuminousFluxUnit unit, [NotNullWhen(true)] out LuminousFl return true; } - /// - public LuminousFlux ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -747,13 +735,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LuminousFluxUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index e6115ea875..520ad55749 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -641,12 +641,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this LuminousIntensity to another LuminousIntensity with the unit representation . /// @@ -721,12 +715,6 @@ private bool TryToUnit(LuminousIntensityUnit unit, [NotNullWhen(true)] out Lumin return true; } - /// - public LuminousIntensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -747,13 +735,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(LuminousIntensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 1d96df089a..a1b7473925 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -701,12 +701,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MagneticField to another MagneticField with the unit representation . /// @@ -791,12 +785,6 @@ private bool TryToUnit(MagneticFieldUnit unit, [NotNullWhen(true)] out MagneticF return true; } - /// - public MagneticField ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -817,13 +805,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MagneticFieldUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 3d38034988..acb78ba2fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -621,12 +621,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MagneticFlux to another MagneticFlux with the unit representation . /// @@ -701,12 +695,6 @@ private bool TryToUnit(MagneticFluxUnit unit, [NotNullWhen(true)] out MagneticFl return true; } - /// - public MagneticFlux ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -727,13 +715,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MagneticFluxUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 9e0db4c8ee..ca32f4ef92 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -621,12 +621,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Magnetization to another Magnetization with the unit representation . /// @@ -701,12 +695,6 @@ private bool TryToUnit(MagnetizationUnit unit, [NotNullWhen(true)] out Magnetiza return true; } - /// - public Magnetization ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -727,13 +715,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MagnetizationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index b334caf182..f85aefe247 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -1152,12 +1152,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Mass to another Mass with the unit representation . /// @@ -1284,12 +1278,6 @@ private bool TryToUnit(MassUnit unit, [NotNullWhen(true)] out Mass? converted) return true; } - /// - public Mass ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1310,13 +1298,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MassUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index fd87c94d15..81ad3dd5be 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -1430,12 +1430,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MassConcentration to another MassConcentration with the unit representation . /// @@ -1606,12 +1600,6 @@ private bool TryToUnit(MassConcentrationUnit unit, [NotNullWhen(true)] out MassC return true; } - /// - public MassConcentration ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1632,13 +1620,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MassConcentrationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 6bee66571e..8e7335cd12 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -1206,12 +1206,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MassFlow to another MassFlow with the unit representation . /// @@ -1350,12 +1344,6 @@ private bool TryToUnit(MassFlowUnit unit, [NotNullWhen(true)] out MassFlow? conv return true; } - /// - public MassFlow ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1376,13 +1364,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MassFlowUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 2c5916a9ec..9c62b72570 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -821,12 +821,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MassFlux to another MassFlux with the unit representation . /// @@ -923,12 +917,6 @@ private bool TryToUnit(MassFluxUnit unit, [NotNullWhen(true)] out MassFlux? conv return true; } - /// - public MassFlux ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -949,13 +937,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MassFluxUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 29f4fecb97..05a1c1890a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -988,12 +988,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MassFraction to another MassFraction with the unit representation . /// @@ -1114,12 +1108,6 @@ private bool TryToUnit(MassFractionUnit unit, [NotNullWhen(true)] out MassFracti return true; } - /// - public MassFraction ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1140,13 +1128,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MassFractionUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index dc91d1b23b..1393508f7a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -1050,12 +1050,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MassMomentOfInertia to another MassMomentOfInertia with the unit representation . /// @@ -1184,12 +1178,6 @@ private bool TryToUnit(MassMomentOfInertiaUnit unit, [NotNullWhen(true)] out Mas return true; } - /// - public MassMomentOfInertia ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1210,13 +1198,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MassMomentOfInertiaUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs index 332dcbb159..db72ffc221 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs @@ -653,12 +653,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Molality to another Molality with the unit representation . /// @@ -737,12 +731,6 @@ private bool TryToUnit(MolalityUnit unit, [NotNullWhen(true)] out Molality? conv return true; } - /// - public Molality ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -763,13 +751,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MolalityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index 441c570f1d..e393cf24b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -663,12 +663,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MolarEnergy to another MolarEnergy with the unit representation . /// @@ -747,12 +741,6 @@ private bool TryToUnit(MolarEnergyUnit unit, [NotNullWhen(true)] out MolarEnergy return true; } - /// - public MolarEnergy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -773,13 +761,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MolarEnergyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index c25e244cc8..f1e2aa4747 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -650,12 +650,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MolarEntropy to another MolarEntropy with the unit representation . /// @@ -734,12 +728,6 @@ private bool TryToUnit(MolarEntropyUnit unit, [NotNullWhen(true)] out MolarEntro return true; } - /// - public MolarEntropy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -760,13 +748,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MolarEntropyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs index ebd3e62887..e0337f83bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs @@ -780,12 +780,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MolarFlow to another MolarFlow with the unit representation . /// @@ -876,12 +870,6 @@ private bool TryToUnit(MolarFlowUnit unit, [NotNullWhen(true)] out MolarFlow? co return true; } - /// - public MolarFlow ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -902,13 +890,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MolarFlowUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 010b9d74f9..4f898c3d82 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -837,12 +837,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this MolarMass to another MolarMass with the unit representation . /// @@ -941,12 +935,6 @@ private bool TryToUnit(MolarMassUnit unit, [NotNullWhen(true)] out MolarMass? co return true; } - /// - public MolarMass ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -967,13 +955,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MolarMassUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 1782635893..708f043419 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -822,12 +822,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Molarity to another Molarity with the unit representation . /// @@ -922,12 +916,6 @@ private bool TryToUnit(MolarityUnit unit, [NotNullWhen(true)] out Molarity? conv return true; } - /// - public Molarity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -948,13 +936,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(MolarityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index dc5f8837d6..a40e0c868e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -621,12 +621,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Permeability to another Permeability with the unit representation . /// @@ -701,12 +695,6 @@ private bool TryToUnit(PermeabilityUnit unit, [NotNullWhen(true)] out Permeabili return true; } - /// - public Permeability ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -727,13 +715,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PermeabilityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index a28939c50e..6e9a53e3c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -621,12 +621,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Permittivity to another Permittivity with the unit representation . /// @@ -701,12 +695,6 @@ private bool TryToUnit(PermittivityUnit unit, [NotNullWhen(true)] out Permittivi return true; } - /// - public Permittivity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -727,13 +715,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PermittivityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs index 87a5c54c1b..00abacfe34 100644 --- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs @@ -685,12 +685,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this PorousMediumPermeability to another PorousMediumPermeability with the unit representation . /// @@ -773,12 +767,6 @@ private bool TryToUnit(PorousMediumPermeabilityUnit unit, [NotNullWhen(true)] ou return true; } - /// - public PorousMediumPermeability ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -799,13 +787,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PorousMediumPermeabilityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 43145c28ef..8f97c1b35f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -1138,12 +1138,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Power to another Power with the unit representation . /// @@ -1270,12 +1264,6 @@ private bool TryToUnit(PowerUnit unit, [NotNullWhen(true)] out Power? converted) return true; } - /// - public Power ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1296,13 +1284,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PowerUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index 69c0b71d3b..c667d07b0a 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -1306,12 +1306,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this PowerDensity to another PowerDensity with the unit representation . /// @@ -1472,12 +1466,6 @@ private bool TryToUnit(PowerDensityUnit unit, [NotNullWhen(true)] out PowerDensi return true; } - /// - public PowerDensity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1498,13 +1486,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PowerDensityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 8d1093e2d5..bde87cce91 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -635,12 +635,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this PowerRatio to another PowerRatio with the unit representation . /// @@ -717,12 +711,6 @@ private bool TryToUnit(PowerRatioUnit unit, [NotNullWhen(true)] out PowerRatio? return true; } - /// - public PowerRatio ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -743,13 +731,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PowerRatioUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 9f10ec036f..16206266b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -1446,12 +1446,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Pressure to another Pressure with the unit representation . /// @@ -1620,12 +1614,6 @@ private bool TryToUnit(PressureUnit unit, [NotNullWhen(true)] out Pressure? conv return true; } - /// - public Pressure ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1646,13 +1634,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PressureUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 3a92170c4d..59988bd740 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -903,12 +903,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this PressureChangeRate to another PressureChangeRate with the unit representation . /// @@ -1017,12 +1011,6 @@ private bool TryToUnit(PressureChangeRateUnit unit, [NotNullWhen(true)] out Pres return true; } - /// - public PressureChangeRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1043,13 +1031,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(PressureChangeRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs index deffb18848..c0ca3e5122 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs @@ -718,12 +718,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RadiationEquivalentDose to another RadiationEquivalentDose with the unit representation . /// @@ -808,12 +802,6 @@ private bool TryToUnit(RadiationEquivalentDoseUnit unit, [NotNullWhen(true)] out return true; } - /// - public RadiationEquivalentDose ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -834,13 +822,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RadiationEquivalentDoseUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs index a87acf0ce1..c3a0186948 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs @@ -775,12 +775,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RadiationEquivalentDoseRate to another RadiationEquivalentDoseRate with the unit representation . /// @@ -873,12 +867,6 @@ private bool TryToUnit(RadiationEquivalentDoseRateUnit unit, [NotNullWhen(true)] return true; } - /// - public RadiationEquivalentDoseRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -899,13 +887,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RadiationEquivalentDoseRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs index 5b847e40a9..8cf898cb09 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs @@ -730,12 +730,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RadiationExposure to another RadiationExposure with the unit representation . /// @@ -824,12 +818,6 @@ private bool TryToUnit(RadiationExposureUnit unit, [NotNullWhen(true)] out Radia return true; } - /// - public RadiationExposure ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -850,13 +838,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RadiationExposureUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs index 751d486e5f..01ccc4b17a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs @@ -1066,12 +1066,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Radioactivity to another Radioactivity with the unit representation . /// @@ -1202,12 +1196,6 @@ private bool TryToUnit(RadioactivityUnit unit, [NotNullWhen(true)] out Radioacti return true; } - /// - public Radioactivity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1228,13 +1216,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RadioactivityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index de18d006b5..e2e9646406 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -684,12 +684,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Ratio to another Ratio with the unit representation . /// @@ -774,12 +768,6 @@ private bool TryToUnit(RatioUnit unit, [NotNullWhen(true)] out Ratio? converted) return true; } - /// - public Ratio ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -800,13 +788,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RatioUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index a8c1f5e4ce..a86b75e217 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -634,12 +634,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RatioChangeRate to another RatioChangeRate with the unit representation . /// @@ -716,12 +710,6 @@ private bool TryToUnit(RatioChangeRateUnit unit, [NotNullWhen(true)] out RatioCh return true; } - /// - public RatioChangeRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -742,13 +730,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RatioChangeRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index 8141b31adf..5fb29f1328 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -829,12 +829,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ReciprocalArea to another ReciprocalArea with the unit representation . /// @@ -929,12 +923,6 @@ private bool TryToUnit(ReciprocalAreaUnit unit, [NotNullWhen(true)] out Reciproc return true; } - /// - public ReciprocalArea ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -955,13 +943,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ReciprocalAreaUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index 9dae1bcbe1..6106d7e055 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -827,12 +827,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ReciprocalLength to another ReciprocalLength with the unit representation . /// @@ -925,12 +919,6 @@ private bool TryToUnit(ReciprocalLengthUnit unit, [NotNullWhen(true)] out Recipr return true; } - /// - public ReciprocalLength ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -951,13 +939,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ReciprocalLengthUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index 48f4a44b03..e4d5e8c7b0 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -604,12 +604,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RelativeHumidity to another RelativeHumidity with the unit representation . /// @@ -684,12 +678,6 @@ private bool TryToUnit(RelativeHumidityUnit unit, [NotNullWhen(true)] out Relati return true; } - /// - public RelativeHumidity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -710,13 +698,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RelativeHumidityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 766ccebbf7..97b3cf4e44 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -666,12 +666,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RotationalAcceleration to another RotationalAcceleration with the unit representation . /// @@ -752,12 +746,6 @@ private bool TryToUnit(RotationalAccelerationUnit unit, [NotNullWhen(true)] out return true; } - /// - public RotationalAcceleration ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -778,13 +766,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RotationalAccelerationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index e236d4a261..829d724ae1 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -830,12 +830,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RotationalSpeed to another RotationalSpeed with the unit representation . /// @@ -934,12 +928,6 @@ private bool TryToUnit(RotationalSpeedUnit unit, [NotNullWhen(true)] out Rotatio return true; } - /// - public RotationalSpeed ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -960,13 +948,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RotationalSpeedUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index c6d1e7d459..8d1186c308 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -1157,12 +1157,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RotationalStiffness to another RotationalStiffness with the unit representation . /// @@ -1301,12 +1295,6 @@ private bool TryToUnit(RotationalStiffnessUnit unit, [NotNullWhen(true)] out Rot return true; } - /// - public RotationalStiffness ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1327,13 +1315,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RotationalStiffnessUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 36615225ff..ef1fd45ae3 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -695,12 +695,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this RotationalStiffnessPerLength to another RotationalStiffnessPerLength with the unit representation . /// @@ -783,12 +777,6 @@ private bool TryToUnit(RotationalStiffnessPerLengthUnit unit, [NotNullWhen(true) return true; } - /// - public RotationalStiffnessPerLength ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -809,13 +797,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(RotationalStiffnessPerLengthUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs index d6eb7d764c..454527f24d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -604,12 +604,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Scalar to another Scalar with the unit representation . /// @@ -684,12 +678,6 @@ private bool TryToUnit(ScalarUnit unit, [NotNullWhen(true)] out Scalar? converte return true; } - /// - public Scalar ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -710,13 +698,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ScalarUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 64edbe9778..9245441bd3 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -607,12 +607,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this SolidAngle to another SolidAngle with the unit representation . /// @@ -687,12 +681,6 @@ private bool TryToUnit(SolidAngleUnit unit, [NotNullWhen(true)] out SolidAngle? return true; } - /// - public SolidAngle ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -713,13 +701,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(SolidAngleUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 92f2fea62f..5f4c783645 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -1139,12 +1139,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this SpecificEnergy to another SpecificEnergy with the unit representation . /// @@ -1277,12 +1271,6 @@ private bool TryToUnit(SpecificEnergyUnit unit, [NotNullWhen(true)] out Specific return true; } - /// - public SpecificEnergy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1303,13 +1291,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(SpecificEnergyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 254787637e..e439541640 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -766,12 +766,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this SpecificEntropy to another SpecificEntropy with the unit representation . /// @@ -862,12 +856,6 @@ private bool TryToUnit(SpecificEntropyUnit unit, [NotNullWhen(true)] out Specifi return true; } - /// - public SpecificEntropy ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -888,13 +876,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(SpecificEntropyUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index 3deb82ea42..2390a017d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -669,12 +669,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this SpecificFuelConsumption to another SpecificFuelConsumption with the unit representation . /// @@ -755,12 +749,6 @@ private bool TryToUnit(SpecificFuelConsumptionUnit unit, [NotNullWhen(true)] out return true; } - /// - public SpecificFuelConsumption ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -781,13 +769,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(SpecificFuelConsumptionUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 3b3fbf3487..ad710eb0ed 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -670,12 +670,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this SpecificVolume to another SpecificVolume with the unit representation . /// @@ -754,12 +748,6 @@ private bool TryToUnit(SpecificVolumeUnit unit, [NotNullWhen(true)] out Specific return true; } - /// - public SpecificVolume ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -780,13 +768,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(SpecificVolumeUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index 612dbcfcb3..f0c46af28d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -911,12 +911,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this SpecificWeight to another SpecificWeight with the unit representation . /// @@ -1023,12 +1017,6 @@ private bool TryToUnit(SpecificWeightUnit unit, [NotNullWhen(true)] out Specific return true; } - /// - public SpecificWeight ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1049,13 +1037,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(SpecificWeightUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 6e46faf02b..d2a7d38924 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -1192,12 +1192,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Speed to another Speed with the unit representation . /// @@ -1336,12 +1330,6 @@ private bool TryToUnit(SpeedUnit unit, [NotNullWhen(true)] out Speed? converted) return true; } - /// - public Speed ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1362,13 +1350,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(SpeedUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index 0269d9f0a6..e9cb098424 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -746,12 +746,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this StandardVolumeFlow to another StandardVolumeFlow with the unit representation . /// @@ -842,12 +836,6 @@ private bool TryToUnit(StandardVolumeFlowUnit unit, [NotNullWhen(true)] out Stan return true; } - /// - public StandardVolumeFlow ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -868,13 +856,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(StandardVolumeFlowUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index f33a79d09a..4fc91e9397 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -716,12 +716,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Temperature to another Temperature with the unit representation . /// @@ -814,12 +808,6 @@ private bool TryToUnit(TemperatureUnit unit, [NotNullWhen(true)] out Temperature return true; } - /// - public Temperature ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -840,13 +828,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(TemperatureUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index 899b060c28..c608e1f953 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -887,12 +887,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this TemperatureChangeRate to another TemperatureChangeRate with the unit representation . /// @@ -999,12 +993,6 @@ private bool TryToUnit(TemperatureChangeRateUnit unit, [NotNullWhen(true)] out T return true; } - /// - public TemperatureChangeRate ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1025,13 +1013,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(TemperatureChangeRateUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index 203b2b2e4c..554010025f 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -801,12 +801,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this TemperatureDelta to another TemperatureDelta with the unit representation . /// @@ -897,12 +891,6 @@ private bool TryToUnit(TemperatureDeltaUnit unit, [NotNullWhen(true)] out Temper return true; } - /// - public TemperatureDelta ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -923,13 +911,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(TemperatureDeltaUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index 1379e6b593..ae292ff5cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -679,12 +679,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this TemperatureGradient to another TemperatureGradient with the unit representation . /// @@ -765,12 +759,6 @@ private bool TryToUnit(TemperatureGradientUnit unit, [NotNullWhen(true)] out Tem return true; } - /// - public TemperatureGradient ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -791,13 +779,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(TemperatureGradientUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index b584b84bcd..179bbff5ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -637,12 +637,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ThermalConductivity to another ThermalConductivity with the unit representation . /// @@ -719,12 +713,6 @@ private bool TryToUnit(ThermalConductivityUnit unit, [NotNullWhen(true)] out The return true; } - /// - public ThermalConductivity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -745,13 +733,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ThermalConductivityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs index 7932ae77a2..e3241b6e7a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs @@ -714,12 +714,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ThermalInsulance to another ThermalInsulance with the unit representation . /// @@ -806,12 +800,6 @@ private bool TryToUnit(ThermalInsulanceUnit unit, [NotNullWhen(true)] out Therma return true; } - /// - public ThermalInsulance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -832,13 +820,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ThermalInsulanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index a3964742d8..a7734dfa5f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -634,12 +634,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this ThermalResistance to another ThermalResistance with the unit representation . /// @@ -716,12 +710,6 @@ private bool TryToUnit(ThermalResistanceUnit unit, [NotNullWhen(true)] out Therm return true; } - /// - public ThermalResistance ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -742,13 +730,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(ThermalResistanceUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index e0b2e3a3ac..abf4410a03 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -1057,12 +1057,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Torque to another Torque with the unit representation . /// @@ -1185,12 +1179,6 @@ private bool TryToUnit(TorqueUnit unit, [NotNullWhen(true)] out Torque? converte return true; } - /// - public Torque ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1211,13 +1199,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(TorqueUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index b200c36028..f5d5cd8810 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -607,12 +607,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Turbidity to another Turbidity with the unit representation . /// @@ -687,12 +681,6 @@ private bool TryToUnit(TurbidityUnit unit, [NotNullWhen(true)] out Turbidity? co return true; } - /// - public Turbidity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -713,13 +701,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(TurbidityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index fdb0ba3fa4..875c2944b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -604,12 +604,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this VitaminA to another VitaminA with the unit representation . /// @@ -684,12 +678,6 @@ private bool TryToUnit(VitaminAUnit unit, [NotNullWhen(true)] out VitaminA? conv return true; } - /// - public VitaminA ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -710,13 +698,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(VitaminAUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index 5d02cc4e84..9750ddb487 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -1563,12 +1563,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this Volume to another Volume with the unit representation . /// @@ -1749,12 +1743,6 @@ private bool TryToUnit(VolumeUnit unit, [NotNullWhen(true)] out Volume? converte return true; } - /// - public Volume ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1775,13 +1763,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(VolumeUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index a59b8f8639..46446fe16f 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -931,12 +931,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this VolumeConcentration to another VolumeConcentration with the unit representation . /// @@ -1049,12 +1043,6 @@ private bool TryToUnit(VolumeConcentrationUnit unit, [NotNullWhen(true)] out Vol return true; } - /// - public VolumeConcentration ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -1075,13 +1063,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(VolumeConcentrationUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 97bdfe23d4..797b55c7a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -1843,12 +1843,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this VolumeFlow to another VolumeFlow with the unit representation . /// @@ -2071,12 +2065,6 @@ private bool TryToUnit(VolumeFlowUnit unit, [NotNullWhen(true)] out VolumeFlow? return true; } - /// - public VolumeFlow ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -2097,13 +2085,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(VolumeFlowUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index 3631b331ce..7556c245b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -634,12 +634,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this VolumeFlowPerArea to another VolumeFlowPerArea with the unit representation . /// @@ -716,12 +710,6 @@ private bool TryToUnit(VolumeFlowPerAreaUnit unit, [NotNullWhen(true)] out Volum return true; } - /// - public VolumeFlowPerArea ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -742,13 +730,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(VolumeFlowPerAreaUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index f167382e54..ebd0d78d4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -746,12 +746,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this VolumePerLength to another VolumePerLength with the unit representation . /// @@ -842,12 +836,6 @@ private bool TryToUnit(VolumePerLengthUnit unit, [NotNullWhen(true)] out VolumeP return true; } - /// - public VolumePerLength ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -868,13 +856,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(VolumePerLengthUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index 56184e2c08..6d5dffb109 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -749,12 +749,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this VolumetricHeatCapacity to another VolumetricHeatCapacity with the unit representation . /// @@ -845,12 +839,6 @@ private bool TryToUnit(VolumetricHeatCapacityUnit unit, [NotNullWhen(true)] out return true; } - /// - public VolumetricHeatCapacity ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -871,13 +859,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(VolumetricHeatCapacityUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 50c81deecf..75c9508a4e 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -698,12 +698,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - /// - public double As(UnitSystem unitSystem) - { - return As(Info.GetDefaultUnit(unitSystem)); - } - /// /// Converts this WarpingMomentOfInertia to another WarpingMomentOfInertia with the unit representation . /// @@ -788,12 +782,6 @@ private bool TryToUnit(WarpingMomentOfInertiaUnit unit, [NotNullWhen(true)] out return true; } - /// - public WarpingMomentOfInertia ToUnit(UnitSystem unitSystem) - { - return ToUnit(Info.GetDefaultUnit(unitSystem)); - } - #region Explicit implementations double IQuantity.As(Enum unit) @@ -814,13 +802,13 @@ IQuantity IQuantity.ToUnit(Enum unit) } /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); /// IQuantity IQuantity.ToUnit(WarpingMomentOfInertiaUnit unit) => ToUnit(unit); /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); #endregion diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 42debad321..44d071067e 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -34,14 +34,6 @@ public interface IQuantity : IFormattable /// Wrong unit enum type was given. double As(UnitKey unitKey); - /// - /// Gets the value in the unit determined by the given . If multiple units were found for the given , - /// the first match will be used. - /// - /// The to convert the quantity value to. - /// The converted value. - double As(UnitSystem unitSystem); - /// /// The unit this quantity was constructed with -or- BaseUnit if default ctor was used. /// From 79570f5eb2e569e2d4bf3d99fb551f544fd5ae26 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 10 Aug 2025 00:31:05 +0200 Subject: [PATCH 2/5] Refactor untyped IQuantity.ToUnit(UnitSystem) to extension method --- .../UnitsNetGen/QuantityGenerator.cs | 3 -- UnitsNet/Extensions/QuantityExtensions.cs | 31 +++++++++++++++++-- .../AbsorbedDoseOfIonizingRadiation.g.cs | 3 -- .../Quantities/Acceleration.g.cs | 3 -- .../Quantities/AmountOfSubstance.g.cs | 3 -- .../Quantities/AmplitudeRatio.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 3 -- .../GeneratedCode/Quantities/AreaDensity.g.cs | 3 -- .../Quantities/AreaMomentOfInertia.g.cs | 3 -- .../GeneratedCode/Quantities/BitRate.g.cs | 3 -- .../BrakeSpecificFuelConsumption.g.cs | 3 -- .../CoefficientOfThermalExpansion.g.cs | 3 -- .../Quantities/Compressibility.g.cs | 3 -- .../GeneratedCode/Quantities/Density.g.cs | 3 -- .../Quantities/DoseAreaProduct.g.cs | 3 -- .../GeneratedCode/Quantities/Duration.g.cs | 3 -- .../Quantities/DynamicViscosity.g.cs | 3 -- .../Quantities/ElectricAdmittance.g.cs | 3 -- .../Quantities/ElectricApparentEnergy.g.cs | 3 -- .../Quantities/ElectricApparentPower.g.cs | 3 -- .../Quantities/ElectricCapacitance.g.cs | 3 -- .../Quantities/ElectricCharge.g.cs | 3 -- .../Quantities/ElectricChargeDensity.g.cs | 3 -- .../Quantities/ElectricConductance.g.cs | 3 -- .../Quantities/ElectricConductivity.g.cs | 3 -- .../Quantities/ElectricCurrent.g.cs | 3 -- .../Quantities/ElectricCurrentDensity.g.cs | 3 -- .../Quantities/ElectricCurrentGradient.g.cs | 3 -- .../Quantities/ElectricField.g.cs | 3 -- .../Quantities/ElectricImpedance.g.cs | 3 -- .../Quantities/ElectricInductance.g.cs | 3 -- .../Quantities/ElectricPotential.g.cs | 3 -- .../ElectricPotentialChangeRate.g.cs | 3 -- .../Quantities/ElectricReactance.g.cs | 3 -- .../Quantities/ElectricReactiveEnergy.g.cs | 3 -- .../Quantities/ElectricReactivePower.g.cs | 3 -- .../Quantities/ElectricResistance.g.cs | 3 -- .../Quantities/ElectricResistivity.g.cs | 3 -- .../ElectricSurfaceChargeDensity.g.cs | 3 -- .../Quantities/ElectricSusceptance.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 3 -- .../Quantities/EnergyDensity.g.cs | 3 -- .../GeneratedCode/Quantities/Entropy.g.cs | 3 -- .../Quantities/FluidResistance.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 3 -- .../Quantities/ForceChangeRate.g.cs | 3 -- .../Quantities/ForcePerLength.g.cs | 3 -- .../GeneratedCode/Quantities/Frequency.g.cs | 3 -- .../Quantities/FuelEfficiency.g.cs | 3 -- .../GeneratedCode/Quantities/HeatFlux.g.cs | 3 -- .../Quantities/HeatTransferCoefficient.g.cs | 3 -- .../GeneratedCode/Quantities/Illuminance.g.cs | 3 -- .../GeneratedCode/Quantities/Impulse.g.cs | 3 -- .../GeneratedCode/Quantities/Information.g.cs | 3 -- .../GeneratedCode/Quantities/Irradiance.g.cs | 3 -- .../GeneratedCode/Quantities/Irradiation.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Jerk.g.cs | 3 -- .../Quantities/KinematicViscosity.g.cs | 3 -- .../GeneratedCode/Quantities/LeakRate.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 3 -- .../Quantities/LinearDensity.g.cs | 3 -- .../Quantities/LinearPowerDensity.g.cs | 3 -- .../GeneratedCode/Quantities/Luminance.g.cs | 3 -- .../GeneratedCode/Quantities/Luminosity.g.cs | 3 -- .../Quantities/LuminousFlux.g.cs | 3 -- .../Quantities/LuminousIntensity.g.cs | 3 -- .../Quantities/MagneticField.g.cs | 3 -- .../Quantities/MagneticFlux.g.cs | 3 -- .../Quantities/Magnetization.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 3 -- .../Quantities/MassConcentration.g.cs | 3 -- .../GeneratedCode/Quantities/MassFlow.g.cs | 3 -- .../GeneratedCode/Quantities/MassFlux.g.cs | 3 -- .../Quantities/MassFraction.g.cs | 3 -- .../Quantities/MassMomentOfInertia.g.cs | 3 -- .../GeneratedCode/Quantities/Molality.g.cs | 3 -- .../GeneratedCode/Quantities/MolarEnergy.g.cs | 3 -- .../Quantities/MolarEntropy.g.cs | 3 -- .../GeneratedCode/Quantities/MolarFlow.g.cs | 3 -- .../GeneratedCode/Quantities/MolarMass.g.cs | 3 -- .../GeneratedCode/Quantities/Molarity.g.cs | 3 -- .../Quantities/Permeability.g.cs | 3 -- .../Quantities/Permittivity.g.cs | 3 -- .../Quantities/PorousMediumPermeability.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 3 -- .../Quantities/PowerDensity.g.cs | 3 -- .../GeneratedCode/Quantities/PowerRatio.g.cs | 3 -- .../GeneratedCode/Quantities/Pressure.g.cs | 3 -- .../Quantities/PressureChangeRate.g.cs | 3 -- .../Quantities/RadiationEquivalentDose.g.cs | 3 -- .../RadiationEquivalentDoseRate.g.cs | 3 -- .../Quantities/RadiationExposure.g.cs | 3 -- .../Quantities/Radioactivity.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 3 -- .../Quantities/RatioChangeRate.g.cs | 3 -- .../Quantities/ReciprocalArea.g.cs | 3 -- .../Quantities/ReciprocalLength.g.cs | 3 -- .../Quantities/RelativeHumidity.g.cs | 3 -- .../Quantities/RotationalAcceleration.g.cs | 3 -- .../Quantities/RotationalSpeed.g.cs | 3 -- .../Quantities/RotationalStiffness.g.cs | 3 -- .../RotationalStiffnessPerLength.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Scalar.g.cs | 3 -- .../GeneratedCode/Quantities/SolidAngle.g.cs | 3 -- .../Quantities/SpecificEnergy.g.cs | 3 -- .../Quantities/SpecificEntropy.g.cs | 3 -- .../Quantities/SpecificFuelConsumption.g.cs | 3 -- .../Quantities/SpecificVolume.g.cs | 3 -- .../Quantities/SpecificWeight.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 3 -- .../Quantities/StandardVolumeFlow.g.cs | 3 -- .../GeneratedCode/Quantities/Temperature.g.cs | 3 -- .../Quantities/TemperatureChangeRate.g.cs | 3 -- .../Quantities/TemperatureDelta.g.cs | 3 -- .../Quantities/TemperatureGradient.g.cs | 3 -- .../Quantities/ThermalConductivity.g.cs | 3 -- .../Quantities/ThermalInsulance.g.cs | 3 -- .../Quantities/ThermalResistance.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 3 -- .../GeneratedCode/Quantities/Turbidity.g.cs | 3 -- .../GeneratedCode/Quantities/VitaminA.g.cs | 3 -- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 3 -- .../Quantities/VolumeConcentration.g.cs | 3 -- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 3 -- .../Quantities/VolumeFlowPerArea.g.cs | 3 -- .../Quantities/VolumePerLength.g.cs | 3 -- .../Quantities/VolumetricHeatCapacity.g.cs | 3 -- .../Quantities/WarpingMomentOfInertia.g.cs | 3 -- UnitsNet/IQuantity.cs | 19 +++++------- 131 files changed, 36 insertions(+), 401 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 6165f3f0ab..c91c2f7244 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -1151,9 +1151,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); }} - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit({_unitEnumName} unit) => ToUnit(unit); diff --git a/UnitsNet/Extensions/QuantityExtensions.cs b/UnitsNet/Extensions/QuantityExtensions.cs index 91872a5e23..53bab8db21 100644 --- a/UnitsNet/Extensions/QuantityExtensions.cs +++ b/UnitsNet/Extensions/QuantityExtensions.cs @@ -3,6 +3,7 @@ using System.Globalization; +// ReSharper disable once CheckNamespace namespace UnitsNet; /// @@ -72,7 +73,31 @@ public static TQuantity ToUnit(this TQuantity quantity, UnitSystem un return quantity.QuantityInfo.Create(quantity.As(unitKey), unitKey); #endif } - + + /// + /// Converts the specified quantity to a new quantity with a unit determined by the given . + /// + /// The quantity to convert. + /// The used to determine the target unit. + /// + /// A new quantity of the same type with the unit determined by the specified . + /// + /// + /// If multiple units are associated with the given , the first matching unit will be used. + /// + /// + /// Thrown if is null. + /// + /// + /// Thrown if no matching unit is found for the specified . + /// + public static IQuantity ToUnit(this IQuantity quantity, UnitSystem unitSystem) + { + QuantityInfo quantityInfo = quantity.QuantityInfo; + UnitKey unitKey = quantityInfo.GetDefaultUnit(unitSystem).UnitKey; + return quantityInfo.From(quantity.As(unitKey), unitKey); + } + /// /// Returns the string representation of the specified quantity using the provided format provider. /// @@ -126,7 +151,7 @@ internal static TQuantity ArithmeticMean(this IEnumerable { throw new ArgumentNullException(nameof(quantities)); } - + using IEnumerator enumerator = quantities.GetEnumerator(); if (!enumerator.MoveNext()) { @@ -172,7 +197,7 @@ internal static TQuantity ArithmeticMean(this IEnumerable enumerator = quantities.GetEnumerator(); if (!enumerator.MoveNext()) { diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs index b712c8ada7..001be237b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs @@ -1002,9 +1002,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AbsorbedDoseOfIonizingRadiationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index 7965f763e5..ba539ba7ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -986,9 +986,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AccelerationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 3beb62b9ee..cc1e09c9e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -1047,9 +1047,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 0f4f97d5ab..d10321d1ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -766,9 +766,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 6e7bd80cb6..ba36f7726d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -976,9 +976,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AngleUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index fafa3c9d99..38be3f47cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -1070,9 +1070,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AreaUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 53288cf24e..c3d63ffdfe 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -760,9 +760,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AreaDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index de0b3eed65..86f0a2a5f8 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -821,9 +821,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index 91cf428cda..795dfc5db0 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -1398,9 +1398,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(BitRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 21310d33ec..a290e0bbdc 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -773,9 +773,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 9a218fb580..3be0e767c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -814,9 +814,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs index 1c97e23ddb..f55993a95b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs @@ -819,9 +819,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(CompressibilityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 401f24bf0a..92032a6b04 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -1766,9 +1766,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(DensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs index b2d46f8582..b3818d1786 100644 --- a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs @@ -1146,9 +1146,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(DoseAreaProductUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 042afd9ce1..3a06fd2756 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -1038,9 +1038,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(DurationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 19a4186efa..449dd43c7a 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -896,9 +896,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 3a67d84a95..1da7b7e4b5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -985,9 +985,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs index e5fdb24d5f..05afc2e869 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs @@ -747,9 +747,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricApparentEnergyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs index f0c9e1b655..52bfed06d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs @@ -804,9 +804,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricApparentPowerUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs index cc3e8820a7..93cb706165 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs @@ -822,9 +822,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricCapacitanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index d1ba3ffcbc..e49f08f671 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -921,9 +921,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricChargeUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index b2ef7ff9c8..a32ba0df62 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -714,9 +714,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricChargeDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 92c4b55e08..9741bc4ace 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -984,9 +984,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricConductanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index f5706c719e..f585cdff22 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -815,9 +815,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricConductivityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index ab6a6a8f94..6773f97ffc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -899,9 +899,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricCurrentUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index efe5a4e818..617f60cfb0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -750,9 +750,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricCurrentDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index a4d3a1fe68..c191919dc9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -832,9 +832,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricCurrentGradientUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 4db2d64bc4..07001c7f41 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -714,9 +714,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricFieldUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs index 638bd6ce12..4ab1778c5d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs @@ -841,9 +841,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricImpedanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 207b48c188..90401e091a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -786,9 +786,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricInductanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 266b412e47..414a7dea5b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -838,9 +838,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricPotentialUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index a43cced24d..3a6eb7c47c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -1053,9 +1053,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricPotentialChangeRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs index 0b0bb9e3e1..1227e7683a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs @@ -840,9 +840,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricReactanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs index cee033f740..f8bf99c1e2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs @@ -747,9 +747,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricReactiveEnergyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs index fe43e07bf9..f3dc6e12bc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs @@ -768,9 +768,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricReactivePowerUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 85b851ca94..df61ed438c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -853,9 +853,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricResistanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 2e1e39643a..f9b39ce80c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -959,9 +959,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricResistivityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 92b129208f..67e721b3ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -750,9 +750,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricSurfaceChargeDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs index fadf7f4003..89d8a47c92 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs @@ -984,9 +984,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ElectricSusceptanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 4b3ef44b37..0d4cc2c05d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -1510,9 +1510,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(EnergyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs index 3f404ec65c..ef1da91623 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -922,9 +922,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(EnergyDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index fe5bc11a37..886b33b959 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -846,9 +846,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(EntropyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs index 816023176d..1f78c35804 100644 --- a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs @@ -1038,9 +1038,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(FluidResistanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 6e071d196e..254fac7488 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -1053,9 +1053,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ForceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 64691a569d..6881c7e022 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -976,9 +976,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ForceChangeRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 639e98e336..bb7d3f0173 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -1446,9 +1446,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ForcePerLengthUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 199e45e86b..39c84b07d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -922,9 +922,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(FrequencyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index b2e0366a47..91a8398037 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -768,9 +768,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(FuelEfficiencyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 41cf48f93b..9db4261a4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -1030,9 +1030,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(HeatFluxUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 1df8202816..403e1341c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -783,9 +783,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(HeatTransferCoefficientUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index 4b878a9e2b..e77177bbda 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -781,9 +781,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(IlluminanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs index 957904e291..9b65b90484 100644 --- a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs @@ -927,9 +927,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ImpulseUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 2ab77b20c3..f47576504e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -1381,9 +1381,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(InformationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 466c4f55dd..bf99979ee6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -945,9 +945,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(IrradianceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index c9c2c5cf57..f175b32ed2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -858,9 +858,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(IrradiationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs index 98b423769e..8393dc142b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs @@ -904,9 +904,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(JerkUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index 67f9e41e9b..e5e220d1e4 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -892,9 +892,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(KinematicViscosityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs index 36c273e90a..87992b7d3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs @@ -768,9 +768,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LeakRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 21c8da9f85..7adab6f10a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -1588,9 +1588,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LengthUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index ceb603c61f..c586867d22 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -730,9 +730,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LevelUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 03d971d64b..29c791fd2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -1047,9 +1047,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LinearDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index baf4c64fe5..e2cca5d859 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -1146,9 +1146,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LinearPowerDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs index 46f241165c..794ed1c79a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -889,9 +889,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LuminanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index ab73293e45..dc75f0bffb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -948,9 +948,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LuminosityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 391a68d63f..52ce518c02 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -734,9 +734,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LuminousFluxUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index 520ad55749..2050f82496 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -734,9 +734,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(LuminousIntensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index a1b7473925..631f7c005f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -804,9 +804,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MagneticFieldUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index acb78ba2fc..2170ca4925 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -714,9 +714,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MagneticFluxUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index ca32f4ef92..79e53b7363 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -714,9 +714,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MagnetizationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index f85aefe247..190d8de426 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -1297,9 +1297,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MassUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 81ad3dd5be..2622e9bf12 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -1619,9 +1619,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MassConcentrationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 8e7335cd12..f65a0dd0fa 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -1363,9 +1363,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MassFlowUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 9c62b72570..0343804338 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -936,9 +936,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MassFluxUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 05a1c1890a..e72b83638e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -1127,9 +1127,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MassFractionUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 1393508f7a..ba7ddc4e24 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -1197,9 +1197,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MassMomentOfInertiaUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs index db72ffc221..0399c8a662 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs @@ -750,9 +750,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MolalityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index e393cf24b6..e1f0831ca7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -760,9 +760,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MolarEnergyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index f1e2aa4747..a02fd67c37 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -747,9 +747,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MolarEntropyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs index e0337f83bf..fa0a5c176c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs @@ -889,9 +889,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MolarFlowUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 4f898c3d82..1f48fd423c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -954,9 +954,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MolarMassUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 708f043419..ad05e52da6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -935,9 +935,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(MolarityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index a40e0c868e..096a5f2191 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -714,9 +714,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PermeabilityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 6e9a53e3c4..184c14ca91 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -714,9 +714,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PermittivityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs index 00abacfe34..87b128ffc3 100644 --- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs @@ -786,9 +786,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PorousMediumPermeabilityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 8f97c1b35f..196db5eb4e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -1283,9 +1283,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PowerUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index c667d07b0a..bf180fb682 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -1485,9 +1485,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PowerDensityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index bde87cce91..96a8e8921b 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -730,9 +730,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PowerRatioUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 16206266b4..33c3f7ab44 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -1633,9 +1633,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PressureUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 59988bd740..2b16d091c7 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -1030,9 +1030,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(PressureChangeRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs index c0ca3e5122..338276b611 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs @@ -821,9 +821,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RadiationEquivalentDoseUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs index c3a0186948..6dd8144f3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs @@ -886,9 +886,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RadiationEquivalentDoseRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs index 8cf898cb09..cce72958a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs @@ -837,9 +837,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RadiationExposureUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs index 01ccc4b17a..4bd2a51ff2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs @@ -1215,9 +1215,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RadioactivityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index e2e9646406..a3e9b4e4cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -787,9 +787,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RatioUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index a86b75e217..d16395509a 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -729,9 +729,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RatioChangeRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index 5fb29f1328..4fef663397 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -942,9 +942,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ReciprocalAreaUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index 6106d7e055..161b87a7ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -938,9 +938,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ReciprocalLengthUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index e4d5e8c7b0..55cdaaee00 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -697,9 +697,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RelativeHumidityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 97b3cf4e44..5ba067111b 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -765,9 +765,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RotationalAccelerationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index 829d724ae1..a04323c8aa 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -947,9 +947,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RotationalSpeedUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 8d1186c308..47779ade24 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -1314,9 +1314,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RotationalStiffnessUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index ef1fd45ae3..861a13dead 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -796,9 +796,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(RotationalStiffnessPerLengthUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs index 454527f24d..e309f8400f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -697,9 +697,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ScalarUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 9245441bd3..426c2a52e9 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -700,9 +700,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(SolidAngleUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 5f4c783645..6720cdc4b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -1290,9 +1290,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(SpecificEnergyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index e439541640..71a59b0be8 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -875,9 +875,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(SpecificEntropyUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index 2390a017d3..61f36c7143 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -768,9 +768,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(SpecificFuelConsumptionUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index ad710eb0ed..24bbd73d60 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -767,9 +767,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(SpecificVolumeUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index f0c46af28d..3ecb62d133 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -1036,9 +1036,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(SpecificWeightUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index d2a7d38924..f719b9eed4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -1349,9 +1349,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(SpeedUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index e9cb098424..f582fed9d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -855,9 +855,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(StandardVolumeFlowUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 4fc91e9397..c281eba1da 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -827,9 +827,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(TemperatureUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index c608e1f953..c1d2090eec 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -1012,9 +1012,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(TemperatureChangeRateUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index 554010025f..dce0b0bad3 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -910,9 +910,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(TemperatureDeltaUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index ae292ff5cb..c1dd1c4e56 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -778,9 +778,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(TemperatureGradientUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 179bbff5ab..35fe6bea6e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -732,9 +732,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ThermalConductivityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs index e3241b6e7a..b972f8f404 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs @@ -819,9 +819,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ThermalInsulanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index a7734dfa5f..8bb30547b5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -729,9 +729,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(ThermalResistanceUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index abf4410a03..74f003fc0b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -1198,9 +1198,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(TorqueUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index f5d5cd8810..4a490bf27e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -700,9 +700,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(TurbidityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 875c2944b8..d2f6ae907d 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -697,9 +697,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(VitaminAUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index 9750ddb487..a0ad2c8736 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -1762,9 +1762,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(VolumeUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index 46446fe16f..ab94ebcd43 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -1062,9 +1062,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(VolumeConcentrationUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 797b55c7a5..91f4b2eb17 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -2084,9 +2084,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(VolumeFlowUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index 7556c245b7..0bbcbc9baf 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -729,9 +729,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(VolumeFlowPerAreaUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index ebd0d78d4b..60efd67bec 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -855,9 +855,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(VolumePerLengthUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index 6d5dffb109..9f628eed18 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -858,9 +858,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(VolumetricHeatCapacityUnit unit) => ToUnit(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 75c9508a4e..3f89bfa93f 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -801,9 +801,6 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(typedUnit, DefaultConversionFunctions); } - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - /// IQuantity IQuantity.ToUnit(WarpingMomentOfInertiaUnit unit) => ToUnit(unit); diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 44d071067e..7dd7e7b232 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -55,14 +55,6 @@ public interface IQuantity : IFormattable /// A new in the given . IQuantity ToUnit(Enum unit); - /// - /// Converts to a quantity with a unit determined by the given . - /// If multiple units were found for the given , the first match will be used. - /// - /// The to convert the quantity to. - /// A new quantity with the determined unit. - IQuantity ToUnit(UnitSystem unitSystem); - /// /// Gets the unique key for the unit type and its corresponding value. /// @@ -104,9 +96,14 @@ public interface IQuantity : IQuantity /// Conversion was not possible from this to . /// A new in the given . IQuantity ToUnit(TUnitType unit); - - /// - new IQuantity ToUnit(UnitSystem unitSystem); + + /// + /// Converts to a quantity with a unit determined by the given . + /// If multiple units were found for the given , the first match will be used. + /// + /// The to convert the quantity to. + /// A new quantity with the determined unit. + IQuantity ToUnit(UnitSystem unitSystem); #if NET From 1bbaafcc74d4829831315cc829e803dc48d3734f Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 10 Aug 2025 17:07:40 +0200 Subject: [PATCH 3/5] Rename to ToUnitUntyped() --- UnitsNet/Extensions/QuantityExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet/Extensions/QuantityExtensions.cs b/UnitsNet/Extensions/QuantityExtensions.cs index 53bab8db21..f17e8ef477 100644 --- a/UnitsNet/Extensions/QuantityExtensions.cs +++ b/UnitsNet/Extensions/QuantityExtensions.cs @@ -91,7 +91,7 @@ public static TQuantity ToUnit(this TQuantity quantity, UnitSystem un /// /// Thrown if no matching unit is found for the specified . /// - public static IQuantity ToUnit(this IQuantity quantity, UnitSystem unitSystem) + public static IQuantity ToUnitUntyped(this IQuantity quantity, UnitSystem unitSystem) { QuantityInfo quantityInfo = quantity.QuantityInfo; UnitKey unitKey = quantityInfo.GetDefaultUnit(unitSystem).UnitKey; From 8ab6e686927ffd0ee5774eace0c952bff2ff1316 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 10 Aug 2025 17:23:58 +0200 Subject: [PATCH 4/5] Update tests after rename to ToUnitUntyped Split tests into ToUnit vs ToUnitTyped Update calls to ToUnitTyped where output is IQuantity. --- .../UnitsNetGen/UnitTestBaseClassGenerator.cs | 81 ++++++++++++------- .../CustomCode/ElectricApparentEnergyTests.cs | 12 ++- .../CustomCode/ElectricReactiveEnergyTests.cs | 12 ++- .../CustomCode/FuelEfficiencyTests.cs | 12 ++- ...orbedDoseOfIonizingRadiationTestsBase.g.cs | 49 +++++++---- .../TestsBase/AccelerationTestsBase.g.cs | 49 +++++++---- .../TestsBase/AmountOfSubstanceTestsBase.g.cs | 49 +++++++---- .../TestsBase/AmplitudeRatioTestsBase.g.cs | 32 ++++---- .../TestsBase/AngleTestsBase.g.cs | 30 ++++--- .../TestsBase/AreaDensityTestsBase.g.cs | 49 +++++++---- .../AreaMomentOfInertiaTestsBase.g.cs | 49 +++++++---- .../TestsBase/AreaTestsBase.g.cs | 49 +++++++---- .../TestsBase/BitRateTestsBase.g.cs | 49 +++++++---- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 49 +++++++---- ...oefficientOfThermalExpansionTestsBase.g.cs | 49 +++++++---- .../TestsBase/CompressibilityTestsBase.g.cs | 49 +++++++---- .../TestsBase/DensityTestsBase.g.cs | 49 +++++++---- .../TestsBase/DoseAreaProductTestsBase.g.cs | 49 +++++++---- .../TestsBase/DurationTestsBase.g.cs | 49 +++++++---- .../TestsBase/DynamicViscosityTestsBase.g.cs | 49 +++++++---- .../ElectricAdmittanceTestsBase.g.cs | 49 +++++++---- .../ElectricApparentEnergyTestsBase.g.cs | 49 +++++++---- .../ElectricApparentPowerTestsBase.g.cs | 49 +++++++---- .../ElectricCapacitanceTestsBase.g.cs | 49 +++++++---- .../ElectricChargeDensityTestsBase.g.cs | 49 +++++++---- .../TestsBase/ElectricChargeTestsBase.g.cs | 49 +++++++---- .../ElectricConductanceTestsBase.g.cs | 49 +++++++---- .../ElectricConductivityTestsBase.g.cs | 49 +++++++---- .../ElectricCurrentDensityTestsBase.g.cs | 49 +++++++---- .../ElectricCurrentGradientTestsBase.g.cs | 49 +++++++---- .../TestsBase/ElectricCurrentTestsBase.g.cs | 49 +++++++---- .../TestsBase/ElectricFieldTestsBase.g.cs | 49 +++++++---- .../TestsBase/ElectricImpedanceTestsBase.g.cs | 49 +++++++---- .../ElectricInductanceTestsBase.g.cs | 49 +++++++---- .../ElectricPotentialChangeRateTestsBase.g.cs | 49 +++++++---- .../TestsBase/ElectricPotentialTestsBase.g.cs | 49 +++++++---- .../TestsBase/ElectricReactanceTestsBase.g.cs | 49 +++++++---- .../ElectricReactiveEnergyTestsBase.g.cs | 49 +++++++---- .../ElectricReactivePowerTestsBase.g.cs | 49 +++++++---- .../ElectricResistanceTestsBase.g.cs | 49 +++++++---- .../ElectricResistivityTestsBase.g.cs | 49 +++++++---- ...ElectricSurfaceChargeDensityTestsBase.g.cs | 49 +++++++---- .../ElectricSusceptanceTestsBase.g.cs | 49 +++++++---- .../TestsBase/EnergyDensityTestsBase.g.cs | 49 +++++++---- .../TestsBase/EnergyTestsBase.g.cs | 49 +++++++---- .../TestsBase/EntropyTestsBase.g.cs | 49 +++++++---- .../TestsBase/FluidResistanceTestsBase.g.cs | 49 +++++++---- .../TestsBase/ForceChangeRateTestsBase.g.cs | 49 +++++++---- .../TestsBase/ForcePerLengthTestsBase.g.cs | 49 +++++++---- .../TestsBase/ForceTestsBase.g.cs | 49 +++++++---- .../TestsBase/FrequencyTestsBase.g.cs | 49 +++++++---- .../TestsBase/FuelEfficiencyTestsBase.g.cs | 49 +++++++---- .../TestsBase/HeatFluxTestsBase.g.cs | 49 +++++++---- .../HeatTransferCoefficientTestsBase.g.cs | 49 +++++++---- .../TestsBase/IlluminanceTestsBase.g.cs | 49 +++++++---- .../TestsBase/ImpulseTestsBase.g.cs | 49 +++++++---- .../TestsBase/InformationTestsBase.g.cs | 30 ++++--- .../TestsBase/IrradianceTestsBase.g.cs | 49 +++++++---- .../TestsBase/IrradiationTestsBase.g.cs | 49 +++++++---- .../TestsBase/JerkTestsBase.g.cs | 49 +++++++---- .../KinematicViscosityTestsBase.g.cs | 49 +++++++---- .../TestsBase/LeakRateTestsBase.g.cs | 49 +++++++---- .../TestsBase/LengthTestsBase.g.cs | 49 +++++++---- .../TestsBase/LevelTestsBase.g.cs | 32 ++++---- .../TestsBase/LinearDensityTestsBase.g.cs | 49 +++++++---- .../LinearPowerDensityTestsBase.g.cs | 49 +++++++---- .../TestsBase/LuminanceTestsBase.g.cs | 49 +++++++---- .../TestsBase/LuminosityTestsBase.g.cs | 49 +++++++---- .../TestsBase/LuminousFluxTestsBase.g.cs | 49 +++++++---- .../TestsBase/LuminousIntensityTestsBase.g.cs | 49 +++++++---- .../TestsBase/MagneticFieldTestsBase.g.cs | 49 +++++++---- .../TestsBase/MagneticFluxTestsBase.g.cs | 49 +++++++---- .../TestsBase/MagnetizationTestsBase.g.cs | 49 +++++++---- .../TestsBase/MassConcentrationTestsBase.g.cs | 49 +++++++---- .../TestsBase/MassFlowTestsBase.g.cs | 49 +++++++---- .../TestsBase/MassFluxTestsBase.g.cs | 49 +++++++---- .../TestsBase/MassFractionTestsBase.g.cs | 30 ++++--- .../MassMomentOfInertiaTestsBase.g.cs | 49 +++++++---- .../TestsBase/MassTestsBase.g.cs | 49 +++++++---- .../TestsBase/MolalityTestsBase.g.cs | 49 +++++++---- .../TestsBase/MolarEnergyTestsBase.g.cs | 49 +++++++---- .../TestsBase/MolarEntropyTestsBase.g.cs | 49 +++++++---- .../TestsBase/MolarFlowTestsBase.g.cs | 49 +++++++---- .../TestsBase/MolarMassTestsBase.g.cs | 49 +++++++---- .../TestsBase/MolarityTestsBase.g.cs | 49 +++++++---- .../TestsBase/PermeabilityTestsBase.g.cs | 49 +++++++---- .../TestsBase/PermittivityTestsBase.g.cs | 49 +++++++---- .../PorousMediumPermeabilityTestsBase.g.cs | 49 +++++++---- .../TestsBase/PowerDensityTestsBase.g.cs | 49 +++++++---- .../TestsBase/PowerRatioTestsBase.g.cs | 32 ++++---- .../TestsBase/PowerTestsBase.g.cs | 49 +++++++---- .../PressureChangeRateTestsBase.g.cs | 49 +++++++---- .../TestsBase/PressureTestsBase.g.cs | 49 +++++++---- .../RadiationEquivalentDoseRateTestsBase.g.cs | 49 +++++++---- .../RadiationEquivalentDoseTestsBase.g.cs | 49 +++++++---- .../TestsBase/RadiationExposureTestsBase.g.cs | 49 +++++++---- .../TestsBase/RadioactivityTestsBase.g.cs | 49 +++++++---- .../TestsBase/RatioChangeRateTestsBase.g.cs | 49 +++++++---- .../TestsBase/RatioTestsBase.g.cs | 30 ++++--- .../TestsBase/ReciprocalAreaTestsBase.g.cs | 49 +++++++---- .../TestsBase/ReciprocalLengthTestsBase.g.cs | 49 +++++++---- .../TestsBase/RelativeHumidityTestsBase.g.cs | 30 ++++--- .../RotationalAccelerationTestsBase.g.cs | 49 +++++++---- .../TestsBase/RotationalSpeedTestsBase.g.cs | 49 +++++++---- ...RotationalStiffnessPerLengthTestsBase.g.cs | 49 +++++++---- .../RotationalStiffnessTestsBase.g.cs | 49 +++++++---- .../TestsBase/ScalarTestsBase.g.cs | 30 ++++--- .../TestsBase/SolidAngleTestsBase.g.cs | 30 ++++--- .../TestsBase/SpecificEnergyTestsBase.g.cs | 49 +++++++---- .../TestsBase/SpecificEntropyTestsBase.g.cs | 49 +++++++---- .../SpecificFuelConsumptionTestsBase.g.cs | 49 +++++++---- .../TestsBase/SpecificVolumeTestsBase.g.cs | 49 +++++++---- .../TestsBase/SpecificWeightTestsBase.g.cs | 49 +++++++---- .../TestsBase/SpeedTestsBase.g.cs | 49 +++++++---- .../StandardVolumeFlowTestsBase.g.cs | 49 +++++++---- .../TemperatureChangeRateTestsBase.g.cs | 49 +++++++---- .../TestsBase/TemperatureDeltaTestsBase.g.cs | 49 +++++++---- .../TemperatureGradientTestsBase.g.cs | 49 +++++++---- .../TestsBase/TemperatureTestsBase.g.cs | 49 +++++++---- .../ThermalConductivityTestsBase.g.cs | 49 +++++++---- .../TestsBase/ThermalInsulanceTestsBase.g.cs | 49 +++++++---- .../TestsBase/ThermalResistanceTestsBase.g.cs | 49 +++++++---- .../TestsBase/TorqueTestsBase.g.cs | 49 +++++++---- .../TestsBase/TurbidityTestsBase.g.cs | 30 ++++--- .../TestsBase/VitaminATestsBase.g.cs | 30 ++++--- .../VolumeConcentrationTestsBase.g.cs | 30 ++++--- .../TestsBase/VolumeFlowPerAreaTestsBase.g.cs | 49 +++++++---- .../TestsBase/VolumeFlowTestsBase.g.cs | 49 +++++++---- .../TestsBase/VolumePerLengthTestsBase.g.cs | 49 +++++++---- .../TestsBase/VolumeTestsBase.g.cs | 49 +++++++---- .../VolumetricHeatCapacityTestsBase.g.cs | 49 +++++++---- .../WarpingMomentOfInertiaTestsBase.g.cs | 49 +++++++---- 132 files changed, 3981 insertions(+), 2167 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs index 9f9345ee88..af066ffc17 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs @@ -118,7 +118,7 @@ public UnitTestBaseClassGenerator(Quantity quantity) _otherOrBaseUnit = quantity.Units.Where(u => u != _baseUnit).DefaultIfEmpty(_baseUnit).First(); _otherOrBaseUnitFullName = $"{_unitEnumName}.{_otherOrBaseUnit.SingularName}"; _isDimensionless = quantity.BaseDimensions is { L: 0, M: 0, T: 0, I: 0, Θ: 0, N: 0, J: 0 }; - + _defaultAbbreviationsForCulture = new Dictionary>(); var abbreviationsForCulture = new Dictionary>>(); foreach (Unit unit in quantity.Units) @@ -410,7 +410,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() }} [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() {{ Assert.Multiple(() => {{ @@ -428,17 +428,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }}, () => - {{ - IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName}); + }}); + }} - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + {{ + IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName}); - Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }}); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); }} + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() {{ @@ -446,15 +450,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => {{ var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }}, () => {{ IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }}, () => {{ IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }}); }} "); @@ -520,15 +524,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }}, () => - {{ - IQuantity quantityToConvert = quantity; + }}); + }} - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + {{ + var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); + var expectedUnit = {_quantity.Name}.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }}); + IQuantity quantityToConvert = quantity; + + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); }} [Fact] @@ -543,13 +554,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() {{ IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }}, () => - {{ - IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }}); }} + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + {{ + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + }} + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() {{ @@ -562,12 +577,16 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() {{ IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }}, () => - {{ - IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }}); }} + + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + {{ + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + }} "); } @@ -869,7 +888,7 @@ public void TryParseUnitWithAmbiguousAbbreviation(string culture, string abbrevi Writer.WL($@" public void GetAbbreviationForCulture(string culture, {_unitEnumName} unit, string expectedAbbreviation) {{ - var defaultAbbreviation = {_quantity.Name}.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = {_quantity.Name}.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }} "); @@ -881,7 +900,7 @@ public void GetAbbreviationWithDefaultCulture() {{ var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = {_quantity.Name}.GetAbbreviation(unit); + var defaultAbbreviation = {_quantity.Name}.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }}); @@ -1124,7 +1143,7 @@ public void Equals_Logarithmic_WithTolerance(double firstValue, double secondVal Assert.True(quantity.Equals(quantity, maxTolerance)); Assert.True(quantity.Equals(otherQuantity, largerTolerance)); Assert.False(quantity.Equals(otherQuantity, smallerTolerance)); - // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) + // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) // Assert.True(quantity.Equals(otherQuantity, maxTolerance)); }} @@ -1187,7 +1206,7 @@ public void Equals_WithNegativeTolerance_ThrowsArgumentOutOfRangeException() "); } } - + Writer.WL($@" [Fact] diff --git a/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs b/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs index c1f249132c..0e03d7c445 100644 --- a/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs @@ -37,23 +37,29 @@ public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits() { base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits(); } - + [Fact(Skip = "See about changing the BaseUnit to VoltampereSecond or Joule (adding the unit)")] public override void BaseUnit_HasSIBase() { base.BaseUnit_HasSIBase(); } - + [Fact(Skip = "See about adding an SI unit (VoltampereSecond, Joules?)")] public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.As_UnitSystem_SI_ReturnsQuantityInSIUnits(); } - + [Fact(Skip = "See about adding an SI unit (VoltampereSecond, Joules?)")] public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits(); } + + [Fact(Skip = "See about adding an SI unit (VoltampereSecond, Joules?)")] + public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits(); + } } } diff --git a/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs b/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs index 3f0ea76660..c6a879999c 100644 --- a/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs @@ -36,23 +36,29 @@ public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits() { base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits(); } - + [Fact(Skip = "See about changing the BaseUnit to VoltampereReactiveSecond or Joule (adding the unit)")] public override void BaseUnit_HasSIBase() { base.BaseUnit_HasSIBase(); } - + [Fact(Skip = "See about adding an SI unit (VoltampereReactiveSecond, Joules?)")] public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.As_UnitSystem_SI_ReturnsQuantityInSIUnits(); } - + [Fact(Skip = "See about adding an SI unit (VoltampereReactiveSecond, Joules?)")] public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits(); } + + [Fact(Skip = "See about adding an SI unit (VoltampereReactiveSecond, Joules?)")] + public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits(); + } } } diff --git a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs index 329dac3619..06bf5627cb 100644 --- a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs +++ b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs @@ -24,19 +24,19 @@ namespace UnitsNet.Tests.CustomCode public class FuelEfficiencyTests : FuelEfficiencyTestsBase { protected override bool SupportsSIUnitSystem => false; - + protected override double KilometersPerLiterInOneKilometerPerLiter => 1; protected override double LitersPer100KilometersInOneKilometerPerLiter => 100; protected override double MilesPerUkGallonInOneKilometerPerLiter => 2.824809363318222; protected override double MilesPerUsGallonInOneKilometerPerLiter => 2.352145833333333; - + [Fact(Skip = "The SI unit would have to be MeterPerCubicMeter")] public override void BaseUnit_HasSIBase() { base.BaseUnit_HasSIBase(); } - + [Fact(Skip = "The SI unit would have to be MeterPerCubicMeter")] public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits() { @@ -54,5 +54,11 @@ public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits(); } + + [Fact(Skip = "The SI unit would have to be MeterPerCubicMeter")] + public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits(); + } } } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs index 8ba1957189..68c7e24cea 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs @@ -321,15 +321,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); + var expectedUnit = AbsorbedDoseOfIonizingRadiation.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -344,13 +351,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -363,13 +374,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cGy", AbsorbedDoseOfIonizingRadiationUnit.Centigray, 4.2)] [InlineData("en-US", "4.2 dGy", AbsorbedDoseOfIonizingRadiationUnit.Decigray, 4.2)] @@ -763,7 +778,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Absorb [InlineData("ru-RU", AbsorbedDoseOfIonizingRadiationUnit.Teragray, "ТГр")] public void GetAbbreviationForCulture(string culture, AbsorbedDoseOfIonizingRadiationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = AbsorbedDoseOfIonizingRadiation.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = AbsorbedDoseOfIonizingRadiation.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -774,7 +789,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = AbsorbedDoseOfIonizingRadiation.GetAbbreviation(unit); + var defaultAbbreviation = AbsorbedDoseOfIonizingRadiation.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs index 17c71097ba..39d655763c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs @@ -303,15 +303,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); + var expectedUnit = Acceleration.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -326,13 +333,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -345,13 +356,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cm/s²", AccelerationUnit.CentimeterPerSecondSquared, 4.2)] [InlineData("en-US", "4.2 dm/s²", AccelerationUnit.DecimeterPerSecondSquared, 4.2)] @@ -691,7 +706,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Accele [InlineData("ru-RU", AccelerationUnit.StandardGravity, "g")] public void GetAbbreviationForCulture(string culture, AccelerationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Acceleration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Acceleration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -702,7 +717,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Acceleration.GetAbbreviation(unit); + var defaultAbbreviation = Acceleration.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs index df6c0e205a..2884db6eca 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs @@ -321,15 +321,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); + var expectedUnit = AmountOfSubstance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -344,13 +351,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -363,13 +374,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cmol", AmountOfSubstanceUnit.Centimole, 4.2)] [InlineData("en-US", "4.2 clbmol", AmountOfSubstanceUnit.CentipoundMole, 4.2)] @@ -644,7 +659,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Amount [InlineData("en-US", AmountOfSubstanceUnit.PoundMole, "lbmol")] public void GetAbbreviationForCulture(string culture, AmountOfSubstanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = AmountOfSubstance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = AmountOfSubstance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -655,7 +670,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = AmountOfSubstance.GetAbbreviation(unit); + var defaultAbbreviation = AmountOfSubstance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs index 2d3be5a3a3..c3d04ff543 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs @@ -184,7 +184,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -202,17 +202,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt); - Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -220,15 +224,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -363,7 +367,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Amplit [InlineData("en-US", AmplitudeRatioUnit.DecibelVolt, "dBV")] public void GetAbbreviationForCulture(string culture, AmplitudeRatioUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = AmplitudeRatio.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = AmplitudeRatio.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -374,7 +378,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = AmplitudeRatio.GetAbbreviation(unit); + var defaultAbbreviation = AmplitudeRatio.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); @@ -578,7 +582,7 @@ public void Equals_Logarithmic_WithTolerance(double firstValue, double secondVal Assert.True(quantity.Equals(quantity, maxTolerance)); Assert.True(quantity.Equals(otherQuantity, largerTolerance)); Assert.False(quantity.Equals(otherQuantity, smallerTolerance)); - // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) + // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) // Assert.True(quantity.Equals(otherQuantity, maxTolerance)); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs index 873ceb53bc..6f31449ec2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs @@ -250,7 +250,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -268,17 +268,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Angle(value: 1, unit: AngleUnit.Radian); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new Angle(value: 1, unit: AngleUnit.Radian); - Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -286,15 +290,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Angle(value: 1, unit: Angle.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Angle(value: 1, unit: Angle.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Angle(value: 1, unit: Angle.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -734,7 +738,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, AngleU [InlineData("ru-RU", AngleUnit.Revolution, "r")] public void GetAbbreviationForCulture(string culture, AngleUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Angle.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Angle.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -745,7 +749,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Angle.GetAbbreviation(unit); + var defaultAbbreviation = Angle.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs index 671597a4aa..dad78319c7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); + var expectedUnit = AreaDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 g/m²", AreaDensityUnit.GramPerSquareMeter, 4.2)] [InlineData("en-US", "4.2 gsm", AreaDensityUnit.GramPerSquareMeter, 4.2)] @@ -416,7 +431,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, AreaDe [InlineData("en-US", AreaDensityUnit.MilligramPerSquareMeter, "mg/m²")] public void GetAbbreviationForCulture(string culture, AreaDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = AreaDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = AreaDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -427,7 +442,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = AreaDensity.GetAbbreviation(unit); + var defaultAbbreviation = AreaDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs index 1feac48950..f04b070fad 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); + var expectedUnit = AreaMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cm⁴", AreaMomentOfInertiaUnit.CentimeterToTheFourth, 4.2)] [InlineData("en-US", "4.2 dm⁴", AreaMomentOfInertiaUnit.DecimeterToTheFourth, 4.2)] @@ -457,7 +472,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, AreaMo [InlineData("en-US", AreaMomentOfInertiaUnit.MillimeterToTheFourth, "mm⁴")] public void GetAbbreviationForCulture(string culture, AreaMomentOfInertiaUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = AreaMomentOfInertia.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = AreaMomentOfInertia.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -468,7 +483,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = AreaMomentOfInertia.GetAbbreviation(unit); + var defaultAbbreviation = AreaMomentOfInertia.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs index fbcd77a1c4..64fd412461 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs @@ -303,15 +303,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Area(value: 1, unit: Area.BaseUnit); + var expectedUnit = Area.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -326,13 +333,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -345,13 +356,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 ac", AreaUnit.Acre, 4.2)] [InlineData("en-US", "4.2 ha", AreaUnit.Hectare, 4.2)] @@ -798,7 +813,7 @@ public void TryParseUnitWithAmbiguousAbbreviation(string culture, string abbrevi [InlineData("zh-CN", AreaUnit.SquareYard, "平方码")] public void GetAbbreviationForCulture(string culture, AreaUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Area.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Area.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -809,7 +824,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Area.GetAbbreviation(unit); + var defaultAbbreviation = Area.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs index d148bf47a4..6ef7ecfa58 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs @@ -453,15 +453,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); + var expectedUnit = BitRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -476,13 +483,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -495,13 +506,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 bit/s", BitRateUnit.BitPerSecond, 4.2)] [InlineData("en-US", "4.2 bps", BitRateUnit.BitPerSecond, 4.2)] @@ -1148,7 +1163,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, BitRat [InlineData("en-US", BitRateUnit.TeraoctetPerSecond, "To/s")] public void GetAbbreviationForCulture(string culture, BitRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = BitRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = BitRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1159,7 +1174,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = BitRate.GetAbbreviation(unit); + var defaultAbbreviation = BitRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs index 79b8e77ca1..c50a019039 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); + var expectedUnit = BrakeSpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 g/kWh", BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, 4.2)] [InlineData("en-US", "4.2 kg/J", BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, BrakeS [InlineData("en-US", BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, "lb/hph")] public void GetAbbreviationForCulture(string culture, BrakeSpecificFuelConsumptionUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = BrakeSpecificFuelConsumption.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = BrakeSpecificFuelConsumption.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = BrakeSpecificFuelConsumption.GetAbbreviation(unit); + var defaultAbbreviation = BrakeSpecificFuelConsumption.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs index 16d3ded374..c5341305ca 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); + var expectedUnit = CoefficientOfThermalExpansion.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 °C⁻¹", CoefficientOfThermalExpansionUnit.PerDegreeCelsius, 4.2)] [InlineData("en-US", "4.2 °F⁻¹", CoefficientOfThermalExpansionUnit.PerDegreeFahrenheit, 4.2)] @@ -457,7 +472,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Coeffi [InlineData("en-US", CoefficientOfThermalExpansionUnit.PpmPerKelvin, "ppm/K")] public void GetAbbreviationForCulture(string culture, CoefficientOfThermalExpansionUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = CoefficientOfThermalExpansion.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = CoefficientOfThermalExpansion.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -468,7 +483,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = CoefficientOfThermalExpansion.GetAbbreviation(unit); + var defaultAbbreviation = CoefficientOfThermalExpansion.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs index 352de0fc8c..c25f8d530e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs @@ -261,15 +261,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); + var expectedUnit = Compressibility.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -284,13 +291,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -303,13 +314,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 atm⁻¹", CompressibilityUnit.InverseAtmosphere, 4.2)] [InlineData("en-US", "4.2 1/atm", CompressibilityUnit.InverseAtmosphere, 4.2)] @@ -544,7 +559,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Compre [InlineData("en-US", CompressibilityUnit.InversePoundForcePerSquareInch, "psi⁻¹")] public void GetAbbreviationForCulture(string culture, CompressibilityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Compressibility.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Compressibility.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -555,7 +570,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Compressibility.GetAbbreviation(unit); + var defaultAbbreviation = Compressibility.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index ec5fe0b0ab..945a287197 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -555,15 +555,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Density(value: 1, unit: Density.BaseUnit); + var expectedUnit = Density.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -578,13 +585,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -597,13 +608,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cg/dl", DensityUnit.CentigramPerDeciliter, 4.2)] [InlineData("en-US", "4.2 cg/l", DensityUnit.CentigramPerLiter, 4.2)] @@ -1395,7 +1410,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Densit [InlineData("ru-RU", DensityUnit.MilligramPerCubicMeter, "мг/м³")] public void GetAbbreviationForCulture(string culture, DensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Density.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Density.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1406,7 +1421,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Density.GetAbbreviation(unit); + var defaultAbbreviation = Density.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs index bd00cbf085..e229e351b8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs @@ -369,15 +369,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); + var expectedUnit = DoseAreaProduct.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -392,13 +399,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -411,13 +422,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cGy·cm²", DoseAreaProductUnit.CentigraySquareCentimeter, 4.2)] [InlineData("en-US", "4.2 cGy·dm²", DoseAreaProductUnit.CentigraySquareDecimeter, 4.2)] @@ -955,7 +970,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, DoseAr [InlineData("ru-RU", DoseAreaProductUnit.MilligraySquareMillimeter, "мГр·мм²")] public void GetAbbreviationForCulture(string culture, DoseAreaProductUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = DoseAreaProduct.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = DoseAreaProduct.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -966,7 +981,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = DoseAreaProduct.GetAbbreviation(unit); + var defaultAbbreviation = DoseAreaProduct.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs index 85c35c55cc..83c3d372dc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs @@ -297,15 +297,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Duration(value: 1, unit: Duration.BaseUnit); + var expectedUnit = Duration.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -320,13 +327,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -339,13 +350,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 d", DurationUnit.Day, 4.2)] [InlineData("en-US", "4.2 day", DurationUnit.Day, 4.2)] @@ -1065,7 +1080,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Durati [InlineData("ru-RU", DurationUnit.Year365, "год")] public void GetAbbreviationForCulture(string culture, DurationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Duration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Duration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1076,7 +1091,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Duration.GetAbbreviation(unit); + var defaultAbbreviation = Duration.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs index a534786b25..3e48a06416 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs @@ -279,15 +279,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); + var expectedUnit = DynamicViscosity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -302,13 +309,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -321,13 +332,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cP", DynamicViscosityUnit.Centipoise, 4.2)] [InlineData("en-US", "4.2 µPa·s", DynamicViscosityUnit.MicropascalSecond, 4.2)] @@ -555,7 +570,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Dynami [InlineData("en-US", DynamicViscosityUnit.Reyn, "reyn")] public void GetAbbreviationForCulture(string culture, DynamicViscosityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = DynamicViscosity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = DynamicViscosity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -566,7 +581,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = DynamicViscosity.GetAbbreviation(unit); + var defaultAbbreviation = DynamicViscosity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs index a112ce9452..125af7e0d1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs @@ -315,15 +315,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); + var expectedUnit = ElectricAdmittance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -338,13 +345,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -357,13 +368,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 G℧", ElectricAdmittanceUnit.Gigamho, 4.2)] [InlineData("en-US", "4.2 GS", ElectricAdmittanceUnit.Gigasiemens, 4.2)] @@ -627,7 +642,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricAdmittanceUnit.Terasiemens, "TS")] public void GetAbbreviationForCulture(string culture, ElectricAdmittanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricAdmittance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricAdmittance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -638,7 +653,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricAdmittance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricAdmittance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs index 43a1c68f0e..d6c7f9d6fc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); + var expectedUnit = ElectricApparentEnergy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kVAh", ElectricApparentEnergyUnit.KilovoltampereHour, 4.2)] [InlineData("en-US", "4.2 MVAh", ElectricApparentEnergyUnit.MegavoltampereHour, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricApparentEnergyUnit.VoltampereHour, "VAh")] public void GetAbbreviationForCulture(string culture, ElectricApparentEnergyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricApparentEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricApparentEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricApparentEnergy.GetAbbreviation(unit); + var defaultAbbreviation = ElectricApparentEnergy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs index 4c5e5960f7..1f1763ef49 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); + var expectedUnit = ElectricApparentPower.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 GVA", ElectricApparentPowerUnit.Gigavoltampere, 4.2)] [InlineData("en-US", "4.2 kVA", ElectricApparentPowerUnit.Kilovoltampere, 4.2)] @@ -457,7 +472,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricApparentPowerUnit.Voltampere, "VA")] public void GetAbbreviationForCulture(string culture, ElectricApparentPowerUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricApparentPower.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricApparentPower.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -468,7 +483,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricApparentPower.GetAbbreviation(unit); + var defaultAbbreviation = ElectricApparentPower.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs index c1991c1c5b..713c8ec6b0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs @@ -261,15 +261,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); + var expectedUnit = ElectricCapacitance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -284,13 +291,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -303,13 +314,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 F", ElectricCapacitanceUnit.Farad, 4.2)] [InlineData("en-US", "4.2 kF", ElectricCapacitanceUnit.Kilofarad, 4.2)] @@ -474,7 +489,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricCapacitanceUnit.Picofarad, "pF")] public void GetAbbreviationForCulture(string culture, ElectricCapacitanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricCapacitance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricCapacitance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -485,7 +500,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricCapacitance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricCapacitance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs index 4b9edbc063..99b5f5c879 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); + var expectedUnit = ElectricChargeDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 C/m³", ElectricChargeDensityUnit.CoulombPerCubicMeter, 4.2)] public void Parse(string culture, string quantityString, ElectricChargeDensityUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricChargeDensityUnit.CoulombPerCubicMeter, "C/m³")] public void GetAbbreviationForCulture(string culture, ElectricChargeDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricChargeDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricChargeDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricChargeDensity.GetAbbreviation(unit); + var defaultAbbreviation = ElectricChargeDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs index a3a09feb14..829e3ed80a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs @@ -285,15 +285,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); + var expectedUnit = ElectricCharge.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -308,13 +315,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -327,13 +338,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 A-h", ElectricChargeUnit.AmpereHour, 4.2)] [InlineData("en-US", "4.2 Ah", ElectricChargeUnit.AmpereHour, 4.2)] @@ -582,7 +597,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricChargeUnit.Picocoulomb, "pC")] public void GetAbbreviationForCulture(string culture, ElectricChargeUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricCharge.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricCharge.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -593,7 +608,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricCharge.GetAbbreviation(unit); + var defaultAbbreviation = ElectricCharge.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs index c25f98abf5..3ecb14ca28 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs @@ -315,15 +315,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); + var expectedUnit = ElectricConductance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -338,13 +345,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -357,13 +368,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 G℧", ElectricConductanceUnit.Gigamho, 4.2)] [InlineData("en-US", "4.2 GS", ElectricConductanceUnit.Gigasiemens, 4.2)] @@ -627,7 +642,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricConductanceUnit.Terasiemens, "TS")] public void GetAbbreviationForCulture(string culture, ElectricConductanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricConductance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricConductance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -638,7 +653,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricConductance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricConductance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs index de41dc4d00..c8da7c2b5a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); + var expectedUnit = ElectricConductivity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 µS/cm", ElectricConductivityUnit.MicrosiemensPerCentimeter, 4.2)] [InlineData("en-US", "4.2 mS/cm", ElectricConductivityUnit.MillisiemensPerCentimeter, 4.2)] @@ -457,7 +472,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricConductivityUnit.SiemensPerMeter, "S/m")] public void GetAbbreviationForCulture(string culture, ElectricConductivityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricConductivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricConductivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -468,7 +483,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricConductivity.GetAbbreviation(unit); + var defaultAbbreviation = ElectricConductivity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs index 511752812c..ed3b5b813d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); + var expectedUnit = ElectricCurrentDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 A/ft²", ElectricCurrentDensityUnit.AmperePerSquareFoot, 4.2)] [InlineData("en-US", "4.2 A/in²", ElectricCurrentDensityUnit.AmperePerSquareInch, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricCurrentDensityUnit.AmperePerSquareMeter, "A/m²")] public void GetAbbreviationForCulture(string culture, ElectricCurrentDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricCurrentDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricCurrentDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricCurrentDensity.GetAbbreviation(unit); + var defaultAbbreviation = ElectricCurrentDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs index 06ffb5ed6a..8df9797131 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs @@ -261,15 +261,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); + var expectedUnit = ElectricCurrentGradient.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -284,13 +291,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -303,13 +314,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 A/μs", ElectricCurrentGradientUnit.AmperePerMicrosecond, 4.2)] [InlineData("en-US", "4.2 A/ms", ElectricCurrentGradientUnit.AmperePerMillisecond, 4.2)] @@ -474,7 +489,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricCurrentGradientUnit.MilliamperePerSecond, "mA/s")] public void GetAbbreviationForCulture(string culture, ElectricCurrentGradientUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricCurrentGradient.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricCurrentGradient.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -485,7 +500,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricCurrentGradient.GetAbbreviation(unit); + var defaultAbbreviation = ElectricCurrentGradient.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs index 7f57094893..ac951dbc83 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); + var expectedUnit = ElectricCurrent.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 A", ElectricCurrentUnit.Ampere, 4.2)] [InlineData("en-US", "4.2 cA", ElectricCurrentUnit.Centiampere, 4.2)] @@ -508,7 +523,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricCurrentUnit.Picoampere, "pA")] public void GetAbbreviationForCulture(string culture, ElectricCurrentUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricCurrent.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricCurrent.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -519,7 +534,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricCurrent.GetAbbreviation(unit); + var defaultAbbreviation = ElectricCurrent.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs index 22cd463564..f4504b426f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); + var expectedUnit = ElectricField.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 V/m", ElectricFieldUnit.VoltPerMeter, 4.2)] public void Parse(string culture, string quantityString, ElectricFieldUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricFieldUnit.VoltPerMeter, "V/m")] public void GetAbbreviationForCulture(string culture, ElectricFieldUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricField.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricField.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricField.GetAbbreviation(unit); + var defaultAbbreviation = ElectricField.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs index 2817aa9799..7dc8c9478e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs @@ -267,15 +267,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); + var expectedUnit = ElectricImpedance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -290,13 +297,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -309,13 +320,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 GΩ", ElectricImpedanceUnit.Gigaohm, 4.2)] [InlineData("en-US", "4.2 kΩ", ElectricImpedanceUnit.Kiloohm, 4.2)] @@ -491,7 +506,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricImpedanceUnit.Teraohm, "TΩ")] public void GetAbbreviationForCulture(string culture, ElectricImpedanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricImpedance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricImpedance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -502,7 +517,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricImpedance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricImpedance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs index 53a5eac00c..982a565b92 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs @@ -249,15 +249,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); + var expectedUnit = ElectricInductance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -272,13 +279,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -291,13 +302,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 H", ElectricInductanceUnit.Henry, 4.2)] [InlineData("en-US", "4.2 µH", ElectricInductanceUnit.Microhenry, 4.2)] @@ -440,7 +455,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricInductanceUnit.Picohenry, "pH")] public void GetAbbreviationForCulture(string culture, ElectricInductanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricInductance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricInductance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -451,7 +466,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricInductance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricInductance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs index 98b93a6825..321f1fff21 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs @@ -339,15 +339,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); + var expectedUnit = ElectricPotentialChangeRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -362,13 +369,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -381,13 +392,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kV/h", ElectricPotentialChangeRateUnit.KilovoltPerHour, 4.2)] [InlineData("en-US", "4.2 kV/μs", ElectricPotentialChangeRateUnit.KilovoltPerMicrosecond, 4.2)] @@ -695,7 +710,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricPotentialChangeRateUnit.VoltPerSecond, "V/s")] public void GetAbbreviationForCulture(string culture, ElectricPotentialChangeRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricPotentialChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricPotentialChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -706,7 +721,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricPotentialChangeRate.GetAbbreviation(unit); + var defaultAbbreviation = ElectricPotentialChangeRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs index 2228b09a0d..bbc5001a71 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); + var expectedUnit = ElectricPotential.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kV", ElectricPotentialUnit.Kilovolt, 4.2)] [InlineData("en-US", "4.2 MV", ElectricPotentialUnit.Megavolt, 4.2)] @@ -499,7 +514,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("ru-RU", ElectricPotentialUnit.Volt, "В")] public void GetAbbreviationForCulture(string culture, ElectricPotentialUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricPotential.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricPotential.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -510,7 +525,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricPotential.GetAbbreviation(unit); + var defaultAbbreviation = ElectricPotential.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs index e78bdbda65..0636d5f7d6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs @@ -267,15 +267,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); + var expectedUnit = ElectricReactance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -290,13 +297,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -309,13 +320,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 GΩ", ElectricReactanceUnit.Gigaohm, 4.2)] [InlineData("en-US", "4.2 kΩ", ElectricReactanceUnit.Kiloohm, 4.2)] @@ -491,7 +506,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricReactanceUnit.Teraohm, "TΩ")] public void GetAbbreviationForCulture(string culture, ElectricReactanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricReactance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricReactance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -502,7 +517,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricReactance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricReactance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs index 5492ac3d4d..c9aba7a3f0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); + var expectedUnit = ElectricReactiveEnergy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kvarh", ElectricReactiveEnergyUnit.KilovoltampereReactiveHour, 4.2)] [InlineData("en-US", "4.2 Mvarh", ElectricReactiveEnergyUnit.MegavoltampereReactiveHour, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricReactiveEnergyUnit.VoltampereReactiveHour, "varh")] public void GetAbbreviationForCulture(string culture, ElectricReactiveEnergyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricReactiveEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricReactiveEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricReactiveEnergy.GetAbbreviation(unit); + var defaultAbbreviation = ElectricReactiveEnergy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs index 53fb2f0c3b..fd7de8315d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs @@ -243,15 +243,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); + var expectedUnit = ElectricReactivePower.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -266,13 +273,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -285,13 +296,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Gvar", ElectricReactivePowerUnit.GigavoltampereReactive, 4.2)] [InlineData("en-US", "4.2 kvar", ElectricReactivePowerUnit.KilovoltampereReactive, 4.2)] @@ -423,7 +438,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricReactivePowerUnit.VoltampereReactive, "var")] public void GetAbbreviationForCulture(string culture, ElectricReactivePowerUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricReactivePower.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricReactivePower.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -434,7 +449,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricReactivePower.GetAbbreviation(unit); + var defaultAbbreviation = ElectricReactivePower.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs index c3b231005b..3943566009 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs @@ -267,15 +267,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); + var expectedUnit = ElectricResistance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -290,13 +297,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -309,13 +320,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 GΩ", ElectricResistanceUnit.Gigaohm, 4.2)] [InlineData("en-US", "4.2 kΩ", ElectricResistanceUnit.Kiloohm, 4.2)] @@ -491,7 +506,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricResistanceUnit.Teraohm, "TΩ")] public void GetAbbreviationForCulture(string culture, ElectricResistanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricResistance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricResistance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -502,7 +517,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricResistance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricResistance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs index 06b830d917..51f7dbd374 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs @@ -303,15 +303,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); + var expectedUnit = ElectricResistivity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -326,13 +333,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -345,13 +356,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kΩ·cm", ElectricResistivityUnit.KiloohmCentimeter, 4.2)] [InlineData("en-US", "4.2 kΩ·m", ElectricResistivityUnit.KiloohmMeter, 4.2)] @@ -593,7 +608,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricResistivityUnit.PicoohmMeter, "pΩ·m")] public void GetAbbreviationForCulture(string culture, ElectricResistivityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricResistivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricResistivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -604,7 +619,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricResistivity.GetAbbreviation(unit); + var defaultAbbreviation = ElectricResistivity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs index b46171b986..a2e948a9d9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); + var expectedUnit = ElectricSurfaceChargeDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 C/cm²", ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter, 4.2)] [InlineData("en-US", "4.2 C/in²", ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, "C/m²")] public void GetAbbreviationForCulture(string culture, ElectricSurfaceChargeDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricSurfaceChargeDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricSurfaceChargeDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricSurfaceChargeDensity.GetAbbreviation(unit); + var defaultAbbreviation = ElectricSurfaceChargeDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs index c5cb0afe1c..4e0410b413 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs @@ -315,15 +315,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); + var expectedUnit = ElectricSusceptance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -338,13 +345,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -357,13 +368,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 G℧", ElectricSusceptanceUnit.Gigamho, 4.2)] [InlineData("en-US", "4.2 GS", ElectricSusceptanceUnit.Gigasiemens, 4.2)] @@ -627,7 +642,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Electr [InlineData("en-US", ElectricSusceptanceUnit.Terasiemens, "TS")] public void GetAbbreviationForCulture(string culture, ElectricSusceptanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ElectricSusceptance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ElectricSusceptance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -638,7 +653,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ElectricSusceptance.GetAbbreviation(unit); + var defaultAbbreviation = ElectricSusceptance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs index bb8333bb12..9008605472 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs @@ -291,15 +291,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); + var expectedUnit = EnergyDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -314,13 +321,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -333,13 +344,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 GJ/m³", EnergyDensityUnit.GigajoulePerCubicMeter, 4.2)] [InlineData("en-US", "4.2 GWh/m³", EnergyDensityUnit.GigawattHourPerCubicMeter, 4.2)] @@ -559,7 +574,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Energy [InlineData("en-US", EnergyDensityUnit.WattHourPerCubicMeter, "Wh/m³")] public void GetAbbreviationForCulture(string culture, EnergyDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = EnergyDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = EnergyDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -570,7 +585,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = EnergyDensity.GetAbbreviation(unit); + var defaultAbbreviation = EnergyDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs index 7b293ea315..162ec02930 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs @@ -459,15 +459,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Energy(value: 1, unit: Energy.BaseUnit); + var expectedUnit = Energy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -482,13 +489,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -501,13 +512,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 BTU", EnergyUnit.BritishThermalUnit, 4.2)] [InlineData("en-US", "4.2 cal", EnergyUnit.Calorie, 4.2)] @@ -1182,7 +1197,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Energy [InlineData("ru-RU", EnergyUnit.WattHour, "Вт/ч")] public void GetAbbreviationForCulture(string culture, EnergyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Energy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Energy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1193,7 +1208,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Energy.GetAbbreviation(unit); + var defaultAbbreviation = Energy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs index 5fe95c5db1..2fb5ab4c9f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs @@ -261,15 +261,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); + var expectedUnit = Entropy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -284,13 +291,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -303,13 +314,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cal/K", EntropyUnit.CaloriePerKelvin, 4.2)] [InlineData("en-US", "4.2 J/°C", EntropyUnit.JoulePerDegreeCelsius, 4.2)] @@ -474,7 +489,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Entrop [InlineData("en-US", EntropyUnit.MegajoulePerKelvin, "MJ/K")] public void GetAbbreviationForCulture(string culture, EntropyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Entropy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Entropy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -485,7 +500,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Entropy.GetAbbreviation(unit); + var defaultAbbreviation = Entropy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs index 7a4523034c..ba4468d0f6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs @@ -333,15 +333,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); + var expectedUnit = FluidResistance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -356,13 +363,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -375,13 +386,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 dyn·s/cm⁵", FluidResistanceUnit.DyneSecondPerCentimeterToTheFifth, 4.2)] [InlineData("en-US", "4.2 dyn·s·cm⁻⁵", FluidResistanceUnit.DyneSecondPerCentimeterToTheFifth, 4.2)] @@ -843,7 +858,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, FluidR [InlineData("ru-RU", FluidResistanceUnit.WoodUnit, "ЕВ")] public void GetAbbreviationForCulture(string culture, FluidResistanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = FluidResistance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = FluidResistance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -854,7 +869,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = FluidResistance.GetAbbreviation(unit); + var defaultAbbreviation = FluidResistance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs index e336bc373f..1764191f21 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs @@ -309,15 +309,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); + var expectedUnit = ForceChangeRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -332,13 +339,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -351,13 +362,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cN/s", ForceChangeRateUnit.CentinewtonPerSecond, 4.2)] [InlineData("en-US", "4.2 daN/min", ForceChangeRateUnit.DecanewtonPerMinute, 4.2)] @@ -650,7 +665,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, ForceC [InlineData("en-US", ForceChangeRateUnit.PoundForcePerSecond, "lbf/s")] public void GetAbbreviationForCulture(string culture, ForceChangeRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ForceChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ForceChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -661,7 +676,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ForceChangeRate.GetAbbreviation(unit); + var defaultAbbreviation = ForceChangeRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs index 7cc6373954..252dd6dc83 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs @@ -447,15 +447,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); + var expectedUnit = ForcePerLength.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -470,13 +477,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -489,13 +500,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cN/cm", ForcePerLengthUnit.CentinewtonPerCentimeter, 4.2)] [InlineData("en-US", "4.2 cN/m", ForcePerLengthUnit.CentinewtonPerMeter, 4.2)] @@ -1083,7 +1098,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, ForceP [InlineData("ru-RU", ForcePerLengthUnit.TonneForcePerMillimeter, "тс/мм")] public void GetAbbreviationForCulture(string culture, ForcePerLengthUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ForcePerLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ForcePerLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1094,7 +1109,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ForcePerLength.GetAbbreviation(unit); + var defaultAbbreviation = ForcePerLength.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs index ffd2dc009e..a0a226c907 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs @@ -309,15 +309,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Force(value: 1, unit: Force.BaseUnit); + var expectedUnit = Force.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -332,13 +339,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -351,13 +362,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 daN", ForceUnit.Decanewton, 4.2)] [InlineData("en-US", "4.2 dyn", ForceUnit.Dyn, 4.2)] @@ -779,7 +794,7 @@ public void TryParseUnitWithAmbiguousAbbreviation(string culture, string abbrevi [InlineData("ru-RU", ForceUnit.TonneForce, "тс")] public void GetAbbreviationForCulture(string culture, ForceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Force.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Force.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -790,7 +805,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Force.GetAbbreviation(unit); + var defaultAbbreviation = Force.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs index 8976679468..99430abdad 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs @@ -291,15 +291,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); + var expectedUnit = Frequency.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -314,13 +321,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -333,13 +344,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 bpm", FrequencyUnit.BeatPerMinute, 4.2)] [InlineData("en-US", "4.2 cph", FrequencyUnit.CyclePerHour, 4.2)] @@ -622,7 +637,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Freque [InlineData("ru-RU", FrequencyUnit.Terahertz, "ТГц")] public void GetAbbreviationForCulture(string culture, FrequencyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Frequency.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Frequency.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -633,7 +648,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Frequency.GetAbbreviation(unit); + var defaultAbbreviation = Frequency.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs index ac772ae4d6..c548256476 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs @@ -243,15 +243,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); + var expectedUnit = FuelEfficiency.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -266,13 +273,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -285,13 +296,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 km/l", FuelEfficiencyUnit.KilometerPerLiter, 4.2)] [InlineData("en-US", "4.2 l/100km", FuelEfficiencyUnit.LiterPer100Kilometers, 4.2)] @@ -423,7 +438,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, FuelEf [InlineData("en-US", FuelEfficiencyUnit.MilePerUsGallon, "mpg (U.S.)")] public void GetAbbreviationForCulture(string culture, FuelEfficiencyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = FuelEfficiency.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = FuelEfficiency.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -434,7 +449,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = FuelEfficiency.GetAbbreviation(unit); + var defaultAbbreviation = FuelEfficiency.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs index 16ac1f38a9..24e1428c04 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs @@ -327,15 +327,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); + var expectedUnit = HeatFlux.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -350,13 +357,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -369,13 +380,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 BTU/(h·ft²)", HeatFluxUnit.BtuPerHourSquareFoot, 4.2)] [InlineData("en-US", "4.2 BTU/(min·ft²)", HeatFluxUnit.BtuPerMinuteSquareFoot, 4.2)] @@ -671,7 +686,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, HeatFl [InlineData("en-US", HeatFluxUnit.WattPerSquareMeter, "W/m²")] public void GetAbbreviationForCulture(string culture, HeatFluxUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = HeatFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = HeatFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -682,7 +697,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = HeatFlux.GetAbbreviation(unit); + var defaultAbbreviation = HeatFlux.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs index 045cb75a2e..459b1b954b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs @@ -249,15 +249,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); + var expectedUnit = HeatTransferCoefficient.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -272,13 +279,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -291,13 +302,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Btu/(h·ft²·°F)", HeatTransferCoefficientUnit.BtuPerHourSquareFootDegreeFahrenheit, 4.2)] [InlineData("en-US", "4.2 Btu/(ft²·h·°F)", HeatTransferCoefficientUnit.BtuPerHourSquareFootDegreeFahrenheit, 4.2)] @@ -530,7 +545,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, HeatTr [InlineData("en-US", HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, "W/(m²·K)")] public void GetAbbreviationForCulture(string culture, HeatTransferCoefficientUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = HeatTransferCoefficient.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = HeatTransferCoefficient.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -541,7 +556,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = HeatTransferCoefficient.GetAbbreviation(unit); + var defaultAbbreviation = HeatTransferCoefficient.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs index 0f40c21957..f13d9cbb93 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs @@ -243,15 +243,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); + var expectedUnit = Illuminance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -266,13 +273,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -285,13 +296,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 klx", IlluminanceUnit.Kilolux, 4.2)] [InlineData("en-US", "4.2 lx", IlluminanceUnit.Lux, 4.2)] @@ -423,7 +438,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Illumi [InlineData("en-US", IlluminanceUnit.Millilux, "mlx")] public void GetAbbreviationForCulture(string culture, IlluminanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Illuminance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Illuminance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -434,7 +449,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Illuminance.GetAbbreviation(unit); + var defaultAbbreviation = Illuminance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs index 56fa4efebd..22ccda7d8c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs @@ -297,15 +297,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); + var expectedUnit = Impulse.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -320,13 +327,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -339,13 +350,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cN·s", ImpulseUnit.CentinewtonSecond, 4.2)] [InlineData("en-US", "4.2 daN·s", ImpulseUnit.DecanewtonSecond, 4.2)] @@ -576,7 +591,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Impuls [InlineData("en-US", ImpulseUnit.SlugFootPerSecond, "slug·ft/s")] public void GetAbbreviationForCulture(string culture, ImpulseUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Impulse.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Impulse.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -587,7 +602,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Impulse.GetAbbreviation(unit); + var defaultAbbreviation = Impulse.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs index a35abcd79e..ca50b36398 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs @@ -394,7 +394,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -412,17 +412,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(InformationUnit.Bit, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Information(value: 1, unit: InformationUnit.Bit); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new Information(value: 1, unit: InformationUnit.Bit); - Assert.Equal(InformationUnit.Bit, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(InformationUnit.Bit, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -430,15 +434,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Information(value: 1, unit: Information.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Information(value: 1, unit: Information.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Information(value: 1, unit: Information.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -958,7 +962,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Inform [InlineData("en-US", InformationUnit.Teraoctet, "To")] public void GetAbbreviationForCulture(string culture, InformationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Information.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Information.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -969,7 +973,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Information.GetAbbreviation(unit); + var defaultAbbreviation = Information.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs index ec5017615b..e7693b855a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs @@ -303,15 +303,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); + var expectedUnit = Irradiance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -326,13 +333,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -345,13 +356,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kW/cm²", IrradianceUnit.KilowattPerSquareCentimeter, 4.2)] [InlineData("en-US", "4.2 kW/m²", IrradianceUnit.KilowattPerSquareMeter, 4.2)] @@ -593,7 +608,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Irradi [InlineData("en-US", IrradianceUnit.WattPerSquareMeter, "W/m²")] public void GetAbbreviationForCulture(string culture, IrradianceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Irradiance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Irradiance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -604,7 +619,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Irradiance.GetAbbreviation(unit); + var defaultAbbreviation = Irradiance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs index 52cc06850c..43fb2b05f5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); + var expectedUnit = Irradiation.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Btu/ft²", IrradiationUnit.BtuPerSquareFoot, 4.2)] [InlineData("en-US", "4.2 J/cm²", IrradiationUnit.JoulePerSquareCentimeter, 4.2)] @@ -508,7 +523,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Irradi [InlineData("en-US", IrradiationUnit.WattHourPerSquareMeter, "Wh/m²")] public void GetAbbreviationForCulture(string culture, IrradiationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Irradiation.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Irradiation.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -519,7 +534,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Irradiation.GetAbbreviation(unit); + var defaultAbbreviation = Irradiation.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs index b560a342f4..9f53ed1384 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs @@ -285,15 +285,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); + var expectedUnit = Jerk.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -308,13 +315,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -327,13 +338,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cm/s³", JerkUnit.CentimeterPerSecondCubed, 4.2)] [InlineData("en-US", "4.2 dm/s³", JerkUnit.DecimeterPerSecondCubed, 4.2)] @@ -619,7 +634,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, JerkUn [InlineData("ru-RU", JerkUnit.StandardGravitiesPerSecond, "g/s")] public void GetAbbreviationForCulture(string culture, JerkUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Jerk.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Jerk.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -630,7 +645,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Jerk.GetAbbreviation(unit); + var defaultAbbreviation = Jerk.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs index 62e88d77ad..a266ef3fc8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); + var expectedUnit = KinematicViscosity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cSt", KinematicViscosityUnit.Centistokes, 4.2)] [InlineData("en-US", "4.2 dSt", KinematicViscosityUnit.Decistokes, 4.2)] @@ -564,7 +579,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Kinema [InlineData("ru-RU", KinematicViscosityUnit.Stokes, "Ст")] public void GetAbbreviationForCulture(string culture, KinematicViscosityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = KinematicViscosity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = KinematicViscosity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -575,7 +590,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = KinematicViscosity.GetAbbreviation(unit); + var defaultAbbreviation = KinematicViscosity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs index 2ecd71c630..ffcd7fce37 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs @@ -243,15 +243,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); + var expectedUnit = LeakRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -266,13 +273,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -285,13 +296,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 atm·cm³/s", LeakRateUnit.AtmCubicCentimeterPerSecond, 4.2)] [InlineData("en-US", "4.2 mbar·l/s", LeakRateUnit.MillibarLiterPerSecond, 4.2)] @@ -423,7 +438,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, LeakRa [InlineData("en-US", LeakRateUnit.TorrLiterPerSecond, "Torr·l/s")] public void GetAbbreviationForCulture(string culture, LeakRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = LeakRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = LeakRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -434,7 +449,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = LeakRate.GetAbbreviation(unit); + var defaultAbbreviation = LeakRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs index 815c43e98d..87c6f844c3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs @@ -471,15 +471,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Length(value: 1, unit: Length.BaseUnit); + var expectedUnit = Length.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -494,13 +501,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -513,13 +524,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Å", LengthUnit.Angstrom, 4.2)] [InlineData("en-US", "4.2 A", LengthUnit.Angstrom, 4.2)] @@ -1453,7 +1468,7 @@ public void TryParseUnitWithAmbiguousAbbreviation(string culture, string abbrevi [InlineData("zh-CN", LengthUnit.Yard, "码")] public void GetAbbreviationForCulture(string culture, LengthUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Length.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Length.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1464,7 +1479,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Length.GetAbbreviation(unit); + var defaultAbbreviation = Length.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs index ffa57907a8..c4a9ab5996 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs @@ -172,7 +172,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -190,17 +190,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(LevelUnit.Decibel, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Level(value: 1, unit: LevelUnit.Decibel); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new Level(value: 1, unit: LevelUnit.Decibel); - Assert.Equal(LevelUnit.Decibel, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(LevelUnit.Decibel, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -208,15 +212,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Level(value: 1, unit: Level.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Level(value: 1, unit: Level.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Level(value: 1, unit: Level.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -329,7 +333,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, LevelU [InlineData("en-US", LevelUnit.Neper, "Np")] public void GetAbbreviationForCulture(string culture, LevelUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Level.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Level.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -340,7 +344,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Level.GetAbbreviation(unit); + var defaultAbbreviation = Level.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); @@ -542,7 +546,7 @@ public void Equals_Logarithmic_WithTolerance(double firstValue, double secondVal Assert.True(quantity.Equals(quantity, maxTolerance)); Assert.True(quantity.Equals(otherQuantity, largerTolerance)); Assert.False(quantity.Equals(otherQuantity, smallerTolerance)); - // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) + // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) // Assert.True(quantity.Equals(otherQuantity, maxTolerance)); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs index 2bcbacb628..e1aefb1e06 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs @@ -327,15 +327,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); + var expectedUnit = LinearDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -350,13 +357,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -369,13 +380,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 g/cm", LinearDensityUnit.GramPerCentimeter, 4.2)] [InlineData("en-US", "4.2 g/ft", LinearDensityUnit.GramPerFoot, 4.2)] @@ -661,7 +676,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Linear [InlineData("en-US", LinearDensityUnit.PoundPerInch, "lb/in")] public void GetAbbreviationForCulture(string culture, LinearDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = LinearDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = LinearDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -672,7 +687,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = LinearDensity.GetAbbreviation(unit); + var defaultAbbreviation = LinearDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs index 132da99ab7..a6d15a7a1f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs @@ -369,15 +369,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); + var expectedUnit = LinearPowerDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -392,13 +399,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -411,13 +422,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 GW/cm", LinearPowerDensityUnit.GigawattPerCentimeter, 4.2)] [InlineData("en-US", "4.2 GW/ft", LinearPowerDensityUnit.GigawattPerFoot, 4.2)] @@ -780,7 +795,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Linear [InlineData("en-US", LinearPowerDensityUnit.WattPerMillimeter, "W/mm")] public void GetAbbreviationForCulture(string culture, LinearPowerDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = LinearPowerDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = LinearPowerDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -791,7 +806,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = LinearPowerDensity.GetAbbreviation(unit); + var defaultAbbreviation = LinearPowerDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs index ee02e562e4..275be8e3ba 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs @@ -279,15 +279,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); + var expectedUnit = Luminance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -302,13 +309,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -321,13 +332,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Cd/ft²", LuminanceUnit.CandelaPerSquareFoot, 4.2)] [InlineData("en-US", "4.2 Cd/in²", LuminanceUnit.CandelaPerSquareInch, 4.2)] @@ -525,7 +540,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Lumina [InlineData("en-US", LuminanceUnit.Nit, "nt")] public void GetAbbreviationForCulture(string culture, LuminanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Luminance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Luminance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -536,7 +551,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Luminance.GetAbbreviation(unit); + var defaultAbbreviation = Luminance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs index 36d9d17578..abbf796e70 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs @@ -303,15 +303,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); + var expectedUnit = Luminosity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -326,13 +333,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -345,13 +356,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 daW", LuminosityUnit.Decawatt, 4.2)] [InlineData("en-US", "4.2 dW", LuminosityUnit.Deciwatt, 4.2)] @@ -593,7 +608,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Lumino [InlineData("en-US", LuminosityUnit.Watt, "W")] public void GetAbbreviationForCulture(string culture, LuminosityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Luminosity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Luminosity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -604,7 +619,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Luminosity.GetAbbreviation(unit); + var defaultAbbreviation = Luminosity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs index 4abb983c91..ad85a3bffd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); + var expectedUnit = LuminousFlux.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 lm", LuminousFluxUnit.Lumen, 4.2)] public void Parse(string culture, string quantityString, LuminousFluxUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Lumino [InlineData("en-US", LuminousFluxUnit.Lumen, "lm")] public void GetAbbreviationForCulture(string culture, LuminousFluxUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = LuminousFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = LuminousFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = LuminousFlux.GetAbbreviation(unit); + var defaultAbbreviation = LuminousFlux.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs index 9758f9de08..53f7757c19 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); + var expectedUnit = LuminousIntensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cd", LuminousIntensityUnit.Candela, 4.2)] public void Parse(string culture, string quantityString, LuminousIntensityUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Lumino [InlineData("en-US", LuminousIntensityUnit.Candela, "cd")] public void GetAbbreviationForCulture(string culture, LuminousIntensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = LuminousIntensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = LuminousIntensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = LuminousIntensity.GetAbbreviation(unit); + var defaultAbbreviation = LuminousIntensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs index 52a4237995..bddd0c8be1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); + var expectedUnit = MagneticField.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 G", MagneticFieldUnit.Gauss, 4.2)] [InlineData("en-US", "4.2 µT", MagneticFieldUnit.Microtesla, 4.2)] @@ -457,7 +472,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Magnet [InlineData("en-US", MagneticFieldUnit.Tesla, "T")] public void GetAbbreviationForCulture(string culture, MagneticFieldUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MagneticField.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MagneticField.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -468,7 +483,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MagneticField.GetAbbreviation(unit); + var defaultAbbreviation = MagneticField.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs index aed8c93db0..ecb6c2181c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); + var expectedUnit = MagneticFlux.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Wb", MagneticFluxUnit.Weber, 4.2)] public void Parse(string culture, string quantityString, MagneticFluxUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Magnet [InlineData("en-US", MagneticFluxUnit.Weber, "Wb")] public void GetAbbreviationForCulture(string culture, MagneticFluxUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MagneticFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MagneticFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MagneticFlux.GetAbbreviation(unit); + var defaultAbbreviation = MagneticFlux.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs index dc90c74dd2..e2c077f79c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); + var expectedUnit = Magnetization.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 A/m", MagnetizationUnit.AmperePerMeter, 4.2)] public void Parse(string culture, string quantityString, MagnetizationUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Magnet [InlineData("en-US", MagnetizationUnit.AmperePerMeter, "A/m")] public void GetAbbreviationForCulture(string culture, MagnetizationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Magnetization.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Magnetization.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Magnetization.GetAbbreviation(unit); + var defaultAbbreviation = Magnetization.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs index 923356eb93..0b86db671c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs @@ -513,15 +513,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); + var expectedUnit = MassConcentration.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -536,13 +543,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -555,13 +566,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cg/dl", MassConcentrationUnit.CentigramPerDeciliter, 4.2)] [InlineData("en-US", "4.2 cg/l", MassConcentrationUnit.CentigramPerLiter, 4.2)] @@ -1216,7 +1231,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MassCo [InlineData("ru-RU", MassConcentrationUnit.MilligramPerCubicMeter, "мг/м³")] public void GetAbbreviationForCulture(string culture, MassConcentrationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MassConcentration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MassConcentration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1227,7 +1242,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MassConcentration.GetAbbreviation(unit); + var defaultAbbreviation = MassConcentration.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs index 7d0326f608..3f4cf1e789 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs @@ -417,15 +417,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); + var expectedUnit = MassFlow.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -440,13 +447,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -459,13 +470,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cg/d", MassFlowUnit.CentigramPerDay, 4.2)] [InlineData("en-US", "4.2 cg/s", MassFlowUnit.CentigramPerSecond, 4.2)] @@ -1020,7 +1035,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MassFl [InlineData("ru-RU", MassFlowUnit.KilogramPerMinute, "кг/мин")] public void GetAbbreviationForCulture(string culture, MassFlowUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MassFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MassFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1031,7 +1046,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MassFlow.GetAbbreviation(unit); + var defaultAbbreviation = MassFlow.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs index 65697c156e..42fefa73cc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs @@ -291,15 +291,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); + var expectedUnit = MassFlux.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -314,13 +321,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -333,13 +344,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 g·h⁻¹·cm⁻²", MassFluxUnit.GramPerHourPerSquareCentimeter, 4.2)] [InlineData("en-US", "4.2 g·h⁻¹·m⁻²", MassFluxUnit.GramPerHourPerSquareMeter, 4.2)] @@ -559,7 +574,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MassFl [InlineData("en-US", MassFluxUnit.KilogramPerSecondPerSquareMillimeter, "kg·s⁻¹·mm⁻²")] public void GetAbbreviationForCulture(string culture, MassFluxUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MassFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MassFlux.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -570,7 +585,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MassFlux.GetAbbreviation(unit); + var defaultAbbreviation = MassFlux.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs index 583c878787..b5376d2241 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs @@ -304,7 +304,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -322,17 +322,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(MassFractionUnit.DecimalFraction, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new MassFraction(value: 1, unit: MassFractionUnit.DecimalFraction); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new MassFraction(value: 1, unit: MassFractionUnit.DecimalFraction); - Assert.Equal(MassFractionUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(MassFractionUnit.DecimalFraction, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -340,15 +344,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new MassFraction(value: 1, unit: MassFraction.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new MassFraction(value: 1, unit: MassFraction.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new MassFraction(value: 1, unit: MassFraction.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -713,7 +717,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MassFr [InlineData("en-US", MassFractionUnit.Percent, "%")] public void GetAbbreviationForCulture(string culture, MassFractionUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MassFraction.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MassFraction.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -724,7 +728,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MassFraction.GetAbbreviation(unit); + var defaultAbbreviation = MassFraction.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs index 77d58175ae..6a3d7e67c2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs @@ -387,15 +387,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); + var expectedUnit = MassMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -410,13 +417,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -429,13 +440,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 g·cm²", MassMomentOfInertiaUnit.GramSquareCentimeter, 4.2)] [InlineData("en-US", "4.2 g·dm²", MassMomentOfInertiaUnit.GramSquareDecimeter, 4.2)] @@ -831,7 +846,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MassMo [InlineData("en-US", MassMomentOfInertiaUnit.TonneSquareMillimeter, "t·mm²")] public void GetAbbreviationForCulture(string culture, MassMomentOfInertiaUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MassMomentOfInertia.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MassMomentOfInertia.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -842,7 +857,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MassMomentOfInertia.GetAbbreviation(unit); + var defaultAbbreviation = MassMomentOfInertia.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs index 8a6ee7d588..dcd980f52e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs @@ -381,15 +381,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Mass(value: 1, unit: Mass.BaseUnit); + var expectedUnit = Mass.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -404,13 +411,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -423,13 +434,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cg", MassUnit.Centigram, 4.2)] [InlineData("en-US", "4.2 dag", MassUnit.Decagram, 4.2)] @@ -1185,7 +1200,7 @@ public void TryParseUnitWithAmbiguousAbbreviation(string culture, string abbrevi [InlineData("zh-CN", MassUnit.Tonne, "吨")] public void GetAbbreviationForCulture(string culture, MassUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Mass.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Mass.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1196,7 +1211,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Mass.GetAbbreviation(unit); + var defaultAbbreviation = Mass.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs index ca8967f67a..91e5bea04f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Molality(value: 1, unit: Molality.BaseUnit); + var expectedUnit = Molality.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 mmol/kg", MolalityUnit.MillimolePerKilogram, 4.2)] [InlineData("en-US", "4.2 mol/g", MolalityUnit.MolePerGram, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Molali [InlineData("en-US", MolalityUnit.MolePerKilogram, "mol/kg")] public void GetAbbreviationForCulture(string culture, MolalityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Molality.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Molality.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Molality.GetAbbreviation(unit); + var defaultAbbreviation = Molality.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs index de719d4b11..e58bdb82ab 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); + var expectedUnit = MolarEnergy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 J/mol", MolarEnergyUnit.JoulePerMole, 4.2)] [InlineData("en-US", "4.2 kJ/mol", MolarEnergyUnit.KilojoulePerMole, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MolarE [InlineData("en-US", MolarEnergyUnit.MegajoulePerMole, "MJ/mol")] public void GetAbbreviationForCulture(string culture, MolarEnergyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MolarEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MolarEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MolarEnergy.GetAbbreviation(unit); + var defaultAbbreviation = MolarEnergy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs index d9c5a504a4..05723a7566 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); + var expectedUnit = MolarEntropy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 J/(mol·K)", MolarEntropyUnit.JoulePerMoleKelvin, 4.2)] [InlineData("en-US", "4.2 kJ/(mol·K)", MolarEntropyUnit.KilojoulePerMoleKelvin, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MolarE [InlineData("en-US", MolarEntropyUnit.MegajoulePerMoleKelvin, "MJ/(mol·K)")] public void GetAbbreviationForCulture(string culture, MolarEntropyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MolarEntropy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MolarEntropy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MolarEntropy.GetAbbreviation(unit); + var defaultAbbreviation = MolarEntropy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs index c1a6faad87..50c8526099 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); + var expectedUnit = MolarFlow.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kkmol/h", MolarFlowUnit.KilomolePerHour, 4.2)] [InlineData("en-US", "4.2 kmol/min", MolarFlowUnit.KilomolePerMinute, 4.2)] @@ -508,7 +523,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MolarF [InlineData("en-US", MolarFlowUnit.PoundMolePerSecond, "lbmol/s")] public void GetAbbreviationForCulture(string culture, MolarFlowUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MolarFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MolarFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -519,7 +534,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MolarFlow.GetAbbreviation(unit); + var defaultAbbreviation = MolarFlow.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs index 0ce1268d78..c362bd206e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs @@ -297,15 +297,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); + var expectedUnit = MolarMass.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -320,13 +327,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -339,13 +350,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cg/mol", MolarMassUnit.CentigramPerMole, 4.2)] [InlineData("en-US", "4.2 dag/mol", MolarMassUnit.DecagramPerMole, 4.2)] @@ -660,7 +675,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, MolarM [InlineData("ru-RU", MolarMassUnit.PoundPerMole, "фунт/моль")] public void GetAbbreviationForCulture(string culture, MolarMassUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = MolarMass.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = MolarMass.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -671,7 +686,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = MolarMass.GetAbbreviation(unit); + var defaultAbbreviation = MolarMass.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs index 359d0c9f88..a4629f2cc3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs @@ -285,15 +285,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); + var expectedUnit = Molarity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -308,13 +315,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -327,13 +338,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cmol/l", MolarityUnit.CentimolePerLiter, 4.2)] [InlineData("en-US", "4.2 cM", MolarityUnit.CentimolePerLiter, 4.2)] @@ -622,7 +637,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Molari [InlineData("en-US", MolarityUnit.PoundMolePerCubicFoot, "lbmol/ft³")] public void GetAbbreviationForCulture(string culture, MolarityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Molarity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Molarity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -633,7 +648,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Molarity.GetAbbreviation(unit); + var defaultAbbreviation = Molarity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs index ea51af65ed..dd3e7d992b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); + var expectedUnit = Permeability.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 H/m", PermeabilityUnit.HenryPerMeter, 4.2)] public void Parse(string culture, string quantityString, PermeabilityUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Permea [InlineData("en-US", PermeabilityUnit.HenryPerMeter, "H/m")] public void GetAbbreviationForCulture(string culture, PermeabilityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Permeability.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Permeability.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Permeability.GetAbbreviation(unit); + var defaultAbbreviation = Permeability.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs index 3aa330660f..b5e7c23e25 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs @@ -225,15 +225,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); + var expectedUnit = Permittivity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -248,13 +255,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -267,13 +278,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 F/m", PermittivityUnit.FaradPerMeter, 4.2)] public void Parse(string culture, string quantityString, PermittivityUnit expectedUnit, double expectedValue) @@ -372,7 +387,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Permit [InlineData("en-US", PermittivityUnit.FaradPerMeter, "F/m")] public void GetAbbreviationForCulture(string culture, PermittivityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Permittivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Permittivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -383,7 +398,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Permittivity.GetAbbreviation(unit); + var defaultAbbreviation = Permittivity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs index b269407e13..d9a36061e2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs @@ -249,15 +249,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); + var expectedUnit = PorousMediumPermeability.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -272,13 +279,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -291,13 +302,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 D", PorousMediumPermeabilityUnit.Darcy, 4.2)] [InlineData("en-US", "4.2 µD", PorousMediumPermeabilityUnit.Microdarcy, 4.2)] @@ -440,7 +455,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Porous [InlineData("en-US", PorousMediumPermeabilityUnit.SquareMeter, "m²")] public void GetAbbreviationForCulture(string culture, PorousMediumPermeabilityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = PorousMediumPermeability.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = PorousMediumPermeability.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -451,7 +466,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = PorousMediumPermeability.GetAbbreviation(unit); + var defaultAbbreviation = PorousMediumPermeability.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs index aeac9f35fa..1475159d31 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs @@ -483,15 +483,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); + var expectedUnit = PowerDensity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -506,13 +513,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -525,13 +536,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 daW/ft³", PowerDensityUnit.DecawattPerCubicFoot, 4.2)] [InlineData("en-US", "4.2 daW/in³", PowerDensityUnit.DecawattPerCubicInch, 4.2)] @@ -1103,7 +1118,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, PowerD [InlineData("en-US", PowerDensityUnit.WattPerLiter, "W/l")] public void GetAbbreviationForCulture(string culture, PowerDensityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = PowerDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = PowerDensity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1114,7 +1129,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = PowerDensity.GetAbbreviation(unit); + var defaultAbbreviation = PowerDensity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs index 5814633c88..7513a7b1b6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs @@ -172,7 +172,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -190,17 +190,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(PowerRatioUnit.DecibelWatt, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatioUnit.DecibelWatt); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatioUnit.DecibelWatt); - Assert.Equal(PowerRatioUnit.DecibelWatt, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(PowerRatioUnit.DecibelWatt, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -208,15 +212,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new PowerRatio(value: 1, unit: PowerRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -339,7 +343,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, PowerR [InlineData("en-US", PowerRatioUnit.DecibelWatt, "dBW")] public void GetAbbreviationForCulture(string culture, PowerRatioUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = PowerRatio.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = PowerRatio.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -350,7 +354,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = PowerRatio.GetAbbreviation(unit); + var defaultAbbreviation = PowerRatio.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); @@ -552,7 +556,7 @@ public void Equals_Logarithmic_WithTolerance(double firstValue, double secondVal Assert.True(quantity.Equals(quantity, maxTolerance)); Assert.True(quantity.Equals(otherQuantity, largerTolerance)); Assert.False(quantity.Equals(otherQuantity, smallerTolerance)); - // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) + // note: it's currently not possible to test this due to the rounding error from (quantity - otherQuantity) // Assert.True(quantity.Equals(otherQuantity, maxTolerance)); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs index 4743c9bbf4..019f737688 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs @@ -381,15 +381,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Power(value: 1, unit: Power.BaseUnit); + var expectedUnit = Power.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -404,13 +411,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -423,13 +434,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 hp(S)", PowerUnit.BoilerHorsepower, 4.2)] [InlineData("en-US", "4.2 Btu/h", PowerUnit.BritishThermalUnitPerHour, 4.2)] @@ -844,7 +859,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, PowerU [InlineData("en-US", PowerUnit.Watt, "W")] public void GetAbbreviationForCulture(string culture, PowerUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Power.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Power.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -855,7 +870,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Power.GetAbbreviation(unit); + var defaultAbbreviation = Power.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs index c7cdcf8619..58bbc5f79e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs @@ -327,15 +327,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); + var expectedUnit = PressureChangeRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -350,13 +357,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -369,13 +380,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 atm/s", PressureChangeRateUnit.AtmospherePerSecond, 4.2)] [InlineData("en-US", "4.2 bar/min", PressureChangeRateUnit.BarPerMinute, 4.2)] @@ -883,7 +898,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Pressu [InlineData("ru-RU", PressureChangeRateUnit.PoundForcePerSquareInchPerSecond, "psi/с")] public void GetAbbreviationForCulture(string culture, PressureChangeRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = PressureChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = PressureChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -894,7 +909,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = PressureChangeRate.GetAbbreviation(unit); + var defaultAbbreviation = PressureChangeRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs index 95606cfe2a..f114311222 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs @@ -507,15 +507,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); + var expectedUnit = Pressure.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -530,13 +537,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -549,13 +560,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 atm", PressureUnit.Atmosphere, 4.2)] [InlineData("en-US", "4.2 bar", PressureUnit.Bar, 4.2)] @@ -1557,7 +1572,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Pressu [InlineData("ru-RU", PressureUnit.Torr, "торр")] public void GetAbbreviationForCulture(string culture, PressureUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Pressure.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Pressure.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1568,7 +1583,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Pressure.GetAbbreviation(unit); + var defaultAbbreviation = Pressure.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs index 8afdf3b88b..853f666c56 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs @@ -279,15 +279,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); + var expectedUnit = RadiationEquivalentDoseRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -302,13 +309,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -321,13 +332,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 µSv/h", RadiationEquivalentDoseRateUnit.MicrosievertPerHour, 4.2)] [InlineData("en-US", "4.2 µSv/s", RadiationEquivalentDoseRateUnit.MicrosievertPerSecond, 4.2)] @@ -581,7 +596,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Radiat [InlineData("ru-RU", RadiationEquivalentDoseRateUnit.SievertPerSecond, "Зв/с")] public void GetAbbreviationForCulture(string culture, RadiationEquivalentDoseRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RadiationEquivalentDoseRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RadiationEquivalentDoseRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -592,7 +607,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RadiationEquivalentDoseRate.GetAbbreviation(unit); + var defaultAbbreviation = RadiationEquivalentDoseRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs index e8dc49e1ef..9843da0078 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); + var expectedUnit = RadiationEquivalentDose.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 µSv", RadiationEquivalentDoseUnit.Microsievert, 4.2)] [InlineData("en-US", "4.2 mrem", RadiationEquivalentDoseUnit.MilliroentgenEquivalentMan, 4.2)] @@ -485,7 +500,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Radiat [InlineData("ru-RU", RadiationEquivalentDoseUnit.Sievert, "Зв")] public void GetAbbreviationForCulture(string culture, RadiationEquivalentDoseUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RadiationEquivalentDose.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RadiationEquivalentDose.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -496,7 +511,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RadiationEquivalentDose.GetAbbreviation(unit); + var defaultAbbreviation = RadiationEquivalentDose.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs index 94f03bf78a..d06f0a9c15 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs @@ -267,15 +267,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); + var expectedUnit = RadiationExposure.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -290,13 +297,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -309,13 +320,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 C/kg", RadiationExposureUnit.CoulombPerKilogram, 4.2)] [InlineData("en-US", "4.2 µC/kg", RadiationExposureUnit.MicrocoulombPerKilogram, 4.2)] @@ -491,7 +506,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Radiat [InlineData("en-US", RadiationExposureUnit.Roentgen, "R")] public void GetAbbreviationForCulture(string culture, RadiationExposureUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RadiationExposure.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RadiationExposure.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -502,7 +517,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RadiationExposure.GetAbbreviation(unit); + var defaultAbbreviation = RadiationExposure.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs index 3330ad92e5..efd0e9d023 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs @@ -393,15 +393,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); + var expectedUnit = Radioactivity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -416,13 +423,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -435,13 +446,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Bq", RadioactivityUnit.Becquerel, 4.2)] [InlineData("en-US", "4.2 Ci", RadioactivityUnit.Curie, 4.2)] @@ -1051,7 +1066,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Radioa [InlineData("ru-RU", RadioactivityUnit.Terarutherford, "ТРд")] public void GetAbbreviationForCulture(string culture, RadioactivityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Radioactivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Radioactivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1062,7 +1077,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Radioactivity.GetAbbreviation(unit); + var defaultAbbreviation = Radioactivity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs index 1ef1b53086..36dfb06b4c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs @@ -231,15 +231,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); + var expectedUnit = RatioChangeRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -254,13 +261,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -273,13 +284,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 /s", RatioChangeRateUnit.DecimalFractionPerSecond, 4.2)] [InlineData("en-US", "4.2 %/s", RatioChangeRateUnit.PercentPerSecond, 4.2)] @@ -389,7 +404,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, RatioC [InlineData("en-US", RatioChangeRateUnit.PercentPerSecond, "%/s")] public void GetAbbreviationForCulture(string culture, RatioChangeRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RatioChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RatioChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -400,7 +415,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RatioChangeRate.GetAbbreviation(unit); + var defaultAbbreviation = RatioChangeRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs index 083c643bf9..4ef0e01c09 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs @@ -196,7 +196,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -214,17 +214,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(RatioUnit.DecimalFraction, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Ratio(value: 1, unit: RatioUnit.DecimalFraction); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new Ratio(value: 1, unit: RatioUnit.DecimalFraction); - Assert.Equal(RatioUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(RatioUnit.DecimalFraction, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -232,15 +236,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Ratio(value: 1, unit: Ratio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Ratio(value: 1, unit: Ratio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Ratio(value: 1, unit: Ratio.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -397,7 +401,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, RatioU [InlineData("en-US", RatioUnit.Percent, "%")] public void GetAbbreviationForCulture(string culture, RatioUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Ratio.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Ratio.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -408,7 +412,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Ratio.GetAbbreviation(unit); + var defaultAbbreviation = Ratio.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs index 5473f6b620..ed63618499 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs @@ -285,15 +285,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); + var expectedUnit = ReciprocalArea.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -308,13 +315,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -327,13 +338,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cm⁻²", ReciprocalAreaUnit.InverseSquareCentimeter, 4.2)] [InlineData("en-US", "4.2 dm⁻²", ReciprocalAreaUnit.InverseSquareDecimeter, 4.2)] @@ -542,7 +557,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Recipr [InlineData("en-US", ReciprocalAreaUnit.InverseUsSurveySquareFoot, "ft⁻² (US)")] public void GetAbbreviationForCulture(string culture, ReciprocalAreaUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ReciprocalArea.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ReciprocalArea.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -553,7 +568,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ReciprocalArea.GetAbbreviation(unit); + var defaultAbbreviation = ReciprocalArea.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs index 79fa55a38e..44ee29db22 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs @@ -279,15 +279,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); + var expectedUnit = ReciprocalLength.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -302,13 +309,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -321,13 +332,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cm⁻¹", ReciprocalLengthUnit.InverseCentimeter, 4.2)] [InlineData("en-US", "4.2 1/cm", ReciprocalLengthUnit.InverseCentimeter, 4.2)] @@ -625,7 +640,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Recipr [InlineData("en-US", ReciprocalLengthUnit.InverseYard, "yd⁻¹")] public void GetAbbreviationForCulture(string culture, ReciprocalLengthUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ReciprocalLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ReciprocalLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -636,7 +651,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ReciprocalLength.GetAbbreviation(unit); + var defaultAbbreviation = ReciprocalLength.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs index eb2dfe961c..39ea08d040 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs @@ -166,7 +166,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -184,17 +184,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(RelativeHumidityUnit.Percent, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidityUnit.Percent); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidityUnit.Percent); - Assert.Equal(RelativeHumidityUnit.Percent, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(RelativeHumidityUnit.Percent, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -202,15 +206,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new RelativeHumidity(value: 1, unit: RelativeHumidity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -312,7 +316,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Relati [InlineData("en-US", RelativeHumidityUnit.Percent, "%RH")] public void GetAbbreviationForCulture(string culture, RelativeHumidityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RelativeHumidity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RelativeHumidity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -323,7 +327,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RelativeHumidity.GetAbbreviation(unit); + var defaultAbbreviation = RelativeHumidity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs index 03fa7f54df..a645f1c64e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs @@ -243,15 +243,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); + var expectedUnit = RotationalAcceleration.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -266,13 +273,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -285,13 +296,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 °/s²", RotationalAccelerationUnit.DegreePerSecondSquared, 4.2)] [InlineData("en-US", "4.2 deg/s²", RotationalAccelerationUnit.DegreePerSecondSquared, 4.2)] @@ -433,7 +448,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Rotati [InlineData("en-US", RotationalAccelerationUnit.RevolutionPerSecondSquared, "r/s²")] public void GetAbbreviationForCulture(string culture, RotationalAccelerationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RotationalAcceleration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RotationalAcceleration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -444,7 +459,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RotationalAcceleration.GetAbbreviation(unit); + var defaultAbbreviation = RotationalAcceleration.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs index 1bc497f5f2..3a461453b1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs @@ -297,15 +297,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); + var expectedUnit = RotationalSpeed.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -320,13 +327,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -339,13 +350,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 crad/s", RotationalSpeedUnit.CentiradianPerSecond, 4.2)] [InlineData("en-US", "4.2 drad/s", RotationalSpeedUnit.DeciradianPerSecond, 4.2)] @@ -720,7 +735,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Rotati [InlineData("ru-RU", RotationalSpeedUnit.RevolutionPerSecond, "об/с")] public void GetAbbreviationForCulture(string culture, RotationalSpeedUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RotationalSpeed.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RotationalSpeed.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -731,7 +746,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RotationalSpeed.GetAbbreviation(unit); + var defaultAbbreviation = RotationalSpeed.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs index b6e31ffbf7..4476506dee 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs @@ -249,15 +249,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); + var expectedUnit = RotationalStiffnessPerLength.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -272,13 +279,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -291,13 +302,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kN·m/rad/m", RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, 4.2)] [InlineData("en-US", "4.2 kNm/rad/m", RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, 4.2)] @@ -520,7 +535,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Rotati [InlineData("en-US", RotationalStiffnessPerLengthUnit.PoundForceFootPerDegreesPerFoot, "lbf·ft/deg/ft")] public void GetAbbreviationForCulture(string culture, RotationalStiffnessPerLengthUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RotationalStiffnessPerLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RotationalStiffnessPerLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -531,7 +546,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RotationalStiffnessPerLength.GetAbbreviation(unit); + var defaultAbbreviation = RotationalStiffnessPerLength.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs index 0a1a1e7914..b34f37bff5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs @@ -417,15 +417,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); + var expectedUnit = RotationalStiffness.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -440,13 +447,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -459,13 +470,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cN·m/deg", RotationalStiffnessUnit.CentinewtonMeterPerDegree, 4.2)] [InlineData("en-US", "4.2 cNm/deg", RotationalStiffnessUnit.CentinewtonMeterPerDegree, 4.2)] @@ -1626,7 +1641,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Rotati [InlineData("en-US", RotationalStiffnessUnit.PoundForceFootPerDegrees, "lbf·ft/deg")] public void GetAbbreviationForCulture(string culture, RotationalStiffnessUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = RotationalStiffness.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = RotationalStiffness.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1637,7 +1652,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = RotationalStiffness.GetAbbreviation(unit); + var defaultAbbreviation = RotationalStiffness.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs index 7c06184d2f..1f54fd133e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs @@ -166,7 +166,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -184,17 +184,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(ScalarUnit.Amount, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Scalar(value: 1, unit: ScalarUnit.Amount); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new Scalar(value: 1, unit: ScalarUnit.Amount); - Assert.Equal(ScalarUnit.Amount, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(ScalarUnit.Amount, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -202,15 +206,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Scalar(value: 1, unit: Scalar.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Scalar(value: 1, unit: Scalar.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Scalar(value: 1, unit: Scalar.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -312,7 +316,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Scalar [InlineData("en-US", ScalarUnit.Amount, "")] public void GetAbbreviationForCulture(string culture, ScalarUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Scalar.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Scalar.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -323,7 +327,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Scalar.GetAbbreviation(unit); + var defaultAbbreviation = Scalar.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs index fbb666edf0..94c0841489 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs @@ -166,7 +166,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -184,17 +184,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(SolidAngleUnit.Steradian, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngleUnit.Steradian); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngleUnit.Steradian); - Assert.Equal(SolidAngleUnit.Steradian, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(SolidAngleUnit.Steradian, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -202,15 +206,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new SolidAngle(value: 1, unit: SolidAngle.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngle.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngle.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -312,7 +316,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, SolidA [InlineData("en-US", SolidAngleUnit.Steradian, "sr")] public void GetAbbreviationForCulture(string culture, SolidAngleUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = SolidAngle.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = SolidAngle.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -323,7 +327,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = SolidAngle.GetAbbreviation(unit); + var defaultAbbreviation = SolidAngle.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs index 814dce6411..2f40fb2cd4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs @@ -399,15 +399,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); + var expectedUnit = SpecificEnergy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -422,13 +429,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -441,13 +452,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 btu/lb", SpecificEnergyUnit.BtuPerPound, 4.2)] [InlineData("en-US", "4.2 cal/g", SpecificEnergyUnit.CaloriePerGram, 4.2)] @@ -865,7 +880,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Specif [InlineData("en-US", SpecificEnergyUnit.WattHourPerPound, "Wh/lbs")] public void GetAbbreviationForCulture(string culture, SpecificEnergyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = SpecificEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = SpecificEnergy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -876,7 +891,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = SpecificEnergy.GetAbbreviation(unit); + var defaultAbbreviation = SpecificEnergy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs index bb181c5b8f..8040152232 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); + var expectedUnit = SpecificEntropy.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 BTU/(lb·°F)", SpecificEntropyUnit.BtuPerPoundFahrenheit, 4.2)] [InlineData("en-US", "4.2 BTU/(lbm·°F)", SpecificEntropyUnit.BtuPerPoundFahrenheit, 4.2)] @@ -518,7 +533,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Specif [InlineData("en-US", SpecificEntropyUnit.MegajoulePerKilogramKelvin, "MJ/kg·K")] public void GetAbbreviationForCulture(string culture, SpecificEntropyUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = SpecificEntropy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = SpecificEntropy.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -529,7 +544,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = SpecificEntropy.GetAbbreviation(unit); + var defaultAbbreviation = SpecificEntropy.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs index 52040a2248..979bae642e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs @@ -243,15 +243,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); + var expectedUnit = SpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -266,13 +273,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -285,13 +296,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 g/(kN·s)", SpecificFuelConsumptionUnit.GramPerKilonewtonSecond, 4.2)] [InlineData("en-US", "4.2 kg/(kgf·h)", SpecificFuelConsumptionUnit.KilogramPerKilogramForceHour, 4.2)] @@ -423,7 +438,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Specif [InlineData("en-US", SpecificFuelConsumptionUnit.PoundMassPerPoundForceHour, "lb/(lbf·h)")] public void GetAbbreviationForCulture(string culture, SpecificFuelConsumptionUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = SpecificFuelConsumption.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = SpecificFuelConsumption.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -434,7 +449,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = SpecificFuelConsumption.GetAbbreviation(unit); + var defaultAbbreviation = SpecificFuelConsumption.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs index 605ae62907..8df06be443 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs @@ -237,15 +237,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); + var expectedUnit = SpecificVolume.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -260,13 +267,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -279,13 +290,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 ft³/lb", SpecificVolumeUnit.CubicFootPerPound, 4.2)] [InlineData("en-US", "4.2 m³/kg", SpecificVolumeUnit.CubicMeterPerKilogram, 4.2)] @@ -406,7 +421,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Specif [InlineData("en-US", SpecificVolumeUnit.MillicubicMeterPerKilogram, "mm³/kg")] public void GetAbbreviationForCulture(string culture, SpecificVolumeUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = SpecificVolume.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = SpecificVolume.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -417,7 +432,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = SpecificVolume.GetAbbreviation(unit); + var defaultAbbreviation = SpecificVolume.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs index cc17b14ebd..1054c5e3a6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs @@ -321,15 +321,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); + var expectedUnit = SpecificWeight.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -344,13 +351,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -363,13 +374,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 kgf/cm³", SpecificWeightUnit.KilogramForcePerCubicCentimeter, 4.2)] [InlineData("en-US", "4.2 kgf/m³", SpecificWeightUnit.KilogramForcePerCubicMeter, 4.2)] @@ -644,7 +659,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Specif [InlineData("en-US", SpecificWeightUnit.TonneForcePerCubicMillimeter, "tf/mm³")] public void GetAbbreviationForCulture(string culture, SpecificWeightUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = SpecificWeight.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = SpecificWeight.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -655,7 +670,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = SpecificWeight.GetAbbreviation(unit); + var defaultAbbreviation = SpecificWeight.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs index 00b8bdda32..47eef6f922 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs @@ -417,15 +417,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Speed(value: 1, unit: Speed.BaseUnit); + var expectedUnit = Speed.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -440,13 +447,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -459,13 +470,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cm/h", SpeedUnit.CentimeterPerHour, 4.2)] [InlineData("en-US", "4.2 cm/min", SpeedUnit.CentimeterPerMinute, 4.2)] @@ -1144,7 +1159,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, SpeedU [InlineData("ru-RU", SpeedUnit.NanometerPerSecond, "нм/с")] public void GetAbbreviationForCulture(string culture, SpeedUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Speed.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Speed.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1155,7 +1170,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Speed.GetAbbreviation(unit); + var defaultAbbreviation = Speed.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs index 1408f7f611..94d885f76a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); + var expectedUnit = StandardVolumeFlow.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 sccm", StandardVolumeFlowUnit.StandardCubicCentimeterPerMinute, 4.2)] [InlineData("en-US", "4.2 scfh", StandardVolumeFlowUnit.StandardCubicFootPerHour, 4.2)] @@ -508,7 +523,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Standa [InlineData("en-US", StandardVolumeFlowUnit.StandardLiterPerMinute, "slm")] public void GetAbbreviationForCulture(string culture, StandardVolumeFlowUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = StandardVolumeFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = StandardVolumeFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -519,7 +534,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = StandardVolumeFlow.GetAbbreviation(unit); + var defaultAbbreviation = StandardVolumeFlow.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs index bcfbcb8b46..788be1f68e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs @@ -321,15 +321,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); + var expectedUnit = TemperatureChangeRate.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -344,13 +351,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -363,13 +374,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 c°C/s", TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, 4.2)] [InlineData("en-US", "4.2 da°C/s", TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, 4.2)] @@ -644,7 +659,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Temper [InlineData("en-US", TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, "n°C/s")] public void GetAbbreviationForCulture(string culture, TemperatureChangeRateUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = TemperatureChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = TemperatureChangeRate.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -655,7 +670,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = TemperatureChangeRate.GetAbbreviation(unit); + var defaultAbbreviation = TemperatureChangeRate.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs index 1aae87ef4f..c925dc6c16 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); + var expectedUnit = TemperatureDelta.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 ∆°C", TemperatureDeltaUnit.DegreeCelsius, 4.2)] [InlineData("en-US", "4.2 ∆°De", TemperatureDeltaUnit.DegreeDelisle, 4.2)] @@ -508,7 +523,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Temper [InlineData("en-US", TemperatureDeltaUnit.MillidegreeCelsius, "∆m°C")] public void GetAbbreviationForCulture(string culture, TemperatureDeltaUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = TemperatureDelta.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = TemperatureDelta.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -519,7 +534,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = TemperatureDelta.GetAbbreviation(unit); + var defaultAbbreviation = TemperatureDelta.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs index 0a2f9cd54a..66556a64a5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs @@ -243,15 +243,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); + var expectedUnit = TemperatureGradient.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -266,13 +273,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -285,13 +296,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 ∆°C/km", TemperatureGradientUnit.DegreeCelsiusPerKilometer, 4.2)] [InlineData("en-US", "4.2 ∆°C/m", TemperatureGradientUnit.DegreeCelsiusPerMeter, 4.2)] @@ -423,7 +438,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Temper [InlineData("en-US", TemperatureGradientUnit.KelvinPerMeter, "∆°K/m")] public void GetAbbreviationForCulture(string culture, TemperatureGradientUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = TemperatureGradient.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = TemperatureGradient.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -434,7 +449,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = TemperatureGradient.GetAbbreviation(unit); + var defaultAbbreviation = TemperatureGradient.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs index 6b545e8793..4089dd3385 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs @@ -279,15 +279,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); + var expectedUnit = Temperature.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -302,13 +309,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -321,13 +332,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 °C", TemperatureUnit.DegreeCelsius, 4.2)] [InlineData("en-US", "4.2 °De", TemperatureUnit.DegreeDelisle, 4.2)] @@ -525,7 +540,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Temper [InlineData("en-US", TemperatureUnit.SolarTemperature, "T⊙")] public void GetAbbreviationForCulture(string culture, TemperatureUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Temperature.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Temperature.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -536,7 +551,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Temperature.GetAbbreviation(unit); + var defaultAbbreviation = Temperature.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs index 1f8bf1aa08..c0e8f53671 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs @@ -231,15 +231,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); + var expectedUnit = ThermalConductivity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -254,13 +261,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -273,13 +284,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 BTU/(h·ft·°F)", ThermalConductivityUnit.BtuPerHourFootFahrenheit, 4.2)] [InlineData("en-US", "4.2 W/(m·K)", ThermalConductivityUnit.WattPerMeterKelvin, 4.2)] @@ -389,7 +404,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Therma [InlineData("en-US", ThermalConductivityUnit.WattPerMeterKelvin, "W/(m·K)")] public void GetAbbreviationForCulture(string culture, ThermalConductivityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ThermalConductivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ThermalConductivity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -400,7 +415,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ThermalConductivity.GetAbbreviation(unit); + var defaultAbbreviation = ThermalConductivity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs index 7861a39a38..fb4d924e54 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs @@ -261,15 +261,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); + var expectedUnit = ThermalInsulance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -284,13 +291,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -303,13 +314,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 Hrft²°F/Btu", ThermalInsulanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, 4.2)] [InlineData("en-US", "4.2 cm²Hr°C/kcal", ThermalInsulanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, 4.2)] @@ -474,7 +489,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Therma [InlineData("en-US", ThermalInsulanceUnit.SquareMillimeterKelvinPerWatt, "mm²K/W")] public void GetAbbreviationForCulture(string culture, ThermalInsulanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ThermalInsulance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ThermalInsulance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -485,7 +500,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ThermalInsulance.GetAbbreviation(unit); + var defaultAbbreviation = ThermalInsulance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs index ce5b48fa83..ade3c3299a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs @@ -231,15 +231,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); + var expectedUnit = ThermalResistance.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -254,13 +261,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -273,13 +284,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 °C/W", ThermalResistanceUnit.DegreeCelsiusPerWatt, 4.2)] [InlineData("en-US", "4.2 K/W", ThermalResistanceUnit.KelvinPerWatt, 4.2)] @@ -389,7 +404,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Therma [InlineData("en-US", ThermalResistanceUnit.KelvinPerWatt, "K/W")] public void GetAbbreviationForCulture(string culture, ThermalResistanceUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = ThermalResistance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = ThermalResistance.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -400,7 +415,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = ThermalResistance.GetAbbreviation(unit); + var defaultAbbreviation = ThermalResistance.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs index 3439442851..b586c6fc94 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs @@ -369,15 +369,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Torque(value: 1, unit: Torque.BaseUnit); + var expectedUnit = Torque.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -392,13 +399,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -411,13 +422,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 gf·cm", TorqueUnit.GramForceCentimeter, 4.2)] [InlineData("en-US", "4.2 gf·m", TorqueUnit.GramForceMeter, 4.2)] @@ -801,7 +816,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Torque [InlineData("ru-RU", TorqueUnit.NewtonMeter, "Н·м")] public void GetAbbreviationForCulture(string culture, TorqueUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Torque.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Torque.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -812,7 +827,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Torque.GetAbbreviation(unit); + var defaultAbbreviation = Torque.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs index 4b2dff426d..7e32f23ea6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs @@ -166,7 +166,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -184,17 +184,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(TurbidityUnit.NTU, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Turbidity(value: 1, unit: TurbidityUnit.NTU); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new Turbidity(value: 1, unit: TurbidityUnit.NTU); - Assert.Equal(TurbidityUnit.NTU, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(TurbidityUnit.NTU, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -202,15 +206,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Turbidity(value: 1, unit: Turbidity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Turbidity(value: 1, unit: Turbidity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new Turbidity(value: 1, unit: Turbidity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -312,7 +316,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Turbid [InlineData("en-US", TurbidityUnit.NTU, "NTU")] public void GetAbbreviationForCulture(string culture, TurbidityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Turbidity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Turbidity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -323,7 +327,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Turbidity.GetAbbreviation(unit); + var defaultAbbreviation = Turbidity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs index c828b4ca4e..7b2e7531e8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs @@ -166,7 +166,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -184,17 +184,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(VitaminAUnit.InternationalUnit, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new VitaminA(value: 1, unit: VitaminAUnit.InternationalUnit); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new VitaminA(value: 1, unit: VitaminAUnit.InternationalUnit); - Assert.Equal(VitaminAUnit.InternationalUnit, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(VitaminAUnit.InternationalUnit, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -202,15 +206,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new VitaminA(value: 1, unit: VitaminA.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new VitaminA(value: 1, unit: VitaminA.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new VitaminA(value: 1, unit: VitaminA.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -312,7 +316,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Vitami [InlineData("en-US", VitaminAUnit.InternationalUnit, "IU")] public void GetAbbreviationForCulture(string culture, VitaminAUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = VitaminA.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = VitaminA.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -323,7 +327,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = VitaminA.GetAbbreviation(unit); + var defaultAbbreviation = VitaminA.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs index ed2149ad5a..c97d44f366 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs @@ -280,7 +280,7 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() } [Fact] - public void ToUnitSystem_ReturnsValueInDimensionlessUnit() + public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { Assert.Multiple(() => { @@ -298,17 +298,21 @@ public void ToUnitSystem_ReturnsValueInDimensionlessUnit() Assert.Equal(VolumeConcentrationUnit.DecimalFraction, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentrationUnit.DecimalFraction); + }); + } - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); + [Fact] + public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() + { + IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentrationUnit.DecimalFraction); - Assert.Equal(VolumeConcentrationUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(VolumeConcentrationUnit.DecimalFraction, convertedQuantity.Unit); + Assert.Equal(quantity.Value, convertedQuantity.Value); } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -316,15 +320,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new VolumeConcentration(value: 1, unit: VolumeConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }, () => { IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); }); } @@ -645,7 +649,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Volume [InlineData("en-US", VolumeConcentrationUnit.PicoliterPerMilliliter, "pl/ml")] public void GetAbbreviationForCulture(string culture, VolumeConcentrationUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = VolumeConcentration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = VolumeConcentration.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -656,7 +660,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = VolumeConcentration.GetAbbreviation(unit); + var defaultAbbreviation = VolumeConcentration.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs index 3fb320fae5..22e27ec17b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs @@ -231,15 +231,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); + var expectedUnit = VolumeFlowPerArea.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -254,13 +261,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -273,13 +284,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 CFM/ft²", VolumeFlowPerAreaUnit.CubicFootPerMinutePerSquareFoot, 4.2)] [InlineData("en-US", "4.2 m³/(s·m²)", VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter, 4.2)] @@ -389,7 +404,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Volume [InlineData("en-US", VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter, "m³/(s·m²)")] public void GetAbbreviationForCulture(string culture, VolumeFlowPerAreaUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = VolumeFlowPerArea.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = VolumeFlowPerArea.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -400,7 +415,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = VolumeFlowPerArea.GetAbbreviation(unit); + var defaultAbbreviation = VolumeFlowPerArea.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs index e3817d335e..59c0b08949 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs @@ -669,15 +669,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); + var expectedUnit = VolumeFlow.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -692,13 +699,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -711,13 +722,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 af/d", VolumeFlowUnit.AcreFootPerDay, 4.2)] [InlineData("en-US", "4.2 af/h", VolumeFlowUnit.AcreFootPerHour, 4.2)] @@ -2472,7 +2487,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Volume [InlineData("ru-RU", VolumeFlowUnit.NanoliterPerSecond, "нл/c")] public void GetAbbreviationForCulture(string culture, VolumeFlowUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = VolumeFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = VolumeFlow.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -2483,7 +2498,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = VolumeFlow.GetAbbreviation(unit); + var defaultAbbreviation = VolumeFlow.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs index 45261aeb84..adacb16522 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); + var expectedUnit = VolumePerLength.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 m³/m", VolumePerLengthUnit.CubicMeterPerMeter, 4.2)] [InlineData("en-US", "4.2 yd³/ft", VolumePerLengthUnit.CubicYardPerFoot, 4.2)] @@ -508,7 +523,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Volume [InlineData("en-US", VolumePerLengthUnit.UsGallonPerMile, "gal (U.S.)/mi")] public void GetAbbreviationForCulture(string culture, VolumePerLengthUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = VolumePerLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = VolumePerLength.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -519,7 +534,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = VolumePerLength.GetAbbreviation(unit); + var defaultAbbreviation = VolumePerLength.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index 4058db5b30..722934ede4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -543,15 +543,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Volume(value: 1, unit: Volume.BaseUnit); + var expectedUnit = Volume.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -566,13 +573,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -585,13 +596,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 ac-ft", VolumeUnit.AcreFoot, 4.2)] [InlineData("en-US", "4.2 acre-foot", VolumeUnit.AcreFoot, 4.2)] @@ -1677,7 +1692,7 @@ public void TryParseUnitWithAmbiguousAbbreviation(string culture, string abbrevi [InlineData("ru-RU", VolumeUnit.UsOunce, "Американская унция")] public void GetAbbreviationForCulture(string culture, VolumeUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = Volume.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = Volume.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -1688,7 +1703,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = Volume.GetAbbreviation(unit); + var defaultAbbreviation = Volume.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs index 90506fe37b..8131c30e42 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs @@ -273,15 +273,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); + var expectedUnit = VolumetricHeatCapacity.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -296,13 +303,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -315,13 +326,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 BTU/(ft³·°F)", VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, 4.2)] [InlineData("en-US", "4.2 cal/(cm³·°C)", VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, 4.2)] @@ -508,7 +523,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Volume [InlineData("en-US", VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, "MJ/(m³·K)")] public void GetAbbreviationForCulture(string culture, VolumetricHeatCapacityUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = VolumetricHeatCapacity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = VolumetricHeatCapacity.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -519,7 +534,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = VolumetricHeatCapacity.GetAbbreviation(unit); + var defaultAbbreviation = VolumetricHeatCapacity.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs index caf640fa9a..0c50f81a2c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs @@ -255,15 +255,22 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; + }); + } + + [Fact] + public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); + var expectedUnit = WarpingMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + IQuantity quantityToConvert = quantity; - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); + IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); } [Fact] @@ -278,13 +285,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + } + [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { @@ -297,13 +308,17 @@ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }); } + [Fact] + public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); + IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + } + [Theory] [InlineData("en-US", "4.2 cm⁶", WarpingMomentOfInertiaUnit.CentimeterToTheSixth, 4.2)] [InlineData("en-US", "4.2 dm⁶", WarpingMomentOfInertiaUnit.DecimeterToTheSixth, 4.2)] @@ -457,7 +472,7 @@ public void TryParseUnit_WithCulture(string culture, string abbreviation, Warpin [InlineData("en-US", WarpingMomentOfInertiaUnit.MillimeterToTheSixth, "mm⁶")] public void GetAbbreviationForCulture(string culture, WarpingMomentOfInertiaUnit unit, string expectedAbbreviation) { - var defaultAbbreviation = WarpingMomentOfInertia.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); + var defaultAbbreviation = WarpingMomentOfInertia.GetAbbreviation(unit, CultureInfo.GetCultureInfo(culture)); Assert.Equal(expectedAbbreviation, defaultAbbreviation); } @@ -468,7 +483,7 @@ public void GetAbbreviationWithDefaultCulture() { var expectedAbbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit); - var defaultAbbreviation = WarpingMomentOfInertia.GetAbbreviation(unit); + var defaultAbbreviation = WarpingMomentOfInertia.GetAbbreviation(unit); Assert.Equal(expectedAbbreviation, defaultAbbreviation); }); From 9b418863cc1ca8abbca074be891ed9eedb5b2ab9 Mon Sep 17 00:00:00 2001 From: lipchev Date: Sun, 17 Aug 2025 00:05:08 +0300 Subject: [PATCH 5/5] - replaced the ToUnit(UnitSystem) overload from the IQuantity interface with an extension method ([Obsolete]) - renamed the ToUnitUntyped extension back to ToUnit and made it [Obsolete] - replaced the generated UnitSystem tests for the IQuantity / IQuantity with a single set of tests in the IQauntityTests --- .../UnitsNetGen/QuantityGenerator.cs | 3 - .../UnitsNetGen/UnitTestBaseClassGenerator.cs | 101 ++---------------- .../CustomCode/ElectricApparentEnergyTests.cs | 6 -- .../CustomCode/ElectricReactiveEnergyTests.cs | 6 -- .../CustomCode/FuelEfficiencyTests.cs | 6 -- UnitsNet.Tests/CustomCode/IQuantityTests.cs | 95 ++++++++++++---- UnitsNet.Tests/CustomQuantities/HowMuch.cs | 9 -- ...orbedDoseOfIonizingRadiationTestsBase.g.cs | 68 +----------- .../TestsBase/AccelerationTestsBase.g.cs | 68 +----------- .../TestsBase/AmountOfSubstanceTestsBase.g.cs | 68 +----------- .../TestsBase/AmplitudeRatioTestsBase.g.cs | 33 +----- .../TestsBase/AngleTestsBase.g.cs | 33 +----- .../TestsBase/AreaDensityTestsBase.g.cs | 68 +----------- .../AreaMomentOfInertiaTestsBase.g.cs | 68 +----------- .../TestsBase/AreaTestsBase.g.cs | 68 +----------- .../TestsBase/BitRateTestsBase.g.cs | 68 +----------- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 68 +----------- ...oefficientOfThermalExpansionTestsBase.g.cs | 68 +----------- .../TestsBase/CompressibilityTestsBase.g.cs | 68 +----------- .../TestsBase/DensityTestsBase.g.cs | 68 +----------- .../TestsBase/DoseAreaProductTestsBase.g.cs | 68 +----------- .../TestsBase/DurationTestsBase.g.cs | 68 +----------- .../TestsBase/DynamicViscosityTestsBase.g.cs | 68 +----------- .../ElectricAdmittanceTestsBase.g.cs | 68 +----------- .../ElectricApparentEnergyTestsBase.g.cs | 68 +----------- .../ElectricApparentPowerTestsBase.g.cs | 68 +----------- .../ElectricCapacitanceTestsBase.g.cs | 68 +----------- .../ElectricChargeDensityTestsBase.g.cs | 68 +----------- .../TestsBase/ElectricChargeTestsBase.g.cs | 68 +----------- .../ElectricConductanceTestsBase.g.cs | 68 +----------- .../ElectricConductivityTestsBase.g.cs | 68 +----------- .../ElectricCurrentDensityTestsBase.g.cs | 68 +----------- .../ElectricCurrentGradientTestsBase.g.cs | 68 +----------- .../TestsBase/ElectricCurrentTestsBase.g.cs | 68 +----------- .../TestsBase/ElectricFieldTestsBase.g.cs | 68 +----------- .../TestsBase/ElectricImpedanceTestsBase.g.cs | 68 +----------- .../ElectricInductanceTestsBase.g.cs | 68 +----------- .../ElectricPotentialChangeRateTestsBase.g.cs | 68 +----------- .../TestsBase/ElectricPotentialTestsBase.g.cs | 68 +----------- .../TestsBase/ElectricReactanceTestsBase.g.cs | 68 +----------- .../ElectricReactiveEnergyTestsBase.g.cs | 68 +----------- .../ElectricReactivePowerTestsBase.g.cs | 68 +----------- .../ElectricResistanceTestsBase.g.cs | 68 +----------- .../ElectricResistivityTestsBase.g.cs | 68 +----------- ...ElectricSurfaceChargeDensityTestsBase.g.cs | 68 +----------- .../ElectricSusceptanceTestsBase.g.cs | 68 +----------- .../TestsBase/EnergyDensityTestsBase.g.cs | 68 +----------- .../TestsBase/EnergyTestsBase.g.cs | 68 +----------- .../TestsBase/EntropyTestsBase.g.cs | 68 +----------- .../TestsBase/FluidResistanceTestsBase.g.cs | 68 +----------- .../TestsBase/ForceChangeRateTestsBase.g.cs | 68 +----------- .../TestsBase/ForcePerLengthTestsBase.g.cs | 68 +----------- .../TestsBase/ForceTestsBase.g.cs | 68 +----------- .../TestsBase/FrequencyTestsBase.g.cs | 68 +----------- .../TestsBase/FuelEfficiencyTestsBase.g.cs | 68 +----------- .../TestsBase/HeatFluxTestsBase.g.cs | 68 +----------- .../HeatTransferCoefficientTestsBase.g.cs | 68 +----------- .../TestsBase/IlluminanceTestsBase.g.cs | 68 +----------- .../TestsBase/ImpulseTestsBase.g.cs | 68 +----------- .../TestsBase/InformationTestsBase.g.cs | 33 +----- .../TestsBase/IrradianceTestsBase.g.cs | 68 +----------- .../TestsBase/IrradiationTestsBase.g.cs | 68 +----------- .../TestsBase/JerkTestsBase.g.cs | 68 +----------- .../KinematicViscosityTestsBase.g.cs | 68 +----------- .../TestsBase/LeakRateTestsBase.g.cs | 68 +----------- .../TestsBase/LengthTestsBase.g.cs | 68 +----------- .../TestsBase/LevelTestsBase.g.cs | 33 +----- .../TestsBase/LinearDensityTestsBase.g.cs | 68 +----------- .../LinearPowerDensityTestsBase.g.cs | 68 +----------- .../TestsBase/LuminanceTestsBase.g.cs | 68 +----------- .../TestsBase/LuminosityTestsBase.g.cs | 68 +----------- .../TestsBase/LuminousFluxTestsBase.g.cs | 68 +----------- .../TestsBase/LuminousIntensityTestsBase.g.cs | 68 +----------- .../TestsBase/MagneticFieldTestsBase.g.cs | 68 +----------- .../TestsBase/MagneticFluxTestsBase.g.cs | 68 +----------- .../TestsBase/MagnetizationTestsBase.g.cs | 68 +----------- .../TestsBase/MassConcentrationTestsBase.g.cs | 68 +----------- .../TestsBase/MassFlowTestsBase.g.cs | 68 +----------- .../TestsBase/MassFluxTestsBase.g.cs | 68 +----------- .../TestsBase/MassFractionTestsBase.g.cs | 33 +----- .../MassMomentOfInertiaTestsBase.g.cs | 68 +----------- .../TestsBase/MassTestsBase.g.cs | 68 +----------- .../TestsBase/MolalityTestsBase.g.cs | 68 +----------- .../TestsBase/MolarEnergyTestsBase.g.cs | 68 +----------- .../TestsBase/MolarEntropyTestsBase.g.cs | 68 +----------- .../TestsBase/MolarFlowTestsBase.g.cs | 68 +----------- .../TestsBase/MolarMassTestsBase.g.cs | 68 +----------- .../TestsBase/MolarityTestsBase.g.cs | 68 +----------- .../TestsBase/PermeabilityTestsBase.g.cs | 68 +----------- .../TestsBase/PermittivityTestsBase.g.cs | 68 +----------- .../PorousMediumPermeabilityTestsBase.g.cs | 68 +----------- .../TestsBase/PowerDensityTestsBase.g.cs | 68 +----------- .../TestsBase/PowerRatioTestsBase.g.cs | 33 +----- .../TestsBase/PowerTestsBase.g.cs | 68 +----------- .../PressureChangeRateTestsBase.g.cs | 68 +----------- .../TestsBase/PressureTestsBase.g.cs | 68 +----------- .../RadiationEquivalentDoseRateTestsBase.g.cs | 68 +----------- .../RadiationEquivalentDoseTestsBase.g.cs | 68 +----------- .../TestsBase/RadiationExposureTestsBase.g.cs | 68 +----------- .../TestsBase/RadioactivityTestsBase.g.cs | 68 +----------- .../TestsBase/RatioChangeRateTestsBase.g.cs | 68 +----------- .../TestsBase/RatioTestsBase.g.cs | 33 +----- .../TestsBase/ReciprocalAreaTestsBase.g.cs | 68 +----------- .../TestsBase/ReciprocalLengthTestsBase.g.cs | 68 +----------- .../TestsBase/RelativeHumidityTestsBase.g.cs | 33 +----- .../RotationalAccelerationTestsBase.g.cs | 68 +----------- .../TestsBase/RotationalSpeedTestsBase.g.cs | 68 +----------- ...RotationalStiffnessPerLengthTestsBase.g.cs | 68 +----------- .../RotationalStiffnessTestsBase.g.cs | 68 +----------- .../TestsBase/ScalarTestsBase.g.cs | 33 +----- .../TestsBase/SolidAngleTestsBase.g.cs | 33 +----- .../TestsBase/SpecificEnergyTestsBase.g.cs | 68 +----------- .../TestsBase/SpecificEntropyTestsBase.g.cs | 68 +----------- .../SpecificFuelConsumptionTestsBase.g.cs | 68 +----------- .../TestsBase/SpecificVolumeTestsBase.g.cs | 68 +----------- .../TestsBase/SpecificWeightTestsBase.g.cs | 68 +----------- .../TestsBase/SpeedTestsBase.g.cs | 68 +----------- .../StandardVolumeFlowTestsBase.g.cs | 68 +----------- .../TemperatureChangeRateTestsBase.g.cs | 68 +----------- .../TestsBase/TemperatureDeltaTestsBase.g.cs | 68 +----------- .../TemperatureGradientTestsBase.g.cs | 68 +----------- .../TestsBase/TemperatureTestsBase.g.cs | 68 +----------- .../ThermalConductivityTestsBase.g.cs | 68 +----------- .../TestsBase/ThermalInsulanceTestsBase.g.cs | 68 +----------- .../TestsBase/ThermalResistanceTestsBase.g.cs | 68 +----------- .../TestsBase/TorqueTestsBase.g.cs | 68 +----------- .../TestsBase/TurbidityTestsBase.g.cs | 33 +----- .../TestsBase/VitaminATestsBase.g.cs | 33 +----- .../VolumeConcentrationTestsBase.g.cs | 33 +----- .../TestsBase/VolumeFlowPerAreaTestsBase.g.cs | 68 +----------- .../TestsBase/VolumeFlowTestsBase.g.cs | 68 +----------- .../TestsBase/VolumePerLengthTestsBase.g.cs | 68 +----------- .../TestsBase/VolumeTestsBase.g.cs | 68 +----------- .../VolumetricHeatCapacityTestsBase.g.cs | 68 +----------- .../WarpingMomentOfInertiaTestsBase.g.cs | 68 +----------- UnitsNet/Extensions/QuantityExtensions.cs | 29 ++++- .../AbsorbedDoseOfIonizingRadiation.g.cs | 3 - .../Quantities/Acceleration.g.cs | 3 - .../Quantities/AmountOfSubstance.g.cs | 3 - .../Quantities/AmplitudeRatio.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Area.g.cs | 3 - .../GeneratedCode/Quantities/AreaDensity.g.cs | 3 - .../Quantities/AreaMomentOfInertia.g.cs | 3 - .../GeneratedCode/Quantities/BitRate.g.cs | 3 - .../BrakeSpecificFuelConsumption.g.cs | 3 - .../CoefficientOfThermalExpansion.g.cs | 3 - .../Quantities/Compressibility.g.cs | 3 - .../GeneratedCode/Quantities/Density.g.cs | 3 - .../Quantities/DoseAreaProduct.g.cs | 3 - .../GeneratedCode/Quantities/Duration.g.cs | 3 - .../Quantities/DynamicViscosity.g.cs | 3 - .../Quantities/ElectricAdmittance.g.cs | 3 - .../Quantities/ElectricApparentEnergy.g.cs | 3 - .../Quantities/ElectricApparentPower.g.cs | 3 - .../Quantities/ElectricCapacitance.g.cs | 3 - .../Quantities/ElectricCharge.g.cs | 3 - .../Quantities/ElectricChargeDensity.g.cs | 3 - .../Quantities/ElectricConductance.g.cs | 3 - .../Quantities/ElectricConductivity.g.cs | 3 - .../Quantities/ElectricCurrent.g.cs | 3 - .../Quantities/ElectricCurrentDensity.g.cs | 3 - .../Quantities/ElectricCurrentGradient.g.cs | 3 - .../Quantities/ElectricField.g.cs | 3 - .../Quantities/ElectricImpedance.g.cs | 3 - .../Quantities/ElectricInductance.g.cs | 3 - .../Quantities/ElectricPotential.g.cs | 3 - .../ElectricPotentialChangeRate.g.cs | 3 - .../Quantities/ElectricReactance.g.cs | 3 - .../Quantities/ElectricReactiveEnergy.g.cs | 3 - .../Quantities/ElectricReactivePower.g.cs | 3 - .../Quantities/ElectricResistance.g.cs | 3 - .../Quantities/ElectricResistivity.g.cs | 3 - .../ElectricSurfaceChargeDensity.g.cs | 3 - .../Quantities/ElectricSusceptance.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 3 - .../Quantities/EnergyDensity.g.cs | 3 - .../GeneratedCode/Quantities/Entropy.g.cs | 3 - .../Quantities/FluidResistance.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Force.g.cs | 3 - .../Quantities/ForceChangeRate.g.cs | 3 - .../Quantities/ForcePerLength.g.cs | 3 - .../GeneratedCode/Quantities/Frequency.g.cs | 3 - .../Quantities/FuelEfficiency.g.cs | 3 - .../GeneratedCode/Quantities/HeatFlux.g.cs | 3 - .../Quantities/HeatTransferCoefficient.g.cs | 3 - .../GeneratedCode/Quantities/Illuminance.g.cs | 3 - .../GeneratedCode/Quantities/Impulse.g.cs | 3 - .../GeneratedCode/Quantities/Information.g.cs | 3 - .../GeneratedCode/Quantities/Irradiance.g.cs | 3 - .../GeneratedCode/Quantities/Irradiation.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Jerk.g.cs | 3 - .../Quantities/KinematicViscosity.g.cs | 3 - .../GeneratedCode/Quantities/LeakRate.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Length.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Level.g.cs | 3 - .../Quantities/LinearDensity.g.cs | 3 - .../Quantities/LinearPowerDensity.g.cs | 3 - .../GeneratedCode/Quantities/Luminance.g.cs | 3 - .../GeneratedCode/Quantities/Luminosity.g.cs | 3 - .../Quantities/LuminousFlux.g.cs | 3 - .../Quantities/LuminousIntensity.g.cs | 3 - .../Quantities/MagneticField.g.cs | 3 - .../Quantities/MagneticFlux.g.cs | 3 - .../Quantities/Magnetization.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 3 - .../Quantities/MassConcentration.g.cs | 3 - .../GeneratedCode/Quantities/MassFlow.g.cs | 3 - .../GeneratedCode/Quantities/MassFlux.g.cs | 3 - .../Quantities/MassFraction.g.cs | 3 - .../Quantities/MassMomentOfInertia.g.cs | 3 - .../GeneratedCode/Quantities/Molality.g.cs | 3 - .../GeneratedCode/Quantities/MolarEnergy.g.cs | 3 - .../Quantities/MolarEntropy.g.cs | 3 - .../GeneratedCode/Quantities/MolarFlow.g.cs | 3 - .../GeneratedCode/Quantities/MolarMass.g.cs | 3 - .../GeneratedCode/Quantities/Molarity.g.cs | 3 - .../Quantities/Permeability.g.cs | 3 - .../Quantities/Permittivity.g.cs | 3 - .../Quantities/PorousMediumPermeability.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Power.g.cs | 3 - .../Quantities/PowerDensity.g.cs | 3 - .../GeneratedCode/Quantities/PowerRatio.g.cs | 3 - .../GeneratedCode/Quantities/Pressure.g.cs | 3 - .../Quantities/PressureChangeRate.g.cs | 3 - .../Quantities/RadiationEquivalentDose.g.cs | 3 - .../RadiationEquivalentDoseRate.g.cs | 3 - .../Quantities/RadiationExposure.g.cs | 3 - .../Quantities/Radioactivity.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 3 - .../Quantities/RatioChangeRate.g.cs | 3 - .../Quantities/ReciprocalArea.g.cs | 3 - .../Quantities/ReciprocalLength.g.cs | 3 - .../Quantities/RelativeHumidity.g.cs | 3 - .../Quantities/RotationalAcceleration.g.cs | 3 - .../Quantities/RotationalSpeed.g.cs | 3 - .../Quantities/RotationalStiffness.g.cs | 3 - .../RotationalStiffnessPerLength.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Scalar.g.cs | 3 - .../GeneratedCode/Quantities/SolidAngle.g.cs | 3 - .../Quantities/SpecificEnergy.g.cs | 3 - .../Quantities/SpecificEntropy.g.cs | 3 - .../Quantities/SpecificFuelConsumption.g.cs | 3 - .../Quantities/SpecificVolume.g.cs | 3 - .../Quantities/SpecificWeight.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 3 - .../Quantities/StandardVolumeFlow.g.cs | 3 - .../GeneratedCode/Quantities/Temperature.g.cs | 3 - .../Quantities/TemperatureChangeRate.g.cs | 3 - .../Quantities/TemperatureDelta.g.cs | 3 - .../Quantities/TemperatureGradient.g.cs | 3 - .../Quantities/ThermalConductivity.g.cs | 3 - .../Quantities/ThermalInsulance.g.cs | 3 - .../Quantities/ThermalResistance.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 3 - .../GeneratedCode/Quantities/Turbidity.g.cs | 3 - .../GeneratedCode/Quantities/VitaminA.g.cs | 3 - UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 3 - .../Quantities/VolumeConcentration.g.cs | 3 - .../GeneratedCode/Quantities/VolumeFlow.g.cs | 3 - .../Quantities/VolumeFlowPerArea.g.cs | 3 - .../Quantities/VolumePerLength.g.cs | 3 - .../Quantities/VolumetricHeatCapacity.g.cs | 3 - .../Quantities/WarpingMomentOfInertia.g.cs | 3 - UnitsNet/IQuantity.cs | 15 --- 265 files changed, 752 insertions(+), 8151 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index c91c2f7244..a38d7c9d3e 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -1154,9 +1154,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit({_unitEnumName} unit) => ToUnit(unit); - /// - IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs index b2ebbdf0b3..a5818b07cf 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs @@ -412,37 +412,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() {{ - Assert.Multiple(() => - {{ - var quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName}); - - {_quantity.Name} convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }}, () => - {{ - IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName}); - - IQuantity<{_unitEnumName}> convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }}); - }} - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - {{ - IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName}); + var quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName}); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + {_quantity.Name} convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); }} - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() {{ @@ -450,15 +427,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => {{ var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }}, () => {{ IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }}, () => {{ IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }}); }} "); @@ -508,35 +485,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = {_quantity.Name}.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - {{ - {_quantity.Name} quantityToConvert = quantity; - - {_quantity.Name} convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }}, () => - {{ - IQuantity<{_unitEnumName}> quantityToConvert = quantity; - - IQuantity<{_unitEnumName}> convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }}); - }} - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - {{ - var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - var expectedUnit = {_quantity.Name}.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + {_quantity.Name} convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -546,46 +495,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() {{ UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - {{ - var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }}, () => - {{ - IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }}); - }} - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - {{ - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }} [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() {{ var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - {{ - var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }}, () => - {{ - IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }}); - }} - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - {{ - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); }} "); } diff --git a/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs b/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs index 0e03d7c445..33e85f4386 100644 --- a/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs @@ -55,11 +55,5 @@ public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits(); } - - [Fact(Skip = "See about adding an SI unit (VoltampereSecond, Joules?)")] - public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits(); - } } } diff --git a/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs b/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs index c6a879999c..f1a56b6811 100644 --- a/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs @@ -54,11 +54,5 @@ public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits(); } - - [Fact(Skip = "See about adding an SI unit (VoltampereReactiveSecond, Joules?)")] - public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits(); - } } } diff --git a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs index 06bf5627cb..3e6e249af0 100644 --- a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs +++ b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs @@ -54,11 +54,5 @@ public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() { base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits(); } - - [Fact(Skip = "The SI unit would have to be MeterPerCubicMeter")] - public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits(); - } } } diff --git a/UnitsNet.Tests/CustomCode/IQuantityTests.cs b/UnitsNet.Tests/CustomCode/IQuantityTests.cs index 012f0cc09f..ce591ef0aa 100644 --- a/UnitsNet.Tests/CustomCode/IQuantityTests.cs +++ b/UnitsNet.Tests/CustomCode/IQuantityTests.cs @@ -1,31 +1,84 @@ // Licensed under MIT No Attribution, see LICENSE file at the root. // Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. -using System; -using System.Linq; -using Xunit; +namespace UnitsNet.Tests; -namespace UnitsNet.Tests +// ReSharper disable once InconsistentNaming +public partial class IQuantityTests { - // ReSharper disable once InconsistentNaming - public partial class IQuantityTests + [Fact] + public void As_GivenWrongUnitType_ThrowsArgumentException() { - [Fact] - public void As_GivenWrongUnitType_ThrowsArgumentException() + Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => { Assert.Throws(() => quantity.As(ComparisonType.Absolute)); }); + } + + [Fact] + public void ToUnit_GivenWrongUnitType_ThrowsArgumentException() + { + Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => { Assert.Throws(() => quantity.ToUnit(ComparisonType.Absolute)); }); + } + + [Fact] + public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() + { + var quantity = new Mass(1, Mass.BaseUnit); + MassUnit expectedUnit = Mass.Info.GetDefaultUnit(UnitSystem.SI); + var expectedValue = quantity.As(expectedUnit); + + Assert.Multiple(() => + { + IQuantity quantityToConvert = quantity; + + IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); + }, () => + { + IQuantity quantityToConvert = quantity; + + IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); + + Assert.Equal(expectedUnit, convertedQuantity.Unit); + Assert.Equal(expectedValue, convertedQuantity.Value); + }); + } + + [Fact] + public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() + { + UnitSystem nullUnitSystem = null!; + Assert.Multiple(() => + { + IQuantity quantity = new Mass(1, Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + }, () => + { + IQuantity quantity = new Mass(1, Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); + }); + } + + [Fact] + public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var unsupportedUnitSystem = new UnitSystem(new BaseUnits( + (LengthUnit)(-1), + (MassUnit)(-1), + (DurationUnit)(-1), + (ElectricCurrentUnit)(-1), + (TemperatureUnit)(-1), + (AmountOfSubstanceUnit)(-1), + (LuminousIntensityUnit)(-1))); + + Assert.Multiple(() => { - Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => - { - Assert.Throws(() => quantity.As(ComparisonType.Absolute)); - }); - } - - [Fact] - public void ToUnit_GivenWrongUnitType_ThrowsArgumentException() + IQuantity quantity = new Mass(1, Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); + }, () => { - Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => - { - Assert.Throws(() => quantity.ToUnit(ComparisonType.Absolute)); - }); - } + IQuantity quantity = new Mass(1, Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); + }); } } diff --git a/UnitsNet.Tests/CustomQuantities/HowMuch.cs b/UnitsNet.Tests/CustomQuantities/HowMuch.cs index 026d1ec5fb..143714d435 100644 --- a/UnitsNet.Tests/CustomQuantities/HowMuch.cs +++ b/UnitsNet.Tests/CustomQuantities/HowMuch.cs @@ -73,8 +73,6 @@ public double As(UnitKey unitKey) return As(unitKey.ToUnit()); } - public double As(UnitSystem unitSystem) => throw new NotImplementedException(); - public IQuantity ToUnit(Enum unit) { if (unit is HowMuchUnit howMuchUnit) return new HowMuch(As(unit), howMuchUnit); @@ -85,13 +83,6 @@ public IQuantity ToUnit(HowMuchUnit unit) { throw new NotImplementedException(); } - - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) - { - throw new NotImplementedException(); - } - - public IQuantity ToUnit(UnitSystem unitSystem) => throw new NotImplementedException(); public override string ToString() { diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs index 1468b9c0bc..8840d0d429 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs @@ -305,35 +305,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = AbsorbedDoseOfIonizingRadiation.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - AbsorbedDoseOfIonizingRadiation quantityToConvert = quantity; - - AbsorbedDoseOfIonizingRadiation convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - var expectedUnit = AbsorbedDoseOfIonizingRadiation.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + AbsorbedDoseOfIonizingRadiation convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -343,46 +315,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs index df6b31005e..c9600ef2ed 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs @@ -287,35 +287,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Acceleration.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Acceleration quantityToConvert = quantity; - - Acceleration convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - var expectedUnit = Acceleration.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Acceleration convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -325,46 +297,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs index f83c68a30b..a18ed6b913 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs @@ -305,35 +305,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = AmountOfSubstance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - AmountOfSubstance quantityToConvert = quantity; - - AmountOfSubstance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - var expectedUnit = AmountOfSubstance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + AmountOfSubstance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -343,46 +315,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs index 3b46e2b40b..f59245efa9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs @@ -186,37 +186,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt); - - AmplitudeRatio convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt); + var quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + AmplitudeRatio convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -224,15 +201,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs index 213bdd8424..b9fc738a7f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs @@ -252,37 +252,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new Angle(value: 1, unit: AngleUnit.Radian); - - Angle convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Angle(value: 1, unit: AngleUnit.Radian); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new Angle(value: 1, unit: AngleUnit.Radian); + var quantity = new Angle(value: 1, unit: AngleUnit.Radian); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + Angle convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -290,15 +267,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Angle(value: 1, unit: Angle.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Angle(value: 1, unit: Angle.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Angle(value: 1, unit: Angle.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs index 6da629fbf6..9389bf8362 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = AreaDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - AreaDensity quantityToConvert = quantity; - - AreaDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - var expectedUnit = AreaDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + AreaDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs index 7476dc3f70..ba59189e55 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = AreaMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - AreaMomentOfInertia quantityToConvert = quantity; - - AreaMomentOfInertia convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - var expectedUnit = AreaMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + AreaMomentOfInertia convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs index 197378c4e9..cebf87cd99 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs @@ -287,35 +287,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Area.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Area quantityToConvert = quantity; - - Area convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Area(value: 1, unit: Area.BaseUnit); - var expectedUnit = Area.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Area convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -325,46 +297,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Area(value: 1, unit: Area.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Area(value: 1, unit: Area.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs index 854e9900b1..5d2d759816 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs @@ -437,35 +437,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = BitRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - BitRate quantityToConvert = quantity; - - BitRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - var expectedUnit = BitRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + BitRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -475,46 +447,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs index 536f5b101f..2a2dc55d8b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = BrakeSpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - BrakeSpecificFuelConsumption quantityToConvert = quantity; - - BrakeSpecificFuelConsumption convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - var expectedUnit = BrakeSpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + BrakeSpecificFuelConsumption convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs index 64fcb85cca..26119fec3c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = CoefficientOfThermalExpansion.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - CoefficientOfThermalExpansion quantityToConvert = quantity; - - CoefficientOfThermalExpansion convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - var expectedUnit = CoefficientOfThermalExpansion.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + CoefficientOfThermalExpansion convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs index 964d15a611..6069068fc7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs @@ -245,35 +245,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Compressibility.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Compressibility quantityToConvert = quantity; - - Compressibility convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - var expectedUnit = Compressibility.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Compressibility convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -283,46 +255,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index 48e3d7e820..77efc0fcc8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -539,35 +539,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Density.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Density quantityToConvert = quantity; - - Density convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Density(value: 1, unit: Density.BaseUnit); - var expectedUnit = Density.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Density convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -577,46 +549,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Density(value: 1, unit: Density.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Density(value: 1, unit: Density.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs index d2c1304e26..61ab4c58b2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs @@ -353,35 +353,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = DoseAreaProduct.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - DoseAreaProduct quantityToConvert = quantity; - - DoseAreaProduct convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - var expectedUnit = DoseAreaProduct.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + DoseAreaProduct convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -391,46 +363,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs index 1e77b4db99..c6f76a8a57 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs @@ -281,35 +281,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Duration.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Duration quantityToConvert = quantity; - - Duration convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Duration(value: 1, unit: Duration.BaseUnit); - var expectedUnit = Duration.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Duration convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -319,46 +291,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Duration(value: 1, unit: Duration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Duration(value: 1, unit: Duration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs index 483cff37e8..12ac7a9c89 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs @@ -263,35 +263,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = DynamicViscosity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - DynamicViscosity quantityToConvert = quantity; - - DynamicViscosity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - var expectedUnit = DynamicViscosity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + DynamicViscosity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -301,46 +273,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs index 5e8754b5ee..acb1078b4b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs @@ -299,35 +299,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricAdmittance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricAdmittance quantityToConvert = quantity; - - ElectricAdmittance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - var expectedUnit = ElectricAdmittance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricAdmittance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -337,46 +309,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs index 79f5ea0993..70c351debd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricApparentEnergy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricApparentEnergy quantityToConvert = quantity; - - ElectricApparentEnergy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - var expectedUnit = ElectricApparentEnergy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricApparentEnergy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs index 8572daa8ff..ce74ec86aa 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricApparentPower.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricApparentPower quantityToConvert = quantity; - - ElectricApparentPower convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - var expectedUnit = ElectricApparentPower.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricApparentPower convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs index f6c32ffea9..ba285112ff 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs @@ -245,35 +245,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricCapacitance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricCapacitance quantityToConvert = quantity; - - ElectricCapacitance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - var expectedUnit = ElectricCapacitance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricCapacitance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -283,46 +255,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs index ef3f5777ae..98973d7cea 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricChargeDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricChargeDensity quantityToConvert = quantity; - - ElectricChargeDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - var expectedUnit = ElectricChargeDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricChargeDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricChargeDensity(value: 1, unit: ElectricChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs index 5d53b09e3e..1ea18ab026 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs @@ -269,35 +269,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricCharge.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricCharge quantityToConvert = quantity; - - ElectricCharge convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - var expectedUnit = ElectricCharge.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricCharge convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -307,46 +279,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricCharge(value: 1, unit: ElectricCharge.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs index 74df3bb25a..0994d2484e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs @@ -299,35 +299,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricConductance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricConductance quantityToConvert = quantity; - - ElectricConductance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - var expectedUnit = ElectricConductance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricConductance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -337,46 +309,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricConductance(value: 1, unit: ElectricConductance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs index 2eb01bb833..2c1f78e00b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricConductivity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricConductivity quantityToConvert = quantity; - - ElectricConductivity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - var expectedUnit = ElectricConductivity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricConductivity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricConductivity(value: 1, unit: ElectricConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs index 63824a627e..c232faff41 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricCurrentDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricCurrentDensity quantityToConvert = quantity; - - ElectricCurrentDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - var expectedUnit = ElectricCurrentDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricCurrentDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricCurrentDensity(value: 1, unit: ElectricCurrentDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs index d1bb6aef40..52921cb032 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs @@ -245,35 +245,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricCurrentGradient.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricCurrentGradient quantityToConvert = quantity; - - ElectricCurrentGradient convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - var expectedUnit = ElectricCurrentGradient.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricCurrentGradient convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -283,46 +255,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricCurrentGradient(value: 1, unit: ElectricCurrentGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs index ae61a05fce..a2ab2d38d1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricCurrent.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricCurrent quantityToConvert = quantity; - - ElectricCurrent convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - var expectedUnit = ElectricCurrent.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricCurrent convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricCurrent(value: 1, unit: ElectricCurrent.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs index 4871795759..bb071eb658 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricField.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricField quantityToConvert = quantity; - - ElectricField convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - var expectedUnit = ElectricField.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricField convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricField(value: 1, unit: ElectricField.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs index 61b4092eda..79e1bbe725 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricImpedanceTestsBase.g.cs @@ -251,35 +251,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricImpedance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricImpedance quantityToConvert = quantity; - - ElectricImpedance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - var expectedUnit = ElectricImpedance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricImpedance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -289,46 +261,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricImpedance(value: 1, unit: ElectricImpedance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs index c52256b465..e26f61f5d1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs @@ -233,35 +233,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricInductance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricInductance quantityToConvert = quantity; - - ElectricInductance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - var expectedUnit = ElectricInductance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricInductance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -271,46 +243,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricInductance(value: 1, unit: ElectricInductance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs index dadaac73d6..9f2d788ca4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs @@ -323,35 +323,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricPotentialChangeRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricPotentialChangeRate quantityToConvert = quantity; - - ElectricPotentialChangeRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - var expectedUnit = ElectricPotentialChangeRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricPotentialChangeRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -361,46 +333,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricPotentialChangeRate(value: 1, unit: ElectricPotentialChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs index bab3e31985..6af93caf9c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricPotential.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricPotential quantityToConvert = quantity; - - ElectricPotential convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - var expectedUnit = ElectricPotential.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricPotential convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricPotential(value: 1, unit: ElectricPotential.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs index f520d34671..251faa950c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactanceTestsBase.g.cs @@ -251,35 +251,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricReactance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricReactance quantityToConvert = quantity; - - ElectricReactance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - var expectedUnit = ElectricReactance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricReactance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -289,46 +261,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricReactance(value: 1, unit: ElectricReactance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs index a8c7fbc9e4..8a024ca4a4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactiveEnergyTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricReactiveEnergy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricReactiveEnergy quantityToConvert = quantity; - - ElectricReactiveEnergy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - var expectedUnit = ElectricReactiveEnergy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricReactiveEnergy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricReactiveEnergy(value: 1, unit: ElectricReactiveEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs index 9252b9e59e..e828a9817c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricReactivePowerTestsBase.g.cs @@ -227,35 +227,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricReactivePower.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricReactivePower quantityToConvert = quantity; - - ElectricReactivePower convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - var expectedUnit = ElectricReactivePower.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricReactivePower convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -265,46 +237,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricReactivePower(value: 1, unit: ElectricReactivePower.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs index 5d3f5c9cf0..b490a6789f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs @@ -251,35 +251,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricResistance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricResistance quantityToConvert = quantity; - - ElectricResistance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - var expectedUnit = ElectricResistance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricResistance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -289,46 +261,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricResistance(value: 1, unit: ElectricResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs index c4a30f8349..345994d34b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs @@ -287,35 +287,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricResistivity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricResistivity quantityToConvert = quantity; - - ElectricResistivity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - var expectedUnit = ElectricResistivity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricResistivity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -325,46 +297,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricResistivity(value: 1, unit: ElectricResistivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs index d39dba513b..24c8046d0f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricSurfaceChargeDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricSurfaceChargeDensity quantityToConvert = quantity; - - ElectricSurfaceChargeDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - var expectedUnit = ElectricSurfaceChargeDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricSurfaceChargeDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricSurfaceChargeDensity(value: 1, unit: ElectricSurfaceChargeDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs index 2b66a0de39..d36c679ee4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSusceptanceTestsBase.g.cs @@ -299,35 +299,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ElectricSusceptance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ElectricSusceptance quantityToConvert = quantity; - - ElectricSusceptance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - var expectedUnit = ElectricSusceptance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ElectricSusceptance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -337,46 +309,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ElectricSusceptance(value: 1, unit: ElectricSusceptance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs index f63fc68783..c1f52bd393 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs @@ -275,35 +275,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = EnergyDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - EnergyDensity quantityToConvert = quantity; - - EnergyDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - var expectedUnit = EnergyDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + EnergyDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -313,46 +285,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new EnergyDensity(value: 1, unit: EnergyDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs index 6b68f3ec28..b11ba62ff4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs @@ -443,35 +443,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Energy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Energy quantityToConvert = quantity; - - Energy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Energy(value: 1, unit: Energy.BaseUnit); - var expectedUnit = Energy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Energy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -481,46 +453,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Energy(value: 1, unit: Energy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Energy(value: 1, unit: Energy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Energy(value: 1, unit: Energy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs index 5be6549b6c..35ba253a34 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs @@ -245,35 +245,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Entropy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Entropy quantityToConvert = quantity; - - Entropy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - var expectedUnit = Entropy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Entropy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -283,46 +255,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Entropy(value: 1, unit: Entropy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs index c65c410d75..faf7bc6e39 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FluidResistanceTestsBase.g.cs @@ -317,35 +317,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = FluidResistance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - FluidResistance quantityToConvert = quantity; - - FluidResistance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - var expectedUnit = FluidResistance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + FluidResistance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -355,46 +327,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new FluidResistance(value: 1, unit: FluidResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs index 71b1df898f..8a1d0d30bd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs @@ -293,35 +293,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ForceChangeRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ForceChangeRate quantityToConvert = quantity; - - ForceChangeRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - var expectedUnit = ForceChangeRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ForceChangeRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -331,46 +303,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ForceChangeRate(value: 1, unit: ForceChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs index b9bd16c3a1..6aae573015 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs @@ -431,35 +431,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ForcePerLength.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ForcePerLength quantityToConvert = quantity; - - ForcePerLength convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - var expectedUnit = ForcePerLength.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ForcePerLength convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -469,46 +441,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ForcePerLength(value: 1, unit: ForcePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs index b1196a7cf8..1514287143 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs @@ -293,35 +293,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Force.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Force quantityToConvert = quantity; - - Force convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Force(value: 1, unit: Force.BaseUnit); - var expectedUnit = Force.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Force convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -331,46 +303,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Force(value: 1, unit: Force.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Force(value: 1, unit: Force.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Force(value: 1, unit: Force.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs index 516f83da0b..9969c0cb93 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs @@ -275,35 +275,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Frequency.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Frequency quantityToConvert = quantity; - - Frequency convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - var expectedUnit = Frequency.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Frequency convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -313,46 +285,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Frequency(value: 1, unit: Frequency.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs index d9c6c56302..568dc6995a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs @@ -227,35 +227,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = FuelEfficiency.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - FuelEfficiency quantityToConvert = quantity; - - FuelEfficiency convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - var expectedUnit = FuelEfficiency.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + FuelEfficiency convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -265,46 +237,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new FuelEfficiency(value: 1, unit: FuelEfficiency.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs index c8e08b7beb..b2dfbfdb44 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs @@ -311,35 +311,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = HeatFlux.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - HeatFlux quantityToConvert = quantity; - - HeatFlux convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - var expectedUnit = HeatFlux.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + HeatFlux convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -349,46 +321,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new HeatFlux(value: 1, unit: HeatFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs index 60694c3d86..94683fce44 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs @@ -233,35 +233,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = HeatTransferCoefficient.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - HeatTransferCoefficient quantityToConvert = quantity; - - HeatTransferCoefficient convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - var expectedUnit = HeatTransferCoefficient.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + HeatTransferCoefficient convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -271,46 +243,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new HeatTransferCoefficient(value: 1, unit: HeatTransferCoefficient.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs index 0d21c5fe14..032f7f109f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs @@ -227,35 +227,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Illuminance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Illuminance quantityToConvert = quantity; - - Illuminance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - var expectedUnit = Illuminance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Illuminance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -265,46 +237,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Illuminance(value: 1, unit: Illuminance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs index 66e6a5974e..4387a54912 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs @@ -281,35 +281,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Impulse.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Impulse quantityToConvert = quantity; - - Impulse convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - var expectedUnit = Impulse.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Impulse convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -319,46 +291,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Impulse(value: 1, unit: Impulse.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs index c42b7a0489..1d46f8d8d3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs @@ -396,37 +396,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new Information(value: 1, unit: InformationUnit.Bit); - - Information convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(InformationUnit.Bit, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Information(value: 1, unit: InformationUnit.Bit); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(InformationUnit.Bit, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new Information(value: 1, unit: InformationUnit.Bit); + var quantity = new Information(value: 1, unit: InformationUnit.Bit); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + Information convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(InformationUnit.Bit, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -434,15 +411,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Information(value: 1, unit: Information.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Information(value: 1, unit: Information.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Information(value: 1, unit: Information.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs index b672a3b7cc..f1e60d0038 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs @@ -287,35 +287,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Irradiance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Irradiance quantityToConvert = quantity; - - Irradiance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - var expectedUnit = Irradiance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Irradiance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -325,46 +297,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Irradiance(value: 1, unit: Irradiance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs index 8b513e1156..32139d5345 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Irradiation.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Irradiation quantityToConvert = quantity; - - Irradiation convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - var expectedUnit = Irradiation.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Irradiation convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Irradiation(value: 1, unit: Irradiation.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs index 5c6a2cda5b..9bf5edc18a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs @@ -269,35 +269,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Jerk.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Jerk quantityToConvert = quantity; - - Jerk convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - var expectedUnit = Jerk.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Jerk convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -307,46 +279,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Jerk(value: 1, unit: Jerk.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs index 4b500c381f..3692bbe175 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = KinematicViscosity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - KinematicViscosity quantityToConvert = quantity; - - KinematicViscosity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - var expectedUnit = KinematicViscosity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + KinematicViscosity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new KinematicViscosity(value: 1, unit: KinematicViscosity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs index 94a6edf1a4..244629383e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LeakRateTestsBase.g.cs @@ -227,35 +227,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = LeakRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - LeakRate quantityToConvert = quantity; - - LeakRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - var expectedUnit = LeakRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + LeakRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -265,46 +237,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new LeakRate(value: 1, unit: LeakRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs index c69a0a0fe8..85dba00fd2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs @@ -455,35 +455,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Length.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Length quantityToConvert = quantity; - - Length convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Length(value: 1, unit: Length.BaseUnit); - var expectedUnit = Length.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Length convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -493,46 +465,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Length(value: 1, unit: Length.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Length(value: 1, unit: Length.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Length(value: 1, unit: Length.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs index 62060ed89a..82674f5d14 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs @@ -174,37 +174,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new Level(value: 1, unit: LevelUnit.Decibel); - - Level convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(LevelUnit.Decibel, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Level(value: 1, unit: LevelUnit.Decibel); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(LevelUnit.Decibel, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new Level(value: 1, unit: LevelUnit.Decibel); + var quantity = new Level(value: 1, unit: LevelUnit.Decibel); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + Level convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(LevelUnit.Decibel, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -212,15 +189,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Level(value: 1, unit: Level.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Level(value: 1, unit: Level.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Level(value: 1, unit: Level.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs index cc57a73bcd..2c915411ce 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs @@ -311,35 +311,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = LinearDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - LinearDensity quantityToConvert = quantity; - - LinearDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - var expectedUnit = LinearDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + LinearDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -349,46 +321,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new LinearDensity(value: 1, unit: LinearDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs index f923eb7d3a..bf9050a371 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs @@ -353,35 +353,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = LinearPowerDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - LinearPowerDensity quantityToConvert = quantity; - - LinearPowerDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - var expectedUnit = LinearPowerDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + LinearPowerDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -391,46 +363,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new LinearPowerDensity(value: 1, unit: LinearPowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs index 486f7febff..591c951b4f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs @@ -263,35 +263,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Luminance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Luminance quantityToConvert = quantity; - - Luminance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - var expectedUnit = Luminance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Luminance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -301,46 +273,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Luminance(value: 1, unit: Luminance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs index ce10be03ec..4b14438b18 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs @@ -287,35 +287,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Luminosity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Luminosity quantityToConvert = quantity; - - Luminosity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - var expectedUnit = Luminosity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Luminosity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -325,46 +297,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Luminosity(value: 1, unit: Luminosity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs index 69e75babc7..32b414cdc9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = LuminousFlux.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - LuminousFlux quantityToConvert = quantity; - - LuminousFlux convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - var expectedUnit = LuminousFlux.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + LuminousFlux convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new LuminousFlux(value: 1, unit: LuminousFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs index 6257383d39..cad3063579 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = LuminousIntensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - LuminousIntensity quantityToConvert = quantity; - - LuminousIntensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - var expectedUnit = LuminousIntensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + LuminousIntensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new LuminousIntensity(value: 1, unit: LuminousIntensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs index 9b8c34a6d4..b41a87c1e6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MagneticField.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MagneticField quantityToConvert = quantity; - - MagneticField convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - var expectedUnit = MagneticField.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MagneticField convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MagneticField(value: 1, unit: MagneticField.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs index 1ed30187de..714b6a3f69 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MagneticFlux.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MagneticFlux quantityToConvert = quantity; - - MagneticFlux convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - var expectedUnit = MagneticFlux.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MagneticFlux convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MagneticFlux(value: 1, unit: MagneticFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs index fcb8e82192..ffb6e8d0be 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Magnetization.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Magnetization quantityToConvert = quantity; - - Magnetization convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - var expectedUnit = Magnetization.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Magnetization convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Magnetization(value: 1, unit: Magnetization.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs index b4ea373245..ea4ccb7413 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs @@ -497,35 +497,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MassConcentration.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MassConcentration quantityToConvert = quantity; - - MassConcentration convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - var expectedUnit = MassConcentration.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MassConcentration convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -535,46 +507,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MassConcentration(value: 1, unit: MassConcentration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs index 1007bedb84..6fe7c26333 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs @@ -401,35 +401,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MassFlow.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MassFlow quantityToConvert = quantity; - - MassFlow convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - var expectedUnit = MassFlow.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MassFlow convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -439,46 +411,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MassFlow(value: 1, unit: MassFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs index ecd9b4a0c0..8349116945 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs @@ -275,35 +275,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MassFlux.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MassFlux quantityToConvert = quantity; - - MassFlux convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - var expectedUnit = MassFlux.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MassFlux convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -313,46 +285,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MassFlux(value: 1, unit: MassFlux.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs index d957c538c8..008e2ebdd4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs @@ -306,37 +306,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new MassFraction(value: 1, unit: MassFractionUnit.DecimalFraction); - - MassFraction convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(MassFractionUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new MassFraction(value: 1, unit: MassFractionUnit.DecimalFraction); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(MassFractionUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new MassFraction(value: 1, unit: MassFractionUnit.DecimalFraction); + var quantity = new MassFraction(value: 1, unit: MassFractionUnit.DecimalFraction); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + MassFraction convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(MassFractionUnit.DecimalFraction, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -344,15 +321,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new MassFraction(value: 1, unit: MassFraction.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new MassFraction(value: 1, unit: MassFraction.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new MassFraction(value: 1, unit: MassFraction.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs index cbcc1f622e..b74e630e2b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs @@ -371,35 +371,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MassMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MassMomentOfInertia quantityToConvert = quantity; - - MassMomentOfInertia convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - var expectedUnit = MassMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MassMomentOfInertia convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -409,46 +381,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MassMomentOfInertia(value: 1, unit: MassMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs index b2c238a2d4..1e75b909f7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs @@ -365,35 +365,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Mass.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Mass quantityToConvert = quantity; - - Mass convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Mass(value: 1, unit: Mass.BaseUnit); - var expectedUnit = Mass.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Mass convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -403,46 +375,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Mass(value: 1, unit: Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Mass(value: 1, unit: Mass.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Mass(value: 1, unit: Mass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs index 5443d12d23..55f36ca488 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolalityTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Molality.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Molality quantityToConvert = quantity; - - Molality convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Molality(value: 1, unit: Molality.BaseUnit); - var expectedUnit = Molality.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Molality convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Molality(value: 1, unit: Molality.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Molality(value: 1, unit: Molality.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Molality(value: 1, unit: Molality.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs index 332fabe6b6..d418c52438 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MolarEnergy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MolarEnergy quantityToConvert = quantity; - - MolarEnergy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - var expectedUnit = MolarEnergy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MolarEnergy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MolarEnergy(value: 1, unit: MolarEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs index 5c36626f22..07465bdcb4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MolarEntropy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MolarEntropy quantityToConvert = quantity; - - MolarEntropy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - var expectedUnit = MolarEntropy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MolarEntropy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MolarEntropy(value: 1, unit: MolarEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs index 987cde502d..38f030aa1a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MolarFlow.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MolarFlow quantityToConvert = quantity; - - MolarFlow convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - var expectedUnit = MolarFlow.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MolarFlow convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MolarFlow(value: 1, unit: MolarFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs index 851833d560..0e16d4b1fa 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs @@ -281,35 +281,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = MolarMass.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - MolarMass quantityToConvert = quantity; - - MolarMass convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - var expectedUnit = MolarMass.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + MolarMass convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -319,46 +291,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new MolarMass(value: 1, unit: MolarMass.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs index 4d8333fed7..fcab87357e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs @@ -269,35 +269,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Molarity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Molarity quantityToConvert = quantity; - - Molarity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - var expectedUnit = Molarity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Molarity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -307,46 +279,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Molarity(value: 1, unit: Molarity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs index cb65b5b9e8..4853e2bd39 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Permeability.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Permeability quantityToConvert = quantity; - - Permeability convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - var expectedUnit = Permeability.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Permeability convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Permeability(value: 1, unit: Permeability.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs index fee87ec3aa..f2dc863436 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs @@ -209,35 +209,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Permittivity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Permittivity quantityToConvert = quantity; - - Permittivity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - var expectedUnit = Permittivity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Permittivity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -247,46 +219,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Permittivity(value: 1, unit: Permittivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs index 65c890210b..734b29d9f6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs @@ -233,35 +233,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = PorousMediumPermeability.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - PorousMediumPermeability quantityToConvert = quantity; - - PorousMediumPermeability convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - var expectedUnit = PorousMediumPermeability.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + PorousMediumPermeability convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -271,46 +243,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new PorousMediumPermeability(value: 1, unit: PorousMediumPermeability.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs index bc8898263b..b9bd40cd73 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs @@ -467,35 +467,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = PowerDensity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - PowerDensity quantityToConvert = quantity; - - PowerDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - var expectedUnit = PowerDensity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + PowerDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -505,46 +477,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new PowerDensity(value: 1, unit: PowerDensity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs index 5aef0f93c7..e3d5bbafb4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs @@ -174,37 +174,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new PowerRatio(value: 1, unit: PowerRatioUnit.DecibelWatt); - - PowerRatio convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(PowerRatioUnit.DecibelWatt, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatioUnit.DecibelWatt); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(PowerRatioUnit.DecibelWatt, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatioUnit.DecibelWatt); + var quantity = new PowerRatio(value: 1, unit: PowerRatioUnit.DecibelWatt); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + PowerRatio convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(PowerRatioUnit.DecibelWatt, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -212,15 +189,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new PowerRatio(value: 1, unit: PowerRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new PowerRatio(value: 1, unit: PowerRatio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs index 9475ce2578..1920ba333f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs @@ -365,35 +365,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Power.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Power quantityToConvert = quantity; - - Power convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Power(value: 1, unit: Power.BaseUnit); - var expectedUnit = Power.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Power convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -403,46 +375,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Power(value: 1, unit: Power.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Power(value: 1, unit: Power.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Power(value: 1, unit: Power.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs index c74e46c776..bd759a52f0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs @@ -311,35 +311,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = PressureChangeRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - PressureChangeRate quantityToConvert = quantity; - - PressureChangeRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - var expectedUnit = PressureChangeRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + PressureChangeRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -349,46 +321,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new PressureChangeRate(value: 1, unit: PressureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs index 2e76518d12..fbb8444297 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs @@ -491,35 +491,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Pressure.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Pressure quantityToConvert = quantity; - - Pressure convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - var expectedUnit = Pressure.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Pressure convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -529,46 +501,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Pressure(value: 1, unit: Pressure.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs index 4d4672a5ff..e0ece9c4e8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseRateTestsBase.g.cs @@ -263,35 +263,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RadiationEquivalentDoseRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RadiationEquivalentDoseRate quantityToConvert = quantity; - - RadiationEquivalentDoseRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - var expectedUnit = RadiationEquivalentDoseRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RadiationEquivalentDoseRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -301,46 +273,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RadiationEquivalentDoseRate(value: 1, unit: RadiationEquivalentDoseRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs index f7557c5d79..829adc0123 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationEquivalentDoseTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RadiationEquivalentDose.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RadiationEquivalentDose quantityToConvert = quantity; - - RadiationEquivalentDose convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - var expectedUnit = RadiationEquivalentDose.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RadiationEquivalentDose convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RadiationEquivalentDose(value: 1, unit: RadiationEquivalentDose.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs index e6424e2e13..e517befb98 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadiationExposureTestsBase.g.cs @@ -251,35 +251,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RadiationExposure.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RadiationExposure quantityToConvert = quantity; - - RadiationExposure convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - var expectedUnit = RadiationExposure.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RadiationExposure convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -289,46 +261,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RadiationExposure(value: 1, unit: RadiationExposure.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs index 5eed4f3d92..54161e1834 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RadioactivityTestsBase.g.cs @@ -377,35 +377,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Radioactivity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Radioactivity quantityToConvert = quantity; - - Radioactivity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - var expectedUnit = Radioactivity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Radioactivity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -415,46 +387,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Radioactivity(value: 1, unit: Radioactivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs index bd18e90323..31d7ddf70a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs @@ -215,35 +215,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RatioChangeRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RatioChangeRate quantityToConvert = quantity; - - RatioChangeRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - var expectedUnit = RatioChangeRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RatioChangeRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -253,46 +225,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RatioChangeRate(value: 1, unit: RatioChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs index 49e44d12e1..f50b4c3fbd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs @@ -198,37 +198,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new Ratio(value: 1, unit: RatioUnit.DecimalFraction); - - Ratio convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(RatioUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Ratio(value: 1, unit: RatioUnit.DecimalFraction); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(RatioUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new Ratio(value: 1, unit: RatioUnit.DecimalFraction); + var quantity = new Ratio(value: 1, unit: RatioUnit.DecimalFraction); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + Ratio convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(RatioUnit.DecimalFraction, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -236,15 +213,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Ratio(value: 1, unit: Ratio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Ratio(value: 1, unit: Ratio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Ratio(value: 1, unit: Ratio.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs index 598bf4bc3c..1cdff726ea 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs @@ -269,35 +269,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ReciprocalArea.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ReciprocalArea quantityToConvert = quantity; - - ReciprocalArea convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - var expectedUnit = ReciprocalArea.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ReciprocalArea convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -307,46 +279,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ReciprocalArea(value: 1, unit: ReciprocalArea.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs index 5f8950c3a6..3ad6ec30de 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs @@ -263,35 +263,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ReciprocalLength.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ReciprocalLength quantityToConvert = quantity; - - ReciprocalLength convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - var expectedUnit = ReciprocalLength.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ReciprocalLength convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -301,46 +273,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ReciprocalLength(value: 1, unit: ReciprocalLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs index adcd7bbb99..7f73c3343d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs @@ -168,37 +168,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new RelativeHumidity(value: 1, unit: RelativeHumidityUnit.Percent); - - RelativeHumidity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(RelativeHumidityUnit.Percent, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidityUnit.Percent); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(RelativeHumidityUnit.Percent, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidityUnit.Percent); + var quantity = new RelativeHumidity(value: 1, unit: RelativeHumidityUnit.Percent); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + RelativeHumidity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(RelativeHumidityUnit.Percent, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -206,15 +183,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new RelativeHumidity(value: 1, unit: RelativeHumidity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new RelativeHumidity(value: 1, unit: RelativeHumidity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs index 678c977c33..37b6c2b9fd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs @@ -227,35 +227,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RotationalAcceleration.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RotationalAcceleration quantityToConvert = quantity; - - RotationalAcceleration convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - var expectedUnit = RotationalAcceleration.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RotationalAcceleration convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -265,46 +237,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RotationalAcceleration(value: 1, unit: RotationalAcceleration.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs index fa5ef846e2..f96bcd6abd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs @@ -281,35 +281,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RotationalSpeed.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RotationalSpeed quantityToConvert = quantity; - - RotationalSpeed convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - var expectedUnit = RotationalSpeed.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RotationalSpeed convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -319,46 +291,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RotationalSpeed(value: 1, unit: RotationalSpeed.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs index 3e0a660659..ca708ff30a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs @@ -233,35 +233,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RotationalStiffnessPerLength.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RotationalStiffnessPerLength quantityToConvert = quantity; - - RotationalStiffnessPerLength convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - var expectedUnit = RotationalStiffnessPerLength.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RotationalStiffnessPerLength convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -271,46 +243,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RotationalStiffnessPerLength(value: 1, unit: RotationalStiffnessPerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs index b827277f41..ef40ab2228 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs @@ -401,35 +401,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = RotationalStiffness.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - RotationalStiffness quantityToConvert = quantity; - - RotationalStiffness convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - var expectedUnit = RotationalStiffness.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + RotationalStiffness convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -439,46 +411,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new RotationalStiffness(value: 1, unit: RotationalStiffness.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs index a483f5954e..f1adb3c098 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs @@ -168,37 +168,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new Scalar(value: 1, unit: ScalarUnit.Amount); - - Scalar convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(ScalarUnit.Amount, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Scalar(value: 1, unit: ScalarUnit.Amount); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(ScalarUnit.Amount, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new Scalar(value: 1, unit: ScalarUnit.Amount); + var quantity = new Scalar(value: 1, unit: ScalarUnit.Amount); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + Scalar convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(ScalarUnit.Amount, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -206,15 +183,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Scalar(value: 1, unit: Scalar.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Scalar(value: 1, unit: Scalar.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Scalar(value: 1, unit: Scalar.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs index 410e851faa..eb6a58dbfe 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs @@ -168,37 +168,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new SolidAngle(value: 1, unit: SolidAngleUnit.Steradian); - - SolidAngle convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(SolidAngleUnit.Steradian, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngleUnit.Steradian); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(SolidAngleUnit.Steradian, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngleUnit.Steradian); + var quantity = new SolidAngle(value: 1, unit: SolidAngleUnit.Steradian); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + SolidAngle convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(SolidAngleUnit.Steradian, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -206,15 +183,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new SolidAngle(value: 1, unit: SolidAngle.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngle.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new SolidAngle(value: 1, unit: SolidAngle.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs index e796178a68..ef7090b04d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs @@ -383,35 +383,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = SpecificEnergy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - SpecificEnergy quantityToConvert = quantity; - - SpecificEnergy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - var expectedUnit = SpecificEnergy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + SpecificEnergy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -421,46 +393,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new SpecificEnergy(value: 1, unit: SpecificEnergy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs index 06596157f7..5695566514 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = SpecificEntropy.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - SpecificEntropy quantityToConvert = quantity; - - SpecificEntropy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - var expectedUnit = SpecificEntropy.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + SpecificEntropy convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new SpecificEntropy(value: 1, unit: SpecificEntropy.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs index 9af48365b7..ecae77e791 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs @@ -227,35 +227,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = SpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - SpecificFuelConsumption quantityToConvert = quantity; - - SpecificFuelConsumption convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - var expectedUnit = SpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + SpecificFuelConsumption convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -265,46 +237,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new SpecificFuelConsumption(value: 1, unit: SpecificFuelConsumption.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs index 0233cd2c17..e9341cce8a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs @@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = SpecificVolume.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - SpecificVolume quantityToConvert = quantity; - - SpecificVolume convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - var expectedUnit = SpecificVolume.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + SpecificVolume convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new SpecificVolume(value: 1, unit: SpecificVolume.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs index 5ca94af9d2..44dcf36ee8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs @@ -305,35 +305,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = SpecificWeight.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - SpecificWeight quantityToConvert = quantity; - - SpecificWeight convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - var expectedUnit = SpecificWeight.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + SpecificWeight convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -343,46 +315,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new SpecificWeight(value: 1, unit: SpecificWeight.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs index 0861b0207e..dbde8909f0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs @@ -401,35 +401,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Speed.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Speed quantityToConvert = quantity; - - Speed convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Speed(value: 1, unit: Speed.BaseUnit); - var expectedUnit = Speed.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Speed convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -439,46 +411,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Speed(value: 1, unit: Speed.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Speed(value: 1, unit: Speed.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Speed(value: 1, unit: Speed.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs index 9793fa684d..bd761f4515 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = StandardVolumeFlow.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - StandardVolumeFlow quantityToConvert = quantity; - - StandardVolumeFlow convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - var expectedUnit = StandardVolumeFlow.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + StandardVolumeFlow convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new StandardVolumeFlow(value: 1, unit: StandardVolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs index 680c47a200..8dd9f6749d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs @@ -305,35 +305,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = TemperatureChangeRate.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - TemperatureChangeRate quantityToConvert = quantity; - - TemperatureChangeRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - var expectedUnit = TemperatureChangeRate.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + TemperatureChangeRate convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -343,46 +315,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new TemperatureChangeRate(value: 1, unit: TemperatureChangeRate.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs index 8be36bb55b..54b76d43b4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = TemperatureDelta.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - TemperatureDelta quantityToConvert = quantity; - - TemperatureDelta convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - var expectedUnit = TemperatureDelta.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + TemperatureDelta convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new TemperatureDelta(value: 1, unit: TemperatureDelta.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs index d0f91b13dc..b770d73168 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs @@ -227,35 +227,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = TemperatureGradient.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - TemperatureGradient quantityToConvert = quantity; - - TemperatureGradient convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - var expectedUnit = TemperatureGradient.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + TemperatureGradient convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -265,46 +237,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new TemperatureGradient(value: 1, unit: TemperatureGradient.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs index adb6da15f3..84bad27648 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs @@ -263,35 +263,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Temperature.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Temperature quantityToConvert = quantity; - - Temperature convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - var expectedUnit = Temperature.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Temperature convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -301,46 +273,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Temperature(value: 1, unit: Temperature.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs index 7e7d035f05..c104c056cf 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs @@ -215,35 +215,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ThermalConductivity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ThermalConductivity quantityToConvert = quantity; - - ThermalConductivity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - var expectedUnit = ThermalConductivity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ThermalConductivity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -253,46 +225,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ThermalConductivity(value: 1, unit: ThermalConductivity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs index a84982777f..922f4109ea 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalInsulanceTestsBase.g.cs @@ -245,35 +245,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ThermalInsulance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ThermalInsulance quantityToConvert = quantity; - - ThermalInsulance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - var expectedUnit = ThermalInsulance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ThermalInsulance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -283,46 +255,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ThermalInsulance(value: 1, unit: ThermalInsulance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs index 14d6a11532..692a181530 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs @@ -215,35 +215,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = ThermalResistance.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - ThermalResistance quantityToConvert = quantity; - - ThermalResistance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - var expectedUnit = ThermalResistance.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + ThermalResistance convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -253,46 +225,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new ThermalResistance(value: 1, unit: ThermalResistance.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs index 28ab736f99..3965db12a5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs @@ -353,35 +353,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Torque.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Torque quantityToConvert = quantity; - - Torque convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Torque(value: 1, unit: Torque.BaseUnit); - var expectedUnit = Torque.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Torque convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -391,46 +363,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Torque(value: 1, unit: Torque.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Torque(value: 1, unit: Torque.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Torque(value: 1, unit: Torque.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs index d47b86d277..638583c83e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs @@ -168,37 +168,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new Turbidity(value: 1, unit: TurbidityUnit.NTU); - - Turbidity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(TurbidityUnit.NTU, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new Turbidity(value: 1, unit: TurbidityUnit.NTU); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(TurbidityUnit.NTU, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new Turbidity(value: 1, unit: TurbidityUnit.NTU); + var quantity = new Turbidity(value: 1, unit: TurbidityUnit.NTU); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + Turbidity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(TurbidityUnit.NTU, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -206,15 +183,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new Turbidity(value: 1, unit: Turbidity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Turbidity(value: 1, unit: Turbidity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new Turbidity(value: 1, unit: Turbidity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs index ebac154544..5bad1cea21 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs @@ -168,37 +168,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new VitaminA(value: 1, unit: VitaminAUnit.InternationalUnit); - - VitaminA convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(VitaminAUnit.InternationalUnit, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new VitaminA(value: 1, unit: VitaminAUnit.InternationalUnit); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(VitaminAUnit.InternationalUnit, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new VitaminA(value: 1, unit: VitaminAUnit.InternationalUnit); + var quantity = new VitaminA(value: 1, unit: VitaminAUnit.InternationalUnit); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + VitaminA convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(VitaminAUnit.InternationalUnit, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -206,15 +183,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new VitaminA(value: 1, unit: VitaminA.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new VitaminA(value: 1, unit: VitaminA.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new VitaminA(value: 1, unit: VitaminA.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs index f782bfb5be..fb80a74bc2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs @@ -282,37 +282,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull() [Fact] public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit() { - Assert.Multiple(() => - { - var quantity = new VolumeConcentration(value: 1, unit: VolumeConcentrationUnit.DecimalFraction); - - VolumeConcentration convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(VolumeConcentrationUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }, () => - { - IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentrationUnit.DecimalFraction); - - IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI); - - Assert.Equal(VolumeConcentrationUnit.DecimalFraction, convertedQuantity.Unit); - Assert.Equal(quantity.Value, convertedQuantity.Value); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit() - { - IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentrationUnit.DecimalFraction); + var quantity = new VolumeConcentration(value: 1, unit: VolumeConcentrationUnit.DecimalFraction); - IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI); + VolumeConcentration convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(VolumeConcentrationUnit.DecimalFraction, convertedQuantity.Unit); Assert.Equal(quantity.Value, convertedQuantity.Value); } - [Fact] public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { @@ -320,15 +297,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() Assert.Multiple(() => { var quantity = new VolumeConcentration(value: 1, unit: VolumeConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }, () => { IQuantity quantity = new VolumeConcentration(value: 1, unit: VolumeConcentration.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); }); } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs index d90fb45e01..c641a62702 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs @@ -215,35 +215,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = VolumeFlowPerArea.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - VolumeFlowPerArea quantityToConvert = quantity; - - VolumeFlowPerArea convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - var expectedUnit = VolumeFlowPerArea.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + VolumeFlowPerArea convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -253,46 +225,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new VolumeFlowPerArea(value: 1, unit: VolumeFlowPerArea.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs index 86e87fd581..43e705c946 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs @@ -653,35 +653,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = VolumeFlow.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - VolumeFlow quantityToConvert = quantity; - - VolumeFlow convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - var expectedUnit = VolumeFlow.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + VolumeFlow convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -691,46 +663,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new VolumeFlow(value: 1, unit: VolumeFlow.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs index f9cada501c..b02a80a5ac 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = VolumePerLength.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - VolumePerLength quantityToConvert = quantity; - - VolumePerLength convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - var expectedUnit = VolumePerLength.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + VolumePerLength convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new VolumePerLength(value: 1, unit: VolumePerLength.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index 1c489bae06..554bf4995a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -533,35 +533,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = Volume.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - Volume quantityToConvert = quantity; - - Volume convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new Volume(value: 1, unit: Volume.BaseUnit); - var expectedUnit = Volume.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + Volume convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -571,46 +543,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new Volume(value: 1, unit: Volume.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new Volume(value: 1, unit: Volume.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new Volume(value: 1, unit: Volume.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs index b90ce99335..ebb7461584 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs @@ -257,35 +257,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = VolumetricHeatCapacity.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - VolumetricHeatCapacity quantityToConvert = quantity; - - VolumetricHeatCapacity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - var expectedUnit = VolumetricHeatCapacity.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + VolumetricHeatCapacity convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -295,46 +267,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs index 86348b2cc0..66c3fbb2bb 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs @@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits() var expectedUnit = WarpingMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); var expectedValue = quantity.As(expectedUnit); - Assert.Multiple(() => - { - WarpingMomentOfInertia quantityToConvert = quantity; - - WarpingMomentOfInertia convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }, () => - { - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI); - - Assert.Equal(expectedUnit, convertedQuantity.Unit); - Assert.Equal(expectedValue, convertedQuantity.Value); - }); - } - - [Fact] - public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() - { - var quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - var expectedUnit = WarpingMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI); - var expectedValue = quantity.As(expectedUnit); - - IQuantity quantityToConvert = quantity; - - IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI); + WarpingMomentOfInertia convertedQuantity = quantity.ToUnit(UnitSystem.SI); Assert.Equal(expectedUnit, convertedQuantity.Unit); Assert.Equal(expectedValue, convertedQuantity.Value); @@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits() public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull() { UnitSystem nullUnitSystem = null!; - Assert.Multiple(() => - { - var quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }, () => - { - IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull() - { - UnitSystem nullUnitSystem = null!; - IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem)); + var quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnit(nullUnitSystem)); } [Fact] public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported() { var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - Assert.Multiple(() => - { - var quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }, () => - { - IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); - }); - } - - [Fact] - public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported() - { - var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits); - IQuantity quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); - Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem)); + var quantity = new WarpingMomentOfInertia(value: 1, unit: WarpingMomentOfInertia.BaseUnit); + Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem)); } [Theory] diff --git a/UnitsNet/Extensions/QuantityExtensions.cs b/UnitsNet/Extensions/QuantityExtensions.cs index f17e8ef477..1c0c45f05e 100644 --- a/UnitsNet/Extensions/QuantityExtensions.cs +++ b/UnitsNet/Extensions/QuantityExtensions.cs @@ -91,13 +91,40 @@ public static TQuantity ToUnit(this TQuantity quantity, UnitSystem un /// /// Thrown if no matching unit is found for the specified . /// - public static IQuantity ToUnitUntyped(this IQuantity quantity, UnitSystem unitSystem) + [Obsolete("This method will be removed from the interface in the next major update.")] + public static IQuantity ToUnit(this IQuantity quantity, UnitSystem unitSystem) { QuantityInfo quantityInfo = quantity.QuantityInfo; UnitKey unitKey = quantityInfo.GetDefaultUnit(unitSystem).UnitKey; return quantityInfo.From(quantity.As(unitKey), unitKey); } + /// + /// Converts the specified quantity to a new quantity with a unit determined by the given . + /// + /// The quantity to convert. + /// The used to determine the target unit. + /// + /// A new quantity of the same type with the unit determined by the specified . + /// + /// + /// If multiple units are associated with the given , the first matching unit will be used. + /// + /// + /// Thrown if is null. + /// + /// + /// Thrown if no matching unit is found for the specified . + /// + [Obsolete("This method will be removed from the interface in the next major update.")] + public static IQuantity ToUnit(this IQuantity quantity, UnitSystem unitSystem) + where TUnit : struct, Enum + { + QuantityInfo quantityInfo = quantity.QuantityInfo; + TUnit unit = quantityInfo.GetDefaultUnit(unitSystem); + return quantityInfo.From(quantity.As(unit), unit); + } + /// /// Returns the string representation of the specified quantity using the provided format provider. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs index 001be237b1..b6f112682d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs @@ -1005,9 +1005,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AbsorbedDoseOfIonizingRadiationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index ba539ba7ef..a79f403c8f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -989,9 +989,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AccelerationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index cc1e09c9e8..cc35c6a903 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -1050,9 +1050,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index d10321d1ca..0ca0bbf498 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -769,9 +769,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index ba36f7726d..78dbe3a10c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -979,9 +979,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AngleUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index 38be3f47cb..3d87c90645 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -1073,9 +1073,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AreaUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index c3d63ffdfe..6c7ef6815a 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -763,9 +763,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AreaDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 86f0a2a5f8..13cc6ec47d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -824,9 +824,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index 795dfc5db0..65490593b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -1401,9 +1401,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(BitRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index a290e0bbdc..07286c4e4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -776,9 +776,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 3be0e767c6..e9e19462a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -817,9 +817,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs index f55993a95b..b74246bf9a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs @@ -822,9 +822,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(CompressibilityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 92032a6b04..4d52329220 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -1769,9 +1769,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(DensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs index b3818d1786..4b03550d9c 100644 --- a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs @@ -1149,9 +1149,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(DoseAreaProductUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 3a06fd2756..fb60a05084 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -1041,9 +1041,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(DurationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 449dd43c7a..2a4a9ba037 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -899,9 +899,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 1da7b7e4b5..7392567d82 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -988,9 +988,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs index 05afc2e869..8e98c25e7e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs @@ -750,9 +750,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricApparentEnergyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs index 52bfed06d4..5367c0fba3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs @@ -807,9 +807,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricApparentPowerUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs index 93cb706165..67e9c3849a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs @@ -825,9 +825,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricCapacitanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index e49f08f671..8d4fbf6369 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -924,9 +924,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricChargeUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index a32ba0df62..7db0f041bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -717,9 +717,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricChargeDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 9741bc4ace..fb6d7c9133 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -987,9 +987,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricConductanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index f585cdff22..c3dc8621c0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -818,9 +818,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricConductivityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 6773f97ffc..d2eee4752b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -902,9 +902,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricCurrentUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 617f60cfb0..14754c0f6d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -753,9 +753,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricCurrentDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index c191919dc9..2aaafbc0af 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -835,9 +835,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricCurrentGradientUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 07001c7f41..2c45bd77de 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -717,9 +717,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricFieldUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs index 4ab1778c5d..e80e09bd11 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs @@ -844,9 +844,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricImpedanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 90401e091a..45c48897b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -789,9 +789,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricInductanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 414a7dea5b..977e3bbb19 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -841,9 +841,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricPotentialUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 3a6eb7c47c..0eff908005 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -1056,9 +1056,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricPotentialChangeRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs index 1227e7683a..56c836de1d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs @@ -843,9 +843,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricReactanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs index f8bf99c1e2..6f36fe9791 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs @@ -750,9 +750,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricReactiveEnergyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs index f3dc6e12bc..da1980c167 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs @@ -771,9 +771,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricReactivePowerUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index df61ed438c..62064932d6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -856,9 +856,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricResistanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index f9b39ce80c..27b2ac1f4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -962,9 +962,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricResistivityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 67e721b3ae..00243c7965 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -753,9 +753,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricSurfaceChargeDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs index 89d8a47c92..436e814703 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs @@ -987,9 +987,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ElectricSusceptanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 0d4cc2c05d..b87ac20713 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -1513,9 +1513,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(EnergyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs index ef1da91623..935c9004c0 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -925,9 +925,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(EnergyDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 886b33b959..044c1128b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -849,9 +849,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(EntropyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs index 1f78c35804..31feea70b9 100644 --- a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs @@ -1041,9 +1041,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(FluidResistanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 88acce85ab..9ebcbb3860 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -1056,9 +1056,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ForceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 6881c7e022..c4ad1f00b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -979,9 +979,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ForceChangeRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index bb7d3f0173..17b8f491b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -1449,9 +1449,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ForcePerLengthUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 39c84b07d3..fba5dc91d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -925,9 +925,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(FrequencyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 91a8398037..037a48462f 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -771,9 +771,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(FuelEfficiencyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 9db4261a4c..fe54d7bfca 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -1033,9 +1033,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(HeatFluxUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 403e1341c2..fff8bf59ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -786,9 +786,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(HeatTransferCoefficientUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index e77177bbda..9d0e97a18a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -784,9 +784,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(IlluminanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs index 9b65b90484..63385d4322 100644 --- a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs @@ -930,9 +930,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ImpulseUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index f47576504e..9ec85bddf2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -1384,9 +1384,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(InformationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index bf99979ee6..0c54c2ff13 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -948,9 +948,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(IrradianceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index f175b32ed2..4cc7ae1994 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -861,9 +861,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(IrradiationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs index 8393dc142b..a1b18a43f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs @@ -907,9 +907,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(JerkUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index e5e220d1e4..84d10e19fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -895,9 +895,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(KinematicViscosityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs index 87992b7d3b..6df4e5c1e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs @@ -771,9 +771,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LeakRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 7adab6f10a..a0420a2689 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -1591,9 +1591,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LengthUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index c586867d22..c217f52fd3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -733,9 +733,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LevelUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 29c791fd2a..19ea93c939 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -1050,9 +1050,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LinearDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index e2cca5d859..693b9ede3e 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -1149,9 +1149,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LinearPowerDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs index 794ed1c79a..4f25bedae2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -892,9 +892,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LuminanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index dc75f0bffb..8b6283c16f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -951,9 +951,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LuminosityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 52ce518c02..e6e5a40188 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -737,9 +737,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LuminousFluxUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index 2050f82496..c5996efed6 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -737,9 +737,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(LuminousIntensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 631f7c005f..89cf3ada05 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -807,9 +807,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MagneticFieldUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 2170ca4925..b7ee30fa90 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -717,9 +717,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MagneticFluxUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 79e53b7363..79e70d1b52 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -717,9 +717,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MagnetizationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 190d8de426..dba77e6f77 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -1300,9 +1300,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MassUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 2622e9bf12..e18472915a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -1622,9 +1622,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MassConcentrationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index f65a0dd0fa..42819eda5e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -1366,9 +1366,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MassFlowUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 0343804338..06c953c5ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -939,9 +939,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MassFluxUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index e72b83638e..95b9b58673 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -1130,9 +1130,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MassFractionUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index ba7ddc4e24..7882fab689 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -1200,9 +1200,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MassMomentOfInertiaUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs index 0399c8a662..0d17632dd2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs @@ -753,9 +753,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MolalityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index e1f0831ca7..8860236f40 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -763,9 +763,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MolarEnergyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index a02fd67c37..3496e05cd1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -750,9 +750,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MolarEntropyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs index fa0a5c176c..a89a60dbd5 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs @@ -892,9 +892,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MolarFlowUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 1f48fd423c..1e59dc6a3a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -957,9 +957,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MolarMassUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index ad05e52da6..72d84d059b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -938,9 +938,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(MolarityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index 096a5f2191..ac02ac1927 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -717,9 +717,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PermeabilityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 184c14ca91..95963233a9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -717,9 +717,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PermittivityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs index 87b128ffc3..c12d5f0469 100644 --- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs @@ -789,9 +789,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PorousMediumPermeabilityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 196db5eb4e..73ca83675e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -1286,9 +1286,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PowerUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index bf180fb682..416672f755 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -1488,9 +1488,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PowerDensityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 96a8e8921b..daa2be7646 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -733,9 +733,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PowerRatioUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 33c3f7ab44..526cde7790 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -1636,9 +1636,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PressureUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 2b16d091c7..ce72564f34 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -1033,9 +1033,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(PressureChangeRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs index 338276b611..aef550349c 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs @@ -824,9 +824,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RadiationEquivalentDoseUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs index 6dd8144f3b..ab6cc246a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs @@ -889,9 +889,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RadiationEquivalentDoseRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs index cce72958a5..d56c8ee6ee 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs @@ -840,9 +840,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RadiationExposureUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs index 4bd2a51ff2..1537eac2ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs @@ -1218,9 +1218,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RadioactivityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index a3e9b4e4cd..ce760bf2f6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -790,9 +790,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RatioUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index d16395509a..b6581e50a9 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -732,9 +732,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RatioChangeRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index 4fef663397..c235bc2b23 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -945,9 +945,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ReciprocalAreaUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index 161b87a7ab..73213f4570 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -941,9 +941,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ReciprocalLengthUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index 55cdaaee00..9a88c51d80 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -700,9 +700,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RelativeHumidityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 5ba067111b..e5baf27cca 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -768,9 +768,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RotationalAccelerationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index a04323c8aa..83c1f05544 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -950,9 +950,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RotationalSpeedUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 47779ade24..8e7acc76b0 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -1317,9 +1317,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RotationalStiffnessUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 861a13dead..963a867e4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -799,9 +799,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(RotationalStiffnessPerLengthUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs index e309f8400f..d4b03c81f8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -700,9 +700,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ScalarUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 426c2a52e9..4b0c0fe94c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -703,9 +703,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(SolidAngleUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index f3f9977bd3..d97b7f2d98 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -1293,9 +1293,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(SpecificEnergyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 71a59b0be8..6ac6e1c0eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -878,9 +878,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(SpecificEntropyUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index 61f36c7143..58fbcfb12f 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -771,9 +771,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(SpecificFuelConsumptionUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 24bbd73d60..f3a70739c0 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -770,9 +770,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(SpecificVolumeUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index 3ecb62d133..0f06df849e 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -1039,9 +1039,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(SpecificWeightUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index f719b9eed4..dee7e22d6f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -1352,9 +1352,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(SpeedUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index f582fed9d0..7f7c82a806 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -858,9 +858,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(StandardVolumeFlowUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index c281eba1da..9fc35d9c1a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -830,9 +830,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(TemperatureUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index c1d2090eec..c1b9afe77b 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -1015,9 +1015,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(TemperatureChangeRateUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index dce0b0bad3..26546d80d8 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -913,9 +913,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(TemperatureDeltaUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index c1dd1c4e56..820e51f646 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -781,9 +781,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(TemperatureGradientUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 35fe6bea6e..a23c4d96a9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -735,9 +735,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ThermalConductivityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs index b972f8f404..6405b2eb1e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs @@ -822,9 +822,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ThermalInsulanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index 8bb30547b5..49ef4d2845 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -732,9 +732,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(ThermalResistanceUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 74f003fc0b..98d953b7c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -1201,9 +1201,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(TorqueUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index 4a490bf27e..2ba925df34 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -703,9 +703,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(TurbidityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index d2f6ae907d..0b63519ad7 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -700,9 +700,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(VitaminAUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index 7f00434352..1818c24c80 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -1783,9 +1783,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(VolumeUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index ab94ebcd43..1d155e4a18 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -1065,9 +1065,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(VolumeConcentrationUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 91f4b2eb17..58537dcc46 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -2087,9 +2087,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(VolumeFlowUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index 0bbcbc9baf..142bae6b9a 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -732,9 +732,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(VolumeFlowPerAreaUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index 60efd67bec..ffcaa0fa67 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -858,9 +858,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(VolumePerLengthUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index 9f628eed18..d088320282 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -861,9 +861,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(VolumetricHeatCapacityUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 3f89bfa93f..f03ce1f12a 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -804,9 +804,6 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(WarpingMomentOfInertiaUnit unit) => ToUnit(unit); - /// - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem); - #endregion #endregion diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 7dd7e7b232..e3633269a1 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -97,14 +97,6 @@ public interface IQuantity : IQuantity /// A new in the given . IQuantity ToUnit(TUnitType unit); - /// - /// Converts to a quantity with a unit determined by the given . - /// If multiple units were found for the given , the first match will be used. - /// - /// The to convert the quantity to. - /// A new quantity with the determined unit. - IQuantity ToUnit(UnitSystem unitSystem); - #if NET #region Implementation of IQuantity @@ -168,13 +160,6 @@ IQuantity IQuantity.ToUnit(TUnitType unit) { return TSelf.From(As(unit), unit); } - - IQuantity IQuantity.ToUnit(UnitSystem unitSystem) - { - TUnitType unit = QuantityInfo.GetDefaultUnit(unitSystem); - return ToUnit(unit); - } - #endif }